GuestImpl.h revision cfca7344103dc40ee706f9217fad1991ed22a60b
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * VirtualBox COM class implementation
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Copyright (C) 2006-2011 Oracle Corporation
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * This file is part of VirtualBox Open Source Edition (OSE), as
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * available from http://www.virtualbox.org. This file is free software;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * you can redistribute it and/or modify it under the terms of the GNU
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * General Public License (GPL) as published by the Free Software
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Foundation, in version 2 as it comes in the "COPYING" file of the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwtypedef enum
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw // Public initializer/uninitializer for internal purposes only
8c10a8659ac31335ed870a1711c0182623f72fd6as // IGuest properties
8c10a8659ac31335ed870a1711c0182623f72fd6as STDMETHOD(COMGETTER(AdditionsRunLevel)) (AdditionsRunLevelType_T *aRunLevel);
8c10a8659ac31335ed870a1711c0182623f72fd6as STDMETHOD(COMGETTER(AdditionsVersion)) (BSTR *aAdditionsVersion);
8c10a8659ac31335ed870a1711c0182623f72fd6as /** @todo Remove later by replacing it by AdditionsFeatureAvailable(). */
8c10a8659ac31335ed870a1711c0182623f72fd6as STDMETHOD(COMGETTER(SupportsSeamless)) (BOOL *aSupportsSeamless);
8c10a8659ac31335ed870a1711c0182623f72fd6as STDMETHOD(COMGETTER(SupportsGraphics)) (BOOL *aSupportsGraphics);
8c10a8659ac31335ed870a1711c0182623f72fd6as /** @todo Will replace SupportsSeamless, SupportsGraphics, ... */
8c10a8659ac31335ed870a1711c0182623f72fd6as STDMETHOD(COMGETTER(AdditionsFeatureAvailable)) (LONG64 aFeature, BOOL *aActive, BOOL *aAvailable);
8c10a8659ac31335ed870a1711c0182623f72fd6as STDMETHOD(COMGETTER(MemoryBalloonSize)) (ULONG *aMemoryBalloonSize);
8c10a8659ac31335ed870a1711c0182623f72fd6as STDMETHOD(COMSETTER(MemoryBalloonSize)) (ULONG aMemoryBalloonSize);
8c10a8659ac31335ed870a1711c0182623f72fd6as STDMETHOD(COMGETTER(StatisticsUpdateInterval)) (ULONG *aUpdateInterval);
8c10a8659ac31335ed870a1711c0182623f72fd6as STDMETHOD(COMSETTER(StatisticsUpdateInterval)) (ULONG aUpdateInterval);
8c10a8659ac31335ed870a1711c0182623f72fd6as // IGuest methods
8c10a8659ac31335ed870a1711c0182623f72fd6as STDMETHOD(GetFacilityStatus)(AdditionsFacilityType_T aType, LONG64 *aTimestamp, AdditionsFacilityStatus_T *aStatus);
8c10a8659ac31335ed870a1711c0182623f72fd6as STDMETHOD(GetAdditionsStatus)(AdditionsRunLevelType_T aLevel, BOOL *aActive);
8c10a8659ac31335ed870a1711c0182623f72fd6as STDMETHOD(SetCredentials)(IN_BSTR aUserName, IN_BSTR aPassword,
8c10a8659ac31335ed870a1711c0182623f72fd6as STDMETHOD(ExecuteProcess)(IN_BSTR aCommand, ULONG aFlags,
8c10a8659ac31335ed870a1711c0182623f72fd6as ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
8c10a8659ac31335ed870a1711c0182623f72fd6as STDMETHOD(GetProcessOutput)(ULONG aPID, ULONG aFlags, ULONG aTimeoutMS, LONG64 aSize, ComSafeArrayOut(BYTE, aData));
8c10a8659ac31335ed870a1711c0182623f72fd6as STDMETHOD(SetProcessInput)(ULONG aPID, ULONG aFlags, ULONG aTimeoutMS, ComSafeArrayIn(BYTE, aData), ULONG *aBytesWritten);
cb174861876aea6950a7ab4ce944aff84b1914cdjoyce mcintosh STDMETHOD(GetProcessStatus)(ULONG aPID, ULONG *aExitCode, ULONG *aFlags, ULONG *aStatus);
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego STDMETHOD(CopyToGuest)(IN_BSTR aSource, IN_BSTR aDest, IN_BSTR aUserName, IN_BSTR aPassword, ULONG aFlags, IProgress **aProgress);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb STDMETHOD(CreateDirectory)(IN_BSTR aDirectory, IN_BSTR aUserName, IN_BSTR aPassword, ULONG aMode, ULONG aFlags, IProgress **aProgress);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb STDMETHOD(InternalGetStatistics)(ULONG *aCpuUser, ULONG *aCpuKernel, ULONG *aCpuIdle,
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb ULONG *aMemTotal, ULONG *aMemFree, ULONG *aMemBalloon, ULONG *aMemShared, ULONG *aMemCache,
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb ULONG *aPageTotal, ULONG *aMemAllocTotal, ULONG *aMemFreeTotal, ULONG *aMemBalloonTotal, ULONG *aMemSharedTotal);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb STDMETHOD(UpdateGuestAdditions)(IN_BSTR aSource, ULONG aFlags, IProgress **aProgress);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw // Public methods that are not in IDL (only called internally).
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb HRESULT executeProcessInternal(IN_BSTR aCommand, ULONG aFlags,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb ULONG aTimeoutMS, ULONG *aPID, IProgress **aProgress, int *pRC);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb HRESULT createDirectoryInternal(IN_BSTR aDirectory, IN_BSTR aUserName, IN_BSTR aPassword,
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb ULONG aMode, ULONG aFlags, IProgress **aProgress, int *pRC);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb void setAdditionsInfo(Bstr aInterfaceVersion, VBOXOSTYPE aOsType);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb void setAdditionsInfo2(Bstr aAdditionsVersion, Bstr aVersionName, Bstr aRevision);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb void setAdditionsStatus(VBoxGuestStatusFacility enmFacility, VBoxGuestStatusCurrent enmStatus, ULONG aFlags);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb HRESULT setStatistic(ULONG aCpuId, GUESTSTATTYPE enmType, ULONG aVal);
8c10a8659ac31335ed870a1711c0182623f72fd6as /** Static callback for handling guest notifications. */
8c10a8659ac31335ed870a1711c0182623f72fd6as static DECLCALLBACK(int) doGuestCtrlNotification(void *pvExtension, uint32_t u32Function, void *pvParms, uint32_t cbParms);
8c10a8659ac31335ed870a1711c0182623f72fd6as return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw // Internal tasks.
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb // Internal callback context handling.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /** Pointer to user-supplied data. */
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb /** Size of user-supplied data. */
8622ec4569457733001d4982ef7f5b44427069beGordon Ross /** Pointer to user-supplied IProgress. */
8622ec4569457733001d4982ef7f5b44427069beGordon Ross * The map key is the context ID.
8622ec4569457733001d4982ef7f5b44427069beGordon Ross typedef std::map< uint32_t, CallbackContext > CallbackMap;
8622ec4569457733001d4982ef7f5b44427069beGordon Ross typedef std::map< uint32_t, CallbackContext >::iterator CallbackMapIter;
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb typedef std::map< uint32_t, CallbackContext >::const_iterator CallbackMapIterConst;
8622ec4569457733001d4982ef7f5b44427069beGordon Ross * The map key is the PID (process identifier).
8c10a8659ac31335ed870a1711c0182623f72fd6as typedef std::map< uint32_t, GuestProcess > GuestProcessMap;
8622ec4569457733001d4982ef7f5b44427069beGordon Ross typedef std::map< uint32_t, GuestProcess >::iterator GuestProcessMapIter;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw typedef std::map< uint32_t, GuestProcess >::const_iterator GuestProcessMapIterConst;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw int directoryEntryAppend(const char *pszPath, PRTLISTNODE pList);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw int directoryRead(const char *pszDirectory, const char *pszFilter, ULONG uFlags, ULONG *pcObjects, PRTLISTNODE pList);
8622ec4569457733001d4982ef7f5b44427069beGordon Ross int prepareExecuteEnv(const char *pszEnv, void **ppvList, uint32_t *pcbList, uint32_t *pcEnv);
8622ec4569457733001d4982ef7f5b44427069beGordon Ross /** Handler for guest execution control notifications. */
8622ec4569457733001d4982ef7f5b44427069beGordon Ross int notifyCtrlClientDisconnected(uint32_t u32Function, PCALLBACKDATACLIENTDISCONNECTED pData);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw int notifyCtrlExecStatus(uint32_t u32Function, PCALLBACKDATAEXECSTATUS pData);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw int notifyCtrlExecOut(uint32_t u32Function, PCALLBACKDATAEXECOUT pData);
8c10a8659ac31335ed870a1711c0182623f72fd6as int notifyCtrlExecInStatus(uint32_t u32Function, PCALLBACKDATAEXECINSTATUS pData);
8c10a8659ac31335ed870a1711c0182623f72fd6as CallbackMapIter getCtrlCallbackContextByID(uint32_t u32ContextID);
8622ec4569457733001d4982ef7f5b44427069beGordon Ross void notifyCtrlCallbackContext(Guest::CallbackMapIter it, const char *pszText);
8622ec4569457733001d4982ef7f5b44427069beGordon Ross void destroyCtrlCallbackContext(CallbackMapIter it);
8622ec4569457733001d4982ef7f5b44427069beGordon Ross uint32_t addCtrlCallbackContext(eVBoxGuestCtrlCallbackType enmType, void *pvData, uint32_t cbData, Progress* pProgress);
8622ec4569457733001d4982ef7f5b44427069beGordon Ross HRESULT waitForProcessStatusChange(ULONG uPID, ULONG *puRetStatus, ULONG *puRetExitCode, ULONG uTimeoutMS);
8c10a8659ac31335ed870a1711c0182623f72fd6as typedef std::map< AdditionsFacilityType_T, FacilityData > FacilityMap;
8622ec4569457733001d4982ef7f5b44427069beGordon Ross typedef std::map< AdditionsFacilityType_T, FacilityData >::iterator FacilityMapIter;
8c10a8659ac31335ed870a1711c0182623f72fd6as Data() : mAdditionsRunLevel (AdditionsRunLevelType_None),
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /** General extension callback for guest control. */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#endif // ____H_GUESTIMPL
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/* vi: set tabstop=4 shiftwidth=4 expandtab: */