ConsoleImpl.h revision 0158d474771d8cf8fb0bfbbe297d3f9b74de04cc
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore/* $Id$ */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore/** @file
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * VBox Console COM Class definition
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore/*
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * Copyright (C) 2005-2013 Oracle Corporation
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore *
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * This file is part of VirtualBox Open Source Edition (OSE), as
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * available from http://www.virtualbox.org. This file is free software;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * you can redistribute it and/or modify it under the terms of the GNU
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * General Public License (GPL) as published by the Free Software
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * Foundation, in version 2 as it comes in the "COPYING" file of the
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#ifndef ____H_CONSOLEIMPL
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#define ____H_CONSOLEIMPL
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#include "VirtualBoxBase.h"
239924d360a544a40689b6b360d1183a0a936d97Garrett D'Amore#include "VBox/com/array.h"
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore#include "EventImpl.h"
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreclass Guest;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreclass Keyboard;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreclass Mouse;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreclass Display;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreclass MachineDebugger;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreclass TeleporterStateSrc;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreclass OUSBDevice;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreclass RemoteUSBDevice;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreclass SharedFolder;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreclass VRDEServerInfo;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreclass AudioSniffer;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreclass Nvram;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#ifdef VBOX_WITH_USB_VIDEO
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreclass EmWebcam;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#endif
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#ifdef VBOX_WITH_USB_CARDREADER
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreclass UsbCardReader;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#endif
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreclass ConsoleVRDPServer;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreclass VMMDev;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreclass Progress;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreclass BusAssignmentManager;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'AmoreCOM_STRUCT_OR_CLASS(IEventListener);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore#ifdef VBOX_WITH_EXTPACK
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amoreclass ExtPackManager;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore#endif
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore#include <VBox/RemoteDesktop/VRDE.h>
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore#include <VBox/vmm/pdmdrv.h>
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore#ifdef VBOX_WITH_GUEST_PROPS
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore# include <VBox/HostServices/GuestPropertySvc.h> /* For the property notification callback */
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore#endif
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore#ifdef RT_OS_WINDOWS
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore# include "../src-server/win/VBoxComEvents.h"
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#endif
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amorestruct VUSBIRHCONFIG;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoretypedef struct VUSBIRHCONFIG *PVUSBIRHCONFIG;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#include <list>
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#include <vector>
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore// defines
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore///////////////////////////////////////////////////////////////////////////////
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore/**
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * Checks the availability of the underlying VM device driver corresponding
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * to the COM interface (IKeyboard, IMouse, IDisplay, etc.). When the driver is
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * not available (NULL), sets error info and returns returns E_ACCESSDENIED.
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * The translatable error message is defined in null context.
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore *
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * Intended to used only within Console children (i.e. Keyboard, Mouse,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * Display, etc.).
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore *
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * @param drv driver pointer to check (compare it with NULL)
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#define CHECK_CONSOLE_DRV(drv) \
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore do { \
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore if (!(drv)) \
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore return setError(E_ACCESSDENIED, tr("The console is not powered up")); \
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore } while (0)
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore// Console
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore///////////////////////////////////////////////////////////////////////////////
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore/** IConsole implementation class */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreclass ATL_NO_VTABLE Console :
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore public VirtualBoxBase,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore VBOX_SCRIPTABLE_IMPL(IConsole)
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore{
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore Q_OBJECT
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amorepublic:
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Console, IConsole)
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore DECLARE_NOT_AGGREGATABLE(Console)
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore DECLARE_PROTECT_FINAL_CONSTRUCT()
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore BEGIN_COM_MAP(Console)
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore VBOX_DEFAULT_INTERFACE_ENTRIES(IConsole)
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore END_COM_MAP()
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore Console();
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore ~Console();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT FinalConstruct();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void FinalRelease();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore // public initializers/uninitializers for internal purposes only
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT init(IMachine *aMachine, IInternalMachineControl *aControl, LockType_T aLockType);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void uninit();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore // IConsole properties
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(COMGETTER(Machine))(IMachine **aMachine);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(COMGETTER(State))(MachineState_T *aMachineState);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(COMGETTER(Guest))(IGuest **aGuest);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(COMGETTER(Keyboard))(IKeyboard **aKeyboard);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(COMGETTER(Mouse))(IMouse **aMouse);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(COMGETTER(Display))(IDisplay **aDisplay);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(COMGETTER(Debugger))(IMachineDebugger **aDebugger);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(COMGETTER(USBDevices))(ComSafeArrayOut(IUSBDevice *, aUSBDevices));
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(COMGETTER(RemoteUSBDevices))(ComSafeArrayOut(IHostUSBDevice *, aRemoteUSBDevices));
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(COMGETTER(VRDEServerInfo))(IVRDEServerInfo **aVRDEServerInfo);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(COMGETTER(SharedFolders))(ComSafeArrayOut(ISharedFolder *, aSharedFolders));
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(COMGETTER(EventSource)) (IEventSource ** aEventSource);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore STDMETHOD(COMGETTER(AttachedPCIDevices))(ComSafeArrayOut(IPCIDeviceAttachment *, aAttachments));
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore STDMETHOD(COMGETTER(UseHostClipboard))(BOOL *aUseHostClipboard);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore STDMETHOD(COMSETTER(UseHostClipboard))(BOOL aUseHostClipboard);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore // IConsole methods
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore STDMETHOD(PowerUp)(IProgress **aProgress);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore STDMETHOD(PowerUpPaused)(IProgress **aProgress);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore STDMETHOD(PowerDown)(IProgress **aProgress);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(Reset)();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(Pause)();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(Resume)();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(PowerButton)();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(SleepButton)();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(GetPowerButtonHandled)(BOOL *aHandled);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(GetGuestEnteredACPIMode)(BOOL *aEntered);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(SaveState)(IProgress **aProgress);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(AdoptSavedState)(IN_BSTR aSavedStateFile);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(DiscardSavedState)(BOOL aRemoveFile);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(GetDeviceActivity)(DeviceType_T aDeviceType,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore DeviceActivity_T *aDeviceActivity);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(AttachUSBDevice)(IN_BSTR aId);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(DetachUSBDevice)(IN_BSTR aId, IUSBDevice **aDevice);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(FindUSBDeviceByAddress)(IN_BSTR aAddress, IUSBDevice **aDevice);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(FindUSBDeviceById)(IN_BSTR aId, IUSBDevice **aDevice);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(CreateSharedFolder)(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable, BOOL aAutoMount);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(RemoveSharedFolder)(IN_BSTR aName);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(TakeSnapshot)(IN_BSTR aName, IN_BSTR aDescription,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore IProgress **aProgress);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(DeleteSnapshot)(IN_BSTR aId, IProgress **aProgress);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(DeleteSnapshotAndAllChildren)(IN_BSTR aId, IProgress **aProgress);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(DeleteSnapshotRange)(IN_BSTR aStartId, IN_BSTR aEndId, IProgress **aProgress);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(RestoreSnapshot)(ISnapshot *aSnapshot, IProgress **aProgress);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore STDMETHOD(Teleport)(IN_BSTR aHostname, ULONG aPort, IN_BSTR aPassword, ULONG aMaxDowntime, IProgress **aProgress);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore // public methods for internal purposes only
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /*
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * Note: the following methods do not increase refcount. intended to be
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * called only by the VM execution thread.
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore Guest *getGuest() const { return mGuest; }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore Keyboard *getKeyboard() const { return mKeyboard; }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore Mouse *getMouse() const { return mMouse; }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore Display *getDisplay() const { return mDisplay; }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore MachineDebugger *getMachineDebugger() const { return mDebugger; }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore AudioSniffer *getAudioSniffer() const { return mAudioSniffer; }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const ComPtr<IMachine> &machine() const { return mMachine; }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool useHostClipboard() { return mfUseHostClipboard; }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** Method is called only from ConsoleVRDPServer */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore IVRDEServer *getVRDEServer() const { return mVRDEServer; }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ConsoleVRDPServer *consoleVRDPServer() const { return mConsoleVRDPServer; }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT updateMachineState(MachineState_T aMachineState);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore // events from IInternalSessionControl
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onNetworkAdapterChange(INetworkAdapter *aNetworkAdapter, BOOL changeAdapter);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onSerialPortChange(ISerialPort *aSerialPort);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onParallelPortChange(IParallelPort *aParallelPort);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onStorageControllerChange();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onCPUChange(ULONG aCPU, BOOL aRemove);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onCPUExecutionCapChange(ULONG aExecutionCap);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onClipboardModeChange(ClipboardMode_T aClipboardMode);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onDragAndDropModeChange(DragAndDropMode_T aDragAndDropMode);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onVRDEServerChange(BOOL aRestart);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onVideoCaptureChange();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onUSBControllerChange();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onSharedFolderChange(BOOL aGlobal);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onUSBDeviceDetach(IN_BSTR aId, IVirtualBoxErrorInfo *aError);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT getGuestProperty(IN_BSTR aKey, BSTR *aValue, LONG64 *aTimestamp, BSTR *aFlags);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT setGuestProperty(IN_BSTR aKey, IN_BSTR aValue, IN_BSTR aFlags);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT enumerateGuestProperties(IN_BSTR aPatterns,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ComSafeArrayOut(BSTR, aNames),
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ComSafeArrayOut(BSTR, aValues),
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ComSafeArrayOut(LONG64, aTimestamps),
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ComSafeArrayOut(BSTR, aFlags));
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onlineMergeMedium(IMediumAttachment *aMediumAttachment,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ULONG aSourceIdx, ULONG aTargetIdx,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore IMedium *aSource, IMedium *aTarget,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore BOOL aMergeForward, IMedium *aParentForTarget,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ComSafeArrayIn(IMedium *, aChildrenToReparent),
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore IProgress *aProgress);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore VMMDev *getVMMDev() { return m_pVMMDev; }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore AudioSniffer *getAudioSniffer() { return mAudioSniffer; }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#ifdef VBOX_WITH_EXTPACK
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ExtPackManager *getExtPackManager();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#endif
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore EventSource *getEventSource() { return mEventSource; }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#ifdef VBOX_WITH_USB_CARDREADER
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore UsbCardReader *getUsbCardReader() { return mUsbCardReader; }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#endif
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#ifdef VBOX_WITH_USB_VIDEO
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore EmWebcam *getEmWebcam() { return mEmWebcam; }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#endif
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore int VRDPClientLogon(uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void VRDPClientStatusChange(uint32_t u32ClientId, const char *pszStatus);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void VRDPClientConnect(uint32_t u32ClientId);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void VRDPClientDisconnect(uint32_t u32ClientId, uint32_t fu32Intercepted);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void VRDPInterceptAudio(uint32_t u32ClientId);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void VRDPInterceptUSB(uint32_t u32ClientId, void **ppvIntercept);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void VRDPInterceptClipboard(uint32_t u32ClientId);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void processRemoteUSBDevices(uint32_t u32ClientId, VRDEUSBDEVICEDESC *pDevList, uint32_t cbDevList, bool fDescExt);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void reportVmStatistics(ULONG aValidStats, ULONG aCpuUser,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ULONG aCpuKernel, ULONG aCpuIdle,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ULONG aMemTotal, ULONG aMemFree,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ULONG aMemBalloon, ULONG aMemShared,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ULONG aMemCache, ULONG aPageTotal,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ULONG aAllocVMM, ULONG aFreeVMM,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ULONG aBalloonedVMM, ULONG aSharedVMM,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ULONG aVmNetRx, ULONG aVmNetTx)
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore {
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore mControl->ReportVmStatistics(aValidStats, aCpuUser, aCpuKernel, aCpuIdle,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore aMemTotal, aMemFree, aMemBalloon, aMemShared,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore aMemCache, aPageTotal, aAllocVMM, aFreeVMM,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore aBalloonedVMM, aSharedVMM, aVmNetRx, aVmNetTx);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void enableVMMStatistics(BOOL aEnable);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT pause(Reason_T aReason);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT resume(Reason_T aReason);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT saveState(Reason_T aReason, IProgress **aProgress);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore // callback callers (partly; for some events console callbacks are notified
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore // directly from IInternalSessionControl event handlers declared above)
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void onMousePointerShapeChange(bool fVisible, bool fAlpha,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore uint32_t xHot, uint32_t yHot,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore uint32_t width, uint32_t height,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ComSafeArrayIn(uint8_t, aShape));
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative, BOOL needsHostCursor);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void onStateChange(MachineState_T aMachineState);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void onAdditionsStateChange();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void onAdditionsOutdated();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void onKeyboardLedsChange(bool fNumLock, bool fCapsLock, bool fScrollLock);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void onUSBDeviceStateChange(IUSBDevice *aDevice, bool aAttached,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore IVirtualBoxErrorInfo *aError);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void onRuntimeError(BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void onVRDEServerInfoChange();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static const PDMDRVREG DrvStatusReg;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static HRESULT setErrorStatic(HRESULT aResultCode, const char *pcsz, ...);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT setInvalidMachineStateError();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static const char *convertControllerTypeToDev(StorageControllerType_T enmCtrlType);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static HRESULT convertBusPortDeviceToLun(StorageBus_T enmBus, LONG port, LONG device, unsigned &uLun);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore // Called from event listener
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT onNATRedirectRuleChange(ULONG ulInstance, BOOL aNatRuleRemove,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, IN_BSTR aGuestIp, LONG aGuestPort);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreprivate:
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /**
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * Base template for AutoVMCaller and SafeVMPtr. Template arguments
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * have the same meaning as arguments of Console::addVMCaller().
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore template <bool taQuiet = false, bool taAllowNullVM = false>
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore class AutoVMCallerBase
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore {
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore public:
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore AutoVMCallerBase(Console *aThat) : mThat(aThat), mRC(S_OK)
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore {
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore Assert(aThat);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore mRC = aThat->addVMCaller(taQuiet, taAllowNullVM);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ~AutoVMCallerBase()
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore {
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore if (SUCCEEDED(mRC))
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore mThat->releaseVMCaller();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** Decreases the number of callers before the instance is destroyed. */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void releaseCaller()
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore {
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore AssertReturnVoid(SUCCEEDED(mRC));
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore mThat->releaseVMCaller();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore mRC = E_FAIL;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** Restores the number of callers after by #release(). #rc() must be
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * rechecked to ensure the operation succeeded. */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void addYY()
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore {
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore AssertReturnVoid(!SUCCEEDED(mRC));
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore mRC = mThat->addVMCaller(taQuiet, taAllowNullVM);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** Returns the result of Console::addVMCaller() */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT rc() const { return mRC; }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** Shortcut to SUCCEEDED(rc()) */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool isOk() const { return SUCCEEDED(mRC); }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore protected:
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore Console *mThat;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT mRC;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore private:
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(AutoVMCallerBase)
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore };
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#if 0
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /**
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * Helper class that protects sections of code using the mpUVM pointer by
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * automatically calling addVMCaller() on construction and
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * releaseVMCaller() on destruction. Intended for Console methods dealing
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * with mpUVM. The usage pattern is:
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * <code>
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * AutoVMCaller autoVMCaller(this);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * if (FAILED(autoVMCaller.rc())) return autoVMCaller.rc();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * ...
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * VMR3ReqCall (mpUVM, ...
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * </code>
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore *
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * @note Temporarily locks the argument for writing.
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore *
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * @sa SafeVMPtr, SafeVMPtrQuiet
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * @obsolete Use SafeVMPtr
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore typedef AutoVMCallerBase<false, false> AutoVMCaller;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#endif
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /**
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * Same as AutoVMCaller but doesn't set extended error info on failure.
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore *
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * @note Temporarily locks the argument for writing.
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * @obsolete Use SafeVMPtrQuiet
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore typedef AutoVMCallerBase<true, false> AutoVMCallerQuiet;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /**
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * Same as AutoVMCaller but allows a null VM pointer (to trigger an error
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * instead of assertion).
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore *
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * @note Temporarily locks the argument for writing.
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * @obsolete Use SafeVMPtr
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore typedef AutoVMCallerBase<false, true> AutoVMCallerWeak;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /**
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * Same as AutoVMCaller but doesn't set extended error info on failure
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * and allows a null VM pointer (to trigger an error instead of
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * assertion).
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore *
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * @note Temporarily locks the argument for writing.
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * @obsolete Use SafeVMPtrQuiet
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore typedef AutoVMCallerBase<true, true> AutoVMCallerQuietWeak;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /**
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * Base template for SafeVMPtr and SafeVMPtrQuiet.
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore template<bool taQuiet = false>
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore class SafeVMPtrBase : public AutoVMCallerBase<taQuiet, true>
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore {
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore typedef AutoVMCallerBase<taQuiet, true> Base;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore public:
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore SafeVMPtrBase(Console *aThat) : Base(aThat), mpUVM(NULL)
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore {
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore if (SUCCEEDED(Base::mRC))
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore Base::mRC = aThat->safeVMPtrRetainer(&mpUVM, taQuiet);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ~SafeVMPtrBase()
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore {
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore if (SUCCEEDED(Base::mRC))
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore release();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** Direct PUVM access. */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore PUVM rawUVM() const { return mpUVM; }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** Release the handles. */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void release()
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore {
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore AssertReturnVoid(SUCCEEDED(Base::mRC));
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore Base::mThat->safeVMPtrReleaser(&mpUVM);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore Base::releaseCaller();
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore }
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore private:
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore PUVM mpUVM;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(SafeVMPtrBase)
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore };
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amorepublic:
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore /*
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * Helper class that safely manages the Console::mpUVM pointer
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * by calling addVMCaller() on construction and releaseVMCaller() on
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * destruction. Intended for Console children. The usage pattern is:
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * <code>
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * Console::SafeVMPtr ptrVM(mParent);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * if (!ptrVM.isOk())
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * return ptrVM.rc();
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * ...
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * VMR3ReqCall(ptrVM.rawUVM(), ...
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * ...
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * printf("%p\n", ptrVM.rawUVM());
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * </code>
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore *
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * @note Temporarily locks the argument for writing.
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore *
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * @sa SafeVMPtrQuiet, AutoVMCaller
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore */
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore typedef SafeVMPtrBase<false> SafeVMPtr;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore /**
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * A deviation of SafeVMPtr that doesn't set the error info on failure.
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * Intended for pieces of code that don't need to return the VM access
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * failure to the caller. The usage pattern is:
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * <code>
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * Console::SafeVMPtrQuiet pVM(mParent);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * if (pVM.rc())
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * VMR3ReqCall(pVM, ...
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * return S_OK;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * </code>
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore *
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * @note Temporarily locks the argument for writing.
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore *
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore * @sa SafeVMPtr, AutoVMCaller
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore */
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore typedef SafeVMPtrBase<true> SafeVMPtrQuiet;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore class SharedFolderData
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore {
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore public:
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore SharedFolderData()
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore { }
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore SharedFolderData(const Utf8Str &aHostPath,
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore bool aWritable,
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore bool aAutoMount)
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore : m_strHostPath(aHostPath),
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore m_fWritable(aWritable),
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore m_fAutoMount(aAutoMount)
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore { }
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore // copy constructor
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore SharedFolderData(const SharedFolderData& aThat)
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore : m_strHostPath(aThat.m_strHostPath),
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore m_fWritable(aThat.m_fWritable),
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore m_fAutoMount(aThat.m_fAutoMount)
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore { }
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore Utf8Str m_strHostPath;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore bool m_fWritable;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore bool m_fAutoMount;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore };
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore typedef std::map<Utf8Str, ComObjPtr<SharedFolder> > SharedFolderMap;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore typedef std::map<Utf8Str, SharedFolderData> SharedFolderDataMap;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore typedef std::map<Utf8Str, ComPtr<IMediumAttachment> > MediumAttachmentMap;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amoreprivate:
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore typedef std::list <ComObjPtr<OUSBDevice> > USBDeviceList;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore typedef std::list <ComObjPtr<RemoteUSBDevice> > RemoteUSBDeviceList;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore HRESULT addVMCaller(bool aQuiet = false, bool aAllowNullVM = false);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore void releaseVMCaller();
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore HRESULT safeVMPtrRetainer(PUVM *a_ppUVM, bool aQuiet);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore void safeVMPtrReleaser(PUVM *a_ppUVM);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore HRESULT consoleInitReleaseLog(const ComPtr<IMachine> aMachine);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore HRESULT powerUp(IProgress **aProgress, bool aPaused);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore HRESULT powerDown(IProgress *aProgress = NULL);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore/* Note: FreeBSD needs this whether netflt is used or not. */
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore#if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD))
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore HRESULT attachToTapInterface(INetworkAdapter *networkAdapter);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore HRESULT detachFromTapInterface(INetworkAdapter *networkAdapter);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore#endif
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore HRESULT powerDownHostInterfaces();
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore HRESULT setMachineState(MachineState_T aMachineState, bool aUpdateServer = true);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore HRESULT setMachineStateLocally(MachineState_T aMachineState)
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore {
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore return setMachineState(aMachineState, false /* aUpdateServer */);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT findSharedFolder(const Utf8Str &strName,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ComObjPtr<SharedFolder> &aSharedFolder,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool aSetError = false);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT fetchSharedFolders(BOOL aGlobal);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool findOtherSharedFolder(const Utf8Str &straName,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore SharedFolderDataMap::const_iterator &aIt);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT createSharedFolder(const Utf8Str &strName, const SharedFolderData &aData);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT removeSharedFolder(const Utf8Str &strName);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static DECLCALLBACK(int) configConstructor(PUVM pUVM, PVM pVM, void *pvConsole);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore int configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore int configCfgmOverlay(PCFGMNODE pRoot, IVirtualBox *pVirtualBox, IMachine *pMachine);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore int configDumpAPISettingsTweaks(IVirtualBox *pVirtualBox, IMachine *pMachine);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore int configGraphicsController(PCFGMNODE pDevices, const char *pcszDevice,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore BusAssignmentManager *pBusMgr,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const ComPtr<IMachine> &pMachine,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const ComPtr<IBIOSSettings> &biosSettings,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool fHMEnabled);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore int configMediumAttachment(PCFGMNODE pCtlInst,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const char *pcszDevice,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore unsigned uInstance,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore StorageBus_T enmBus,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore bool fUseHostIOCache,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore bool fBuiltinIoCache,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool fSetupMerge,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore unsigned uMergeSource,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore unsigned uMergeTarget,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore IMediumAttachment *pMediumAtt,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore MachineState_T aMachineState,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore HRESULT *phrc,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore bool fAttachDetach,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore bool fForceUnmount,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore bool fHotplug,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore PUVM pUVM,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore DeviceType_T *paLedDevType);
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore int configMedium(PCFGMNODE pLunL0,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore bool fPassthrough,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore DeviceType_T enmType,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore bool fUseHostIOCache,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore bool fBuiltinIoCache,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore bool fSetupMerge,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore unsigned uMergeSource,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore unsigned uMergeTarget,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore const char *pcszBwGroup,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore bool fDiscard,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore IMedium *pMedium,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore MachineState_T aMachineState,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore HRESULT *phrc);
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore static DECLCALLBACK(int) reconfigureMediumAttachment(Console *pConsole,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore PUVM pUVM,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const char *pcszDevice,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore unsigned uInstance,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore StorageBus_T enmBus,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool fUseHostIOCache,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool fBuiltinIoCache,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool fSetupMerge,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore unsigned uMergeSource,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore unsigned uMergeTarget,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore IMediumAttachment *aMediumAtt,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore MachineState_T aMachineState,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT *phrc);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static DECLCALLBACK(int) changeRemovableMedium(Console *pThis,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore PUVM pUVM,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const char *pcszDevice,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore unsigned uInstance,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore StorageBus_T enmBus,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool fUseHostIOCache,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore IMediumAttachment *aMediumAtt,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool fForce);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT attachRawPCIDevices(PUVM pUVM, BusAssignmentManager *BusMgr, PCFGMNODE pDevices);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void attachStatusDriver(PCFGMNODE pCtlInst, PPDMLED *papLeds,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore uint64_t uFirst, uint64_t uLast,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore Console::MediumAttachmentMap *pmapMediumAttachments,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const char *pcszDevice, unsigned uInstance);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore int configNetwork(const char *pszDevice, unsigned uInstance, unsigned uLun,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore INetworkAdapter *aNetworkAdapter, PCFGMNODE pCfg,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore PCFGMNODE pLunL0, PCFGMNODE pInst,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool fAttachDetach, bool fIgnoreConnectFailure);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore static DECLCALLBACK(int) configGuestProperties(void *pvConsole, PUVM pUVM);
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore static DECLCALLBACK(int) configGuestControl(void *pvConsole);
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore static DECLCALLBACK(void) vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore static DECLCALLBACK(int) unplugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore static DECLCALLBACK(int) plugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore HRESULT doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, PUVM pUVM);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore HRESULT doCPURemove(ULONG aCpu, PUVM pUVM);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore HRESULT doCPUAdd(ULONG aCpu, PUVM pUVM);
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT doNetworkAdapterChange(PUVM pUVM, const char *pszDevice, unsigned uInstance,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore unsigned uLun, INetworkAdapter *aNetworkAdapter);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static DECLCALLBACK(int) changeNetworkAttachment(Console *pThis, PUVM pUVM, const char *pszDevice,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore unsigned uInstance, unsigned uLun,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore INetworkAdapter *aNetworkAdapter);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void changeClipboardMode(ClipboardMode_T aClipboardMode);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void changeDragAndDropMode(DragAndDropMode_T aDragAndDropMode);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#ifdef VBOX_WITH_USB
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT detachUSBDevice(const ComObjPtr<OUSBDevice> &aHostDevice);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static DECLCALLBACK(int) usbAttachCallback(Console *that, PUVM pUVM, IUSBDevice *aHostDevice, PCRTUUID aUuid,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool aRemote, const char *aAddress, void *pvRemoteBackend, USHORT aPortVersion, ULONG aMaskedIfs);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static DECLCALLBACK(int) usbDetachCallback(Console *that, PUVM pUVM, PCRTUUID aUuid);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#endif
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static DECLCALLBACK(int) attachStorageDevice(Console *pThis,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore PUVM pUVM,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const char *pcszDevice,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore unsigned uInstance,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore StorageBus_T enmBus,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool fUseHostIOCache,
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore IMediumAttachment *aMediumAtt,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool fSilent);
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore static DECLCALLBACK(int) detachStorageDevice(Console *pThis,
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore PUVM pUVM,
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore const char *pcszDevice,
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore unsigned uInstance,
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore StorageBus_T enmBus,
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore IMediumAttachment *aMediumAtt,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool fSilent);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static DECLCALLBACK(int) fntTakeSnapshotWorker(RTTHREAD Thread, void *pvUser);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static DECLCALLBACK(int) stateProgressCallback(PUVM pUVM, unsigned uPercent, void *pvUser);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static DECLCALLBACK(void) genericVMSetErrorCallback(PUVM pUVM, void *pvUser, int rc, RT_SRC_POS_DECL,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const char *pszErrorFmt, va_list va);
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void setVMRuntimeErrorCallbackF(uint32_t fFatal, const char *pszErrorId, const char *pszFormat, ...);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static DECLCALLBACK(void) setVMRuntimeErrorCallback(PUVM pUVM, void *pvUser, uint32_t fFatal,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const char *pszErrorId, const char *pszFormat, va_list va);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT captureUSBDevices(PUVM pUVM);
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore void detachAllUSBDevices(bool aDone);
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore static DECLCALLBACK(int) powerUpThread(RTTHREAD Thread, void *pvUser);
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore static DECLCALLBACK(int) saveStateThread(RTTHREAD Thread, void *pvUser);
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore static DECLCALLBACK(int) powerDownThread(RTTHREAD Thread, void *pvUser);
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore static DECLCALLBACK(int) vmm2User_SaveState(PCVMM2USERMETHODS pThis, PUVM pUVM);
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore static DECLCALLBACK(void) vmm2User_NotifyEmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static DECLCALLBACK(void) vmm2User_NotifyEmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static DECLCALLBACK(void) vmm2User_NotifyPdmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static DECLCALLBACK(void) vmm2User_NotifyPdmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore static DECLCALLBACK(void *) drvStatus_QueryInterface(PPDMIBASE pInterface, const char *pszIID);
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore static DECLCALLBACK(void) drvStatus_UnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static DECLCALLBACK(int) drvStatus_MediumEjected(PPDMIMEDIANOTIFY pInterface, unsigned iLUN);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static DECLCALLBACK(void) drvStatus_Destruct(PPDMDRVINS pDrvIns);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static DECLCALLBACK(int) drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore int mcAudioRefs;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore volatile uint32_t mcVRDPClients;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore uint32_t mu32SingleRDPClientId; /* The id of a connected client in the single connection mode. */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore volatile bool mcGuestCredentialsProvided;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static const char *sSSMConsoleUnit;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static uint32_t sSSMConsoleVer;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT loadDataFromSavedState();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore int loadStateFileExecInternal(PSSMHANDLE pSSM, uint32_t u32Version);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static DECLCALLBACK(void) saveStateFileExec(PSSMHANDLE pSSM, void *pvUser);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static DECLCALLBACK(int) loadStateFileExec(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#ifdef VBOX_WITH_GUEST_PROPS
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore static DECLCALLBACK(int) doGuestPropNotification(void *pvExtension, uint32_t, void *pvParms, uint32_t cbParms);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore HRESULT doEnumerateGuestProperties(CBSTR aPatterns,
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore ComSafeArrayOut(BSTR, aNames),
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore ComSafeArrayOut(BSTR, aValues),
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore ComSafeArrayOut(LONG64, aTimestamps),
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ComSafeArrayOut(BSTR, aFlags));
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void guestPropertiesHandleVMReset(void);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool guestPropertiesVRDPEnabled(void);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void guestPropertiesVRDPUpdateLogon(uint32_t u32ClientId, const char *pszUser, const char *pszDomain);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void guestPropertiesVRDPUpdateActiveClient(uint32_t u32ClientId);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void guestPropertiesVRDPUpdateClientAttach(uint32_t u32ClientId, bool fAttached);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void guestPropertiesVRDPUpdateNameChange(uint32_t u32ClientId, const char *pszName);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void guestPropertiesVRDPUpdateIPAddrChange(uint32_t u32ClientId, const char *pszIPAddr);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void guestPropertiesVRDPUpdateLocationChange(uint32_t u32ClientId, const char *pszLocation);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore void guestPropertiesVRDPUpdateOtherInfoChange(uint32_t u32ClientId, const char *pszOtherInfo);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore void guestPropertiesVRDPUpdateDisconnect(uint32_t u32ClientId);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore#endif
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** @name Teleporter support
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * @{ */
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore static DECLCALLBACK(int) teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT teleporterSrc(TeleporterStateSrc *pState);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT teleporterSrcReadACK(TeleporterStateSrc *pState, const char *pszWhich, const char *pszNAckMsg = NULL);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT teleporterSrcSubmitCommand(TeleporterStateSrc *pState, const char *pszCommand, bool fWaitForAck = true);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore HRESULT teleporterTrg(PUVM pUVM, IMachine *pMachine, Utf8Str *pErrorMsg, bool fStartPaused,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore Progress *pProgress, bool *pfPowerOffOnFailure);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore static DECLCALLBACK(int) teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser);
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore /** @} */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool mSavedStateDataLoaded : 1;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const ComPtr<IMachine> mMachine;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const ComPtr<IInternalMachineControl> mControl;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const ComPtr<IVRDEServer> mVRDEServer;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ConsoleVRDPServer * const mConsoleVRDPServer;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore const ComObjPtr<Guest> mGuest;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const ComObjPtr<Keyboard> mKeyboard;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const ComObjPtr<Mouse> mMouse;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const ComObjPtr<Display> mDisplay;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const ComObjPtr<MachineDebugger> mDebugger;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const ComObjPtr<VRDEServerInfo> mVRDEServerInfo;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** This can safely be used without holding any locks.
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * An AutoCaller suffices to prevent it being destroy while in use and
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * internally there is a lock providing the necessary serialization. */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const ComObjPtr<EventSource> mEventSource;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#ifdef VBOX_WITH_EXTPACK
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore const ComObjPtr<ExtPackManager> mptrExtPackManager;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#endif
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore USBDeviceList mUSBDevices;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore RemoteUSBDeviceList mRemoteUSBDevices;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore SharedFolderDataMap m_mapGlobalSharedFolders;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore SharedFolderDataMap m_mapMachineSharedFolders;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore SharedFolderMap m_mapSharedFolders; // the console instances
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** The user mode VM handle. */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore PUVM mpUVM;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** Holds the number of "readonly" mpUVM callers (users). */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore uint32_t mVMCallers;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** Semaphore posted when the number of mpUVM callers drops to zero. */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore RTSEMEVENT mVMZeroCallersSem;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** true when Console has entered the mpUVM destruction phase. */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool mVMDestroying : 1;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** true when power down is initiated by vmstateChangeCallback (EMT). */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool mVMPoweredOff : 1;
f9ead4a57883f3ef04ef20d83cc47987d98c0687Garrett D'Amore /** true when vmstateChangeCallback shouldn't initiate a power down. */
f9ead4a57883f3ef04ef20d83cc47987d98c0687Garrett D'Amore bool mVMIsAlreadyPoweringOff : 1;
f9ead4a57883f3ef04ef20d83cc47987d98c0687Garrett D'Amore /** true if we already showed the snapshot folder size warning. */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool mfSnapshotFolderSizeWarningShown : 1;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** true if we already showed the snapshot folder ext4/xfs bug warning. */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool mfSnapshotFolderExt4WarningShown : 1;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** true if we already listed the disk type of the snapshot folder. */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool mfSnapshotFolderDiskTypeShown : 1;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** Pointer to the VMM -> User (that's us) callbacks. */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore struct MYVMM2USERMETHODS : public VMM2USERMETHODS
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore {
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore Console *pConsole;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore } *mpVmm2UserMethods;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** The current network attachment type in the VM.
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * This doesn't have to match the network attachment type maintained in the
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * NetworkAdapter. This is needed to change the network attachment
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * dynamically.
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore typedef std::vector<NetworkAttachmentType_T> NetworkAttachmentTypeVector;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore NetworkAttachmentTypeVector meAttachmentType;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore VMMDev * m_pVMMDev;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore AudioSniffer * const mAudioSniffer;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore Nvram * const mNvram;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#ifdef VBOX_WITH_USB_VIDEO
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore EmWebcam * const mEmWebcam;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#endif
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#ifdef VBOX_WITH_USB_CARDREADER
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore UsbCardReader * const mUsbCardReader;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#endif
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore BusAssignmentManager* mBusMgr;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore enum
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore {
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore iLedFloppy = 0,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore cLedFloppy = 2,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore iLedIde = iLedFloppy + cLedFloppy,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore cLedIde = 4,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore iLedSata = iLedIde + cLedIde,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore cLedSata = 30,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore iLedScsi = iLedSata + cLedSata,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore cLedScsi = 16,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore iLedSas = iLedScsi + cLedScsi,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore cLedSas = 8,
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore cLedStorage = cLedFloppy + cLedIde + cLedSata + cLedScsi + cLedSas
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore };
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore DeviceType_T maStorageDevType[cLedStorage];
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore PPDMLED mapStorageLeds[cLedStorage];
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore PPDMLED mapNetworkLeds[36]; /**< @todo adapt this to the maximum network card count */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore PPDMLED mapSharedFolderLed;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore PPDMLED mapUSBLed[2];
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore MediumAttachmentMap mapMediumAttachments;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore/* Note: FreeBSD needs this whether netflt is used or not. */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD))
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore Utf8Str maTAPDeviceName[8];
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore RTFILE maTapFD[8];
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#endif
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool mVMStateChangeCallbackDisabled;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool mfUseHostClipboard;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** Local machine state value. */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore MachineState_T mMachineState;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** Pointer to the progress object of a live cancelable task.
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore *
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * This is currently only used by Console::Teleport(), but is intended to later
505c7a699305ccafcfecc1ab0e7d4a25e2bfd1c2Garrett D'Amore * be used by the live snapshot code path as well. Actions like
505c7a699305ccafcfecc1ab0e7d4a25e2bfd1c2Garrett D'Amore * Console::PowerDown, which automatically cancels out the running snapshot /
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * teleportation operation, will cancel the teleportation / live snapshot
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore * operation before starting. */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ComObjPtr<Progress> mptrCancelableProgress;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /* The purpose of caching of some events is probably in order to
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore automatically fire them at new event listeners. However, there is no
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore (longer?) any code making use of this... */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#ifdef CONSOLE_WITH_EVENT_CACHE
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore struct
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore {
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** OnMousePointerShapeChange() cache */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore struct
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore {
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool valid;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool visible;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool alpha;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore uint32_t xHot;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore uint32_t yHot;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore uint32_t width;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore uint32_t height;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore com::SafeArray<BYTE> shape;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore } mpsc;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** OnMouseCapabilityChange() cache */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore struct
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore {
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore bool valid;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore BOOL supportsAbsolute;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore BOOL supportsRelative;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore BOOL needsHostCursor;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore } mcc;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore /** OnKeyboardLedsChange() cache */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore struct
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore {
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool valid;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore bool numLock;
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore bool capsLock;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore bool scrollLock;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore } klc;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore void clear()
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore {
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore RT_ZERO(mcc);
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore RT_ZERO(klc);
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore /* We cannot RT_ZERO mpsc because of shape's vtable. */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore mpsc.shape.setNull();
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore mpsc.valid = mpsc.visible = mpsc.alpha = false;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore mpsc.xHot = mpsc.yHot = mpsc.width = mpsc.height = 0;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore } mCallbackData;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#endif
5b1627536384deb03449347af9c01bd4fc2d271eGarrett D'Amore ComPtr<IEventListener> mVmListener;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore friend struct VMTask;
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore};
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore#endif // !____H_CONSOLEIMPL
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore/* vi: set tabstop=4 shiftwidth=4 expandtab: */
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore