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