ConsoleImpl.h revision f4e16c86f9803ccce2022e73c0e23fc120c08498
/* $Id$ */
/** @file
*
* VBox Console COM Class definition
*/
/*
* Copyright (C) 2006-2008 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#ifndef ____H_CONSOLEIMPL
#define ____H_CONSOLEIMPL
#include "VirtualBoxBase.h"
#include "ProgressImpl.h"
#ifdef VBOX_WITH_GUEST_PROPS
#endif
struct VUSBIRHCONFIG;
typedef struct VUSBIRHCONFIG *PVUSBIRHCONFIG;
#include <list>
// defines
///////////////////////////////////////////////////////////////////////////////
/**
* Checks the availability of the underlying VM device driver corresponding
* to the COM interface (IKeyboard, IMouse, IDisplay, etc.). When the driver is
* not available (NULL), sets error info and returns returns E_ACCESSDENIED.
* The translatable error message is defined in null context.
*
* Intended to used only within Console children (i.e. Keyboard, Mouse,
* Display, etc.).
*
* @param drv driver pointer to check (compare it with NULL)
*/
#define CHECK_CONSOLE_DRV(drv) \
do { \
if (!(drv)) \
} while (0)
// Console
///////////////////////////////////////////////////////////////////////////////
/** IConsole implementation class */
{
Console();
~Console();
void FinalRelease();
// public initializers/uninitializers for internal purposes only
void uninit();
// IConsole properties
// IConsole methods
STDMETHOD(PowerButton)();
STDMETHOD(SleepButton)();
// public methods for internal purposes only
/*
* Note: the following methods do not increase refcount. intended to be
* called only by the VM execution thread.
*/
/** Method is called only from ConsoleVRDPServer */
// events from IInternalSessionControl
HRESULT enumerateGuestProperties (IN_BSTR aPatterns, ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(BSTR, aValues), ComSafeArrayOut(ULONG64, aTimestamps), ComSafeArrayOut(BSTR, aFlags));
int VRDPClientLogon (uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain);
void processRemoteUSBDevices (uint32_t u32ClientId, VRDPUSBDEVICEDESC *pDevList, uint32_t cbDevList);
// callback callers (partly; for some events console callbacks are notified
// directly from IInternalSessionControl event handlers declared above)
void *pShape);
void onAdditionsStateChange();
void onAdditionsOutdated();
static const PDMDRVREG DrvStatusReg;
{
setError (E_FAIL, tr("Could not load the external authentication library '%s' (%Rrc)"), filename, rc);
}
// for VirtualBoxSupportErrorInfoImpl
/**
* Base template for AutoVMCaller and SaveVMPtr. Template arguments
* have the same meaning as arguments of Console::addVMCaller().
*/
{
{
}
{
mThat->releaseVMCaller();
}
/** Decreases the number of callers before the instance is destroyed. */
void release()
{
mThat->releaseVMCaller();
}
/** Restores the number of callers after by #release(). #rc() must be
* rechecked to ensure the operation succeeded. */
void add()
{
}
/** Returns the result of Console::addVMCaller() */
/** Shortcut to SUCCEEDED (rc()) */
};
/**
* Helper class that protects sections of code using the mpVM pointer by
* automatically calling addVMCaller() on construction and
* releaseVMCaller() on destruction. Intended for Console methods dealing
* with mpVM. The usage pattern is:
* <code>
* AutoVMCaller autoVMCaller (this);
* CheckComRCReturnRC (autoVMCaller.rc());
* ...
* VMR3ReqCall (mpVM, ...
* </code>
*
* @note Temporarily locks the argument for writing.
*
* @sa SafeVMPtr, SafeVMPtrQuiet
*/
typedef AutoVMCallerBase <false, false> AutoVMCaller;
/**
* Same as AutoVMCaller but doesn't set extended error info on failure.
*
* @note Temporarily locks the argument for writing.
*/
typedef AutoVMCallerBase <true, false> AutoVMCallerQuiet;
/**
* Same as AutoVMCaller but allows a null VM pointer (to trigger an error
* instead of assertion).
*
* @note Temporarily locks the argument for writing.
*/
typedef AutoVMCallerBase <false, true> AutoVMCallerWeak;
/**
* Same as AutoVMCaller but doesn't set extended error info on failure
* and allows a null VM pointer (to trigger an error instead of
* assertion).
*
* @note Temporarily locks the argument for writing.
*/
typedef AutoVMCallerBase <true, true> AutoVMCallerQuietWeak;
/**
* Base template for SaveVMPtr and SaveVMPtrQuiet.
*/
{
{
}
/** Smart SaveVMPtr to PVM cast operator */
/** Direct PVM access for printf()-like functions */
};
/**
* Helper class that safely manages the Console::mpVM pointer
* by calling addVMCaller() on construction and releaseVMCaller() on
* destruction. Intended for Console children. The usage pattern is:
* <code>
* Console::SaveVMPtr pVM (mParent);
* CheckComRCReturnRC (pVM.rc());
* ...
* VMR3ReqCall (pVM, ...
* ...
* printf ("%p\n", pVM.raw());
* </code>
*
* @note Temporarily locks the argument for writing.
*
* @sa SafeVMPtrQuiet, AutoVMCaller
*/
/**
* A deviation of SaveVMPtr that doesn't set the error info on failure.
* Intended for pieces of code that don't need to return the VM access
* failure to the caller. The usage pattern is:
* <code>
* Console::SaveVMPtrQuiet pVM (mParent);
* if (pVM.rc())
* VMR3ReqCall (pVM, ...
* return S_OK;
* </code>
*
* @note Temporarily locks the argument for writing.
*
* @sa SafeVMPtr, AutoVMCaller
*/
{
SharedFolderData() {}
};
void releaseVMCaller();
{
}
bool aSetError = false);
bool fPassthrough);
const char *pszPath, bool fPassthrough);
#ifdef VBOX_WITH_USB
static DECLCALLBACK(int)
static DECLCALLBACK(int)
#endif
static DECLCALLBACK (int)
static DECLCALLBACK(void)
static DECLCALLBACK(void)
const char *pszErrorID,
void detachAllUSBDevices (bool aDone);
static DECLCALLBACK(void *) drvStatus_QueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
int mcAudioRefs;
volatile uint32_t mcVRDPClients;
static const char *sSSMConsoleUnit;
static uint32_t sSSMConsoleVer;
#ifdef VBOX_WITH_GUEST_PROPS
#endif
bool mSavedStateDataLoaded : 1;
ConsoleVRDPServer * const mConsoleVRDPServer;
/** The VM instance handle. */
/** Holds the number of "readonly" mpVM callers (users) */
/** Semaphore posted when the number of mpVM callers drops to zero */
/** true when Console has entered the mpVM destruction phase */
bool mVMDestroying : 1;
/** true when power down is initiated by vmstateChangeCallback (EMT) */
bool mVMPoweredOff : 1;
/** The current DVD drive state in the VM.
* This does not have to match the state maintained in the DVD. */
/** The current Floppy drive state in the VM.
* This does not have to match the state maintained in the Floppy. */
AudioSniffer * const mAudioSniffer;
#if !defined(VBOX_WITH_NETFLT) && defined(RT_OS_LINUX)
#endif
/* Local machine state value */
struct
{
/** OnMousePointerShapeChange() cache */
struct
{
bool valid;
bool visible;
bool alpha;
}
mpsc;
/** OnMouseCapabilityChange() cache */
struct
{
bool valid;
}
mcc;
/** OnKeyboardLedsChange() cache */
struct
{
bool valid;
bool numLock;
bool capsLock;
bool scrollLock;
}
klc;
}
};
#endif // ____H_CONSOLEIMPL
/* vi: set tabstop=4 shiftwidth=4 expandtab: */