VirtualBox

source: vbox/trunk/src/VBox/Main/include/HostImpl.h@ 96175

Last change on this file since 96175 was 95423, checked in by vboxsync, 3 years ago

Audio/Main: Bigger revamp of the audio interface(s) to later also support host audio device enumeration and selection for individual VMs. The audio settings now live in a dedicated (per-VM) IAudioSettings interface (audio adapter + audio host device stuff), to further tidy up the IMachine interface. Also added stubs for IAudioDevice + IHostAudioDevice, plus enmuerations, left for further implementation. Added a new IHostAudioDeviceChangedEvent that can also be used later by API clients. bugref:10050

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.9 KB
Line 
1/* $Id: HostImpl.h 95423 2022-06-29 11:13:40Z vboxsync $ */
2/** @file
3 * Implementation of IHost.
4 */
5
6/*
7 * Copyright (C) 2006-2022 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef MAIN_INCLUDED_HostImpl_h
19#define MAIN_INCLUDED_HostImpl_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include "HostWrap.h"
25
26class HostUSBDeviceFilter;
27class USBProxyService;
28class SessionMachine;
29class Progress;
30class PerformanceCollector;
31class HostDrive;
32class HostDrivePartition;
33
34namespace settings
35{
36 struct Host;
37}
38
39#include <list>
40
41class ATL_NO_VTABLE Host :
42 public HostWrap
43{
44public:
45
46 DECLARE_COMMON_CLASS_METHODS(Host)
47
48 HRESULT FinalConstruct();
49 void FinalRelease();
50
51 // public initializer/uninitializer for internal purposes only
52 HRESULT init(VirtualBox *aParent);
53 void uninit();
54
55 // public methods only for internal purposes
56
57 /**
58 * Override of the default locking class to be used for validating lock
59 * order with the standard member lock handle.
60 */
61 virtual VBoxLockingClass getLockingClass() const
62 {
63 return LOCKCLASS_HOSTOBJECT;
64 }
65
66 HRESULT i_loadSettings(const settings::Host &data);
67 HRESULT i_saveSettings(settings::Host &data);
68
69 void i_updateProcessorFeatures();
70
71 HRESULT i_getDrives(DeviceType_T mediumType, bool fRefresh, MediaList *&pll, AutoWriteLock &treeLock);
72 HRESULT i_findHostDriveById(DeviceType_T mediumType, const Guid &uuid, bool fRefresh, ComObjPtr<Medium> &pMedium);
73 HRESULT i_findHostDriveByName(DeviceType_T mediumType, const Utf8Str &strLocationFull, bool fRefresh, ComObjPtr<Medium> &pMedium);
74
75#ifdef VBOX_WITH_USB
76 typedef std::list< ComObjPtr<HostUSBDeviceFilter> > USBDeviceFilterList;
77
78 /** Must be called from under this object's lock. */
79 USBProxyService* i_usbProxyService();
80
81 HRESULT i_addChild(HostUSBDeviceFilter *pChild);
82 HRESULT i_removeChild(HostUSBDeviceFilter *pChild);
83 VirtualBox* i_parent();
84
85 HRESULT i_onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter, BOOL aActiveChanged = FALSE);
86 void i_getUSBFilters(USBDeviceFilterList *aGlobalFiltes);
87 HRESULT i_checkUSBProxyService();
88#endif /* !VBOX_WITH_USB */
89
90 static void i_generateMACAddress(Utf8Str &mac);
91
92#ifdef RT_OS_WINDOWS
93 HRESULT i_updatePersistentConfigForHostOnlyAdapters(void);
94 HRESULT i_removePersistentConfig(const Bstr &bstrGuid);
95#endif /* RT_OS_WINDOWS */
96
97
98private:
99
100 // wrapped IHost properties
101 HRESULT getDVDDrives(std::vector<ComPtr<IMedium> > &aDVDDrives);
102 HRESULT getFloppyDrives(std::vector<ComPtr<IMedium> > &aFloppyDrives);
103 HRESULT getAudioDevices(std::vector<ComPtr<IHostAudioDevice> > &aAudioDevices);
104 HRESULT getUSBDevices(std::vector<ComPtr<IHostUSBDevice> > &aUSBDevices);
105 HRESULT getUSBDeviceFilters(std::vector<ComPtr<IHostUSBDeviceFilter> > &aUSBDeviceFilters);
106 HRESULT getNetworkInterfaces(std::vector<ComPtr<IHostNetworkInterface> > &aNetworkInterfaces);
107 HRESULT getNameServers(std::vector<com::Utf8Str> &aNameServers);
108 HRESULT getDomainName(com::Utf8Str &aDomainName);
109 HRESULT getSearchStrings(std::vector<com::Utf8Str> &aSearchStrings);
110 HRESULT getProcessorCount(ULONG *aProcessorCount);
111 HRESULT getProcessorOnlineCount(ULONG *aProcessorOnlineCount);
112 HRESULT getProcessorCoreCount(ULONG *aProcessorCoreCount);
113 HRESULT getProcessorOnlineCoreCount(ULONG *aProcessorOnlineCoreCount);
114 HRESULT getHostDrives(std::vector<ComPtr<IHostDrive> > &aHostDrives);
115 HRESULT getMemorySize(ULONG *aMemorySize);
116 HRESULT getMemoryAvailable(ULONG *aMemoryAvailable);
117 HRESULT getOperatingSystem(com::Utf8Str &aOperatingSystem);
118 HRESULT getOSVersion(com::Utf8Str &aOSVersion);
119 HRESULT getUTCTime(LONG64 *aUTCTime);
120 HRESULT getAcceleration3DAvailable(BOOL *aAcceleration3DAvailable);
121 HRESULT getVideoInputDevices(std::vector<ComPtr<IHostVideoInputDevice> > &aVideoInputDevices);
122 HRESULT getUpdateHost(ComPtr<IUpdateAgent> &aUpdate);
123 HRESULT getUpdateExtPack(ComPtr<IUpdateAgent> &aUpdate);
124 HRESULT getUpdateGuestAdditions(ComPtr<IUpdateAgent> &aUpdate);
125 HRESULT getUpdateResponse(BOOL *aUpdateNeeded);
126 HRESULT getUpdateVersion(com::Utf8Str &aUpdateVersion);
127 HRESULT getUpdateURL(com::Utf8Str &aUpdateURL);
128 HRESULT getUpdateCheckNeeded(BOOL *aUpdateCheckNeeded);
129
130 // wrapped IHost methods
131 HRESULT getProcessorSpeed(ULONG aCpuId,
132 ULONG *aSpeed);
133 HRESULT getProcessorFeature(ProcessorFeature_T aFeature,
134 BOOL *aSupported);
135 HRESULT getProcessorDescription(ULONG aCpuId,
136 com::Utf8Str &aDescription);
137 HRESULT getProcessorCPUIDLeaf(ULONG aCpuId,
138 ULONG aLeaf,
139 ULONG aSubLeaf,
140 ULONG *aValEax,
141 ULONG *aValEbx,
142 ULONG *aValEcx,
143 ULONG *aValEdx);
144 HRESULT createHostOnlyNetworkInterface(ComPtr<IHostNetworkInterface> &aHostInterface,
145 ComPtr<IProgress> &aProgress);
146 HRESULT removeHostOnlyNetworkInterface(const com::Guid &aId,
147 ComPtr<IProgress> &aProgress);
148 HRESULT createUSBDeviceFilter(const com::Utf8Str &aName,
149 ComPtr<IHostUSBDeviceFilter> &aFilter);
150 HRESULT insertUSBDeviceFilter(ULONG aPosition,
151 const ComPtr<IHostUSBDeviceFilter> &aFilter);
152 HRESULT removeUSBDeviceFilter(ULONG aPosition);
153 HRESULT findHostDVDDrive(const com::Utf8Str &aName,
154 ComPtr<IMedium> &aDrive);
155 HRESULT findHostFloppyDrive(const com::Utf8Str &aName,
156 ComPtr<IMedium> &aDrive);
157 HRESULT findHostNetworkInterfaceByName(const com::Utf8Str &aName,
158 ComPtr<IHostNetworkInterface> &aNetworkInterface);
159 HRESULT findHostNetworkInterfaceById(const com::Guid &aId,
160 ComPtr<IHostNetworkInterface> &aNetworkInterface);
161 HRESULT findHostNetworkInterfacesOfType(HostNetworkInterfaceType_T aType,
162 std::vector<ComPtr<IHostNetworkInterface> > &aNetworkInterfaces);
163 HRESULT findUSBDeviceById(const com::Guid &aId,
164 ComPtr<IHostUSBDevice> &aDevice);
165 HRESULT findUSBDeviceByAddress(const com::Utf8Str &aName,
166 ComPtr<IHostUSBDevice> &aDevice);
167 HRESULT generateMACAddress(com::Utf8Str &aAddress);
168
169 HRESULT addUSBDeviceSource(const com::Utf8Str &aBackend, const com::Utf8Str &aId, const com::Utf8Str &aAddress,
170 const std::vector<com::Utf8Str> &aPropertyNames, const std::vector<com::Utf8Str> &aPropertyValues);
171
172 HRESULT removeUSBDeviceSource(const com::Utf8Str &aId);
173
174 // Internal Methods.
175
176 HRESULT i_buildDVDDrivesList(MediaList &list);
177 HRESULT i_buildFloppyDrivesList(MediaList &list);
178 HRESULT i_findHostDriveByNameOrId(DeviceType_T mediumType, const Utf8Str &strNameOrId, ComObjPtr<Medium> &pMedium);
179
180#if defined(RT_OS_SOLARIS) && defined(VBOX_USE_LIBHAL)
181 bool i_getDVDInfoFromHal(std::list< ComObjPtr<Medium> > &list);
182 bool i_getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list);
183 HRESULT i_getFixedDrivesFromHal(std::list<std::pair<com::Utf8Str, com::Utf8Str> > &list) RT_NOEXCEPT;
184#endif
185
186#if defined(RT_OS_SOLARIS)
187 void i_getDVDInfoFromDevTree(std::list< ComObjPtr<Medium> > &list);
188 void i_parseMountTable(char *mountTable, std::list< ComObjPtr<Medium> > &list);
189 bool i_validateDevice(const char *deviceNode, bool isCDROM);
190 HRESULT i_getFixedDrivesFromDevTree(std::list<std::pair<com::Utf8Str, com::Utf8Str> > &list) RT_NOEXCEPT;
191#endif
192
193 HRESULT i_updateNetIfList();
194
195#ifndef RT_OS_WINDOWS
196 HRESULT i_parseResolvConf();
197#else
198 HRESULT i_fetchNameResolvingInformation();
199#endif
200
201#ifdef VBOX_WITH_RESOURCE_USAGE_API
202 void i_registerMetrics(PerformanceCollector *aCollector);
203 void i_registerDiskMetrics(PerformanceCollector *aCollector);
204 void i_unregisterMetrics(PerformanceCollector *aCollector);
205#endif /* VBOX_WITH_RESOURCE_USAGE_API */
206
207#ifdef RT_OS_WINDOWS
208 HRESULT i_getFixedDrivesFromGlobalNamespace(std::list<std::pair<com::Utf8Str, com::Utf8Str> > &aDriveList) RT_NOEXCEPT;
209#endif
210 HRESULT i_getDrivesPathsList(std::list<std::pair<com::Utf8Str, com::Utf8Str> > &aDriveList) RT_NOEXCEPT;
211
212 struct Data; // opaque data structure, defined in HostImpl.cpp
213 Data *m;
214};
215
216#endif /* !MAIN_INCLUDED_HostImpl_h */
217
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette