From f215e02bf85f68d3a6106c2a1f4f7f063f819064 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 11 Apr 2024 10:17:27 +0200 Subject: Adding upstream version 7.0.14-dfsg. Signed-off-by: Daniel Baumann --- src/VBox/Main/include/HostImpl.h | 227 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 227 insertions(+) create mode 100644 src/VBox/Main/include/HostImpl.h (limited to 'src/VBox/Main/include/HostImpl.h') diff --git a/src/VBox/Main/include/HostImpl.h b/src/VBox/Main/include/HostImpl.h new file mode 100644 index 00000000..a3fbbe8c --- /dev/null +++ b/src/VBox/Main/include/HostImpl.h @@ -0,0 +1,227 @@ +/* $Id: HostImpl.h $ */ +/** @file + * Implementation of IHost. + */ + +/* + * Copyright (C) 2006-2023 Oracle and/or its affiliates. + * + * This file is part of VirtualBox base platform packages, as + * available from https://www.virtualbox.org. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, in version 3 of the + * License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + * + * SPDX-License-Identifier: GPL-3.0-only + */ + +#ifndef MAIN_INCLUDED_HostImpl_h +#define MAIN_INCLUDED_HostImpl_h +#ifndef RT_WITHOUT_PRAGMA_ONCE +# pragma once +#endif + +#include "HostWrap.h" + +class HostUSBDeviceFilter; +class USBProxyService; +class SessionMachine; +class Progress; +class PerformanceCollector; +class HostDrive; +class HostDrivePartition; + +namespace settings +{ + struct Host; +} + +#include + +class ATL_NO_VTABLE Host : + public HostWrap +{ +public: + + DECLARE_COMMON_CLASS_METHODS(Host) + + HRESULT FinalConstruct(); + void FinalRelease(); + + // public initializer/uninitializer for internal purposes only + HRESULT init(VirtualBox *aParent); + void uninit(); + + // public methods only for internal purposes + + /** + * Override of the default locking class to be used for validating lock + * order with the standard member lock handle. + */ + virtual VBoxLockingClass getLockingClass() const + { + return LOCKCLASS_HOSTOBJECT; + } + + HRESULT i_loadSettings(const settings::Host &data); + HRESULT i_saveSettings(settings::Host &data); + + void i_updateProcessorFeatures(); + + HRESULT i_getDrives(DeviceType_T mediumType, bool fRefresh, MediaList *&pll, AutoWriteLock &treeLock); + HRESULT i_findHostDriveById(DeviceType_T mediumType, const Guid &uuid, bool fRefresh, ComObjPtr &pMedium); + HRESULT i_findHostDriveByName(DeviceType_T mediumType, const Utf8Str &strLocationFull, bool fRefresh, ComObjPtr &pMedium); + +#ifdef VBOX_WITH_USB + typedef std::list< ComObjPtr > USBDeviceFilterList; + + /** Must be called from under this object's lock. */ + USBProxyService* i_usbProxyService(); + + HRESULT i_addChild(HostUSBDeviceFilter *pChild); + HRESULT i_removeChild(HostUSBDeviceFilter *pChild); + VirtualBox* i_parent(); + + HRESULT i_onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter, BOOL aActiveChanged = FALSE); + void i_getUSBFilters(USBDeviceFilterList *aGlobalFiltes); + HRESULT i_checkUSBProxyService(); +#endif /* !VBOX_WITH_USB */ + + static void i_generateMACAddress(Utf8Str &mac); + +#ifdef RT_OS_WINDOWS + HRESULT i_updatePersistentConfigForHostOnlyAdapters(void); + HRESULT i_removePersistentConfig(const Bstr &bstrGuid); +#endif /* RT_OS_WINDOWS */ + + +private: + + // wrapped IHost properties + HRESULT getDVDDrives(std::vector > &aDVDDrives); + HRESULT getFloppyDrives(std::vector > &aFloppyDrives); + HRESULT getAudioDevices(std::vector > &aAudioDevices); + HRESULT getUSBDevices(std::vector > &aUSBDevices); + HRESULT getUSBDeviceFilters(std::vector > &aUSBDeviceFilters); + HRESULT getNetworkInterfaces(std::vector > &aNetworkInterfaces); + HRESULT getNameServers(std::vector &aNameServers); + HRESULT getDomainName(com::Utf8Str &aDomainName); + HRESULT getSearchStrings(std::vector &aSearchStrings); + HRESULT getProcessorCount(ULONG *aProcessorCount); + HRESULT getProcessorOnlineCount(ULONG *aProcessorOnlineCount); + HRESULT getProcessorCoreCount(ULONG *aProcessorCoreCount); + HRESULT getProcessorOnlineCoreCount(ULONG *aProcessorOnlineCoreCount); + HRESULT getHostDrives(std::vector > &aHostDrives); + HRESULT getMemorySize(ULONG *aMemorySize); + HRESULT getMemoryAvailable(ULONG *aMemoryAvailable); + HRESULT getOperatingSystem(com::Utf8Str &aOperatingSystem); + HRESULT getOSVersion(com::Utf8Str &aOSVersion); + HRESULT getUTCTime(LONG64 *aUTCTime); + HRESULT getAcceleration3DAvailable(BOOL *aAcceleration3DAvailable); + HRESULT getVideoInputDevices(std::vector > &aVideoInputDevices); + HRESULT getUpdateHost(ComPtr &aUpdate); + HRESULT getUpdateExtPack(ComPtr &aUpdate); + HRESULT getUpdateGuestAdditions(ComPtr &aUpdate); + HRESULT getUpdateResponse(BOOL *aUpdateNeeded); + HRESULT getUpdateVersion(com::Utf8Str &aUpdateVersion); + HRESULT getUpdateURL(com::Utf8Str &aUpdateURL); + HRESULT getUpdateCheckNeeded(BOOL *aUpdateCheckNeeded); + + // wrapped IHost methods + HRESULT getProcessorSpeed(ULONG aCpuId, + ULONG *aSpeed); + HRESULT getProcessorFeature(ProcessorFeature_T aFeature, + BOOL *aSupported); + HRESULT getProcessorDescription(ULONG aCpuId, + com::Utf8Str &aDescription); + HRESULT getProcessorCPUIDLeaf(ULONG aCpuId, + ULONG aLeaf, + ULONG aSubLeaf, + ULONG *aValEax, + ULONG *aValEbx, + ULONG *aValEcx, + ULONG *aValEdx); + HRESULT createHostOnlyNetworkInterface(ComPtr &aHostInterface, + ComPtr &aProgress); + HRESULT removeHostOnlyNetworkInterface(const com::Guid &aId, + ComPtr &aProgress); + HRESULT createUSBDeviceFilter(const com::Utf8Str &aName, + ComPtr &aFilter); + HRESULT insertUSBDeviceFilter(ULONG aPosition, + const ComPtr &aFilter); + HRESULT removeUSBDeviceFilter(ULONG aPosition); + HRESULT findHostDVDDrive(const com::Utf8Str &aName, + ComPtr &aDrive); + HRESULT findHostFloppyDrive(const com::Utf8Str &aName, + ComPtr &aDrive); + HRESULT findHostNetworkInterfaceByName(const com::Utf8Str &aName, + ComPtr &aNetworkInterface); + HRESULT findHostNetworkInterfaceById(const com::Guid &aId, + ComPtr &aNetworkInterface); + HRESULT findHostNetworkInterfacesOfType(HostNetworkInterfaceType_T aType, + std::vector > &aNetworkInterfaces); + HRESULT findUSBDeviceById(const com::Guid &aId, + ComPtr &aDevice); + HRESULT findUSBDeviceByAddress(const com::Utf8Str &aName, + ComPtr &aDevice); + HRESULT generateMACAddress(com::Utf8Str &aAddress); + + HRESULT addUSBDeviceSource(const com::Utf8Str &aBackend, const com::Utf8Str &aId, const com::Utf8Str &aAddress, + const std::vector &aPropertyNames, const std::vector &aPropertyValues); + + HRESULT removeUSBDeviceSource(const com::Utf8Str &aId); + + // Internal Methods. + + HRESULT i_buildDVDDrivesList(MediaList &list); + HRESULT i_buildFloppyDrivesList(MediaList &list); + HRESULT i_findHostDriveByNameOrId(DeviceType_T mediumType, const Utf8Str &strNameOrId, ComObjPtr &pMedium); + +#if defined(RT_OS_SOLARIS) && defined(VBOX_USE_LIBHAL) + bool i_getDVDInfoFromHal(std::list< ComObjPtr > &list); + bool i_getFloppyInfoFromHal(std::list< ComObjPtr > &list); + HRESULT i_getFixedDrivesFromHal(std::list > &list) RT_NOEXCEPT; +#endif + +#if defined(RT_OS_SOLARIS) + void i_getDVDInfoFromDevTree(std::list< ComObjPtr > &list); + void i_parseMountTable(char *mountTable, std::list< ComObjPtr > &list); + bool i_validateDevice(const char *deviceNode, bool isCDROM); + HRESULT i_getFixedDrivesFromDevTree(std::list > &list) RT_NOEXCEPT; +#endif + + HRESULT i_updateNetIfList(); + +#ifndef RT_OS_WINDOWS + HRESULT i_parseResolvConf(); +#else + HRESULT i_fetchNameResolvingInformation(); +#endif + +#ifdef VBOX_WITH_RESOURCE_USAGE_API + void i_registerMetrics(PerformanceCollector *aCollector); + void i_registerDiskMetrics(PerformanceCollector *aCollector); + void i_unregisterMetrics(PerformanceCollector *aCollector); +#endif /* VBOX_WITH_RESOURCE_USAGE_API */ + +#ifdef RT_OS_WINDOWS + HRESULT i_getFixedDrivesFromGlobalNamespace(std::list > &aDriveList) RT_NOEXCEPT; +#endif + HRESULT i_getDrivesPathsList(std::list > &aDriveList) RT_NOEXCEPT; + + struct Data; // opaque data structure, defined in HostImpl.cpp + Data *m; +}; + +#endif /* !MAIN_INCLUDED_HostImpl_h */ + -- cgit v1.2.3