VirtualBox

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

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

Main: bugref:1909: Added API localization

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.8 KB
Line 
1/* $Id: HostImpl.h 90828 2021-08-24 09:44:46Z vboxsync $ */
2/** @file
3 * Implementation of IHost.
4 */
5
6/*
7 * Copyright (C) 2006-2020 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 getUSBDevices(std::vector<ComPtr<IHostUSBDevice> > &aUSBDevices);
104 HRESULT getUSBDeviceFilters(std::vector<ComPtr<IHostUSBDeviceFilter> > &aUSBDeviceFilters);
105 HRESULT getNetworkInterfaces(std::vector<ComPtr<IHostNetworkInterface> > &aNetworkInterfaces);
106 HRESULT getNameServers(std::vector<com::Utf8Str> &aNameServers);
107 HRESULT getDomainName(com::Utf8Str &aDomainName);
108 HRESULT getSearchStrings(std::vector<com::Utf8Str> &aSearchStrings);
109 HRESULT getProcessorCount(ULONG *aProcessorCount);
110 HRESULT getProcessorOnlineCount(ULONG *aProcessorOnlineCount);
111 HRESULT getProcessorCoreCount(ULONG *aProcessorCoreCount);
112 HRESULT getProcessorOnlineCoreCount(ULONG *aProcessorOnlineCoreCount);
113 HRESULT getHostDrives(std::vector<ComPtr<IHostDrive> > &aHostDrives);
114 HRESULT getMemorySize(ULONG *aMemorySize);
115 HRESULT getMemoryAvailable(ULONG *aMemoryAvailable);
116 HRESULT getOperatingSystem(com::Utf8Str &aOperatingSystem);
117 HRESULT getOSVersion(com::Utf8Str &aOSVersion);
118 HRESULT getUTCTime(LONG64 *aUTCTime);
119 HRESULT getAcceleration3DAvailable(BOOL *aAcceleration3DAvailable);
120 HRESULT getVideoInputDevices(std::vector<ComPtr<IHostVideoInputDevice> > &aVideoInputDevices);
121 HRESULT getUpdate(ComPtr<IHostUpdate> &aUpdate);
122 HRESULT getUpdateResponse(BOOL *aUpdateNeeded);
123 HRESULT getUpdateVersion(com::Utf8Str &aUpdateVersion);
124 HRESULT getUpdateURL(com::Utf8Str &aUpdateURL);
125 HRESULT getUpdateCheckNeeded(BOOL *aUpdateCheckNeeded);
126
127 // wrapped IHost methods
128 HRESULT getProcessorSpeed(ULONG aCpuId,
129 ULONG *aSpeed);
130 HRESULT getProcessorFeature(ProcessorFeature_T aFeature,
131 BOOL *aSupported);
132 HRESULT getProcessorDescription(ULONG aCpuId,
133 com::Utf8Str &aDescription);
134 HRESULT getProcessorCPUIDLeaf(ULONG aCpuId,
135 ULONG aLeaf,
136 ULONG aSubLeaf,
137 ULONG *aValEax,
138 ULONG *aValEbx,
139 ULONG *aValEcx,
140 ULONG *aValEdx);
141 HRESULT createHostOnlyNetworkInterface(ComPtr<IHostNetworkInterface> &aHostInterface,
142 ComPtr<IProgress> &aProgress);
143 HRESULT removeHostOnlyNetworkInterface(const com::Guid &aId,
144 ComPtr<IProgress> &aProgress);
145 HRESULT createUSBDeviceFilter(const com::Utf8Str &aName,
146 ComPtr<IHostUSBDeviceFilter> &aFilter);
147 HRESULT insertUSBDeviceFilter(ULONG aPosition,
148 const ComPtr<IHostUSBDeviceFilter> &aFilter);
149 HRESULT removeUSBDeviceFilter(ULONG aPosition);
150 HRESULT findHostDVDDrive(const com::Utf8Str &aName,
151 ComPtr<IMedium> &aDrive);
152 HRESULT findHostFloppyDrive(const com::Utf8Str &aName,
153 ComPtr<IMedium> &aDrive);
154 HRESULT findHostNetworkInterfaceByName(const com::Utf8Str &aName,
155 ComPtr<IHostNetworkInterface> &aNetworkInterface);
156 HRESULT findHostNetworkInterfaceById(const com::Guid &aId,
157 ComPtr<IHostNetworkInterface> &aNetworkInterface);
158 HRESULT findHostNetworkInterfacesOfType(HostNetworkInterfaceType_T aType,
159 std::vector<ComPtr<IHostNetworkInterface> > &aNetworkInterfaces);
160 HRESULT findUSBDeviceById(const com::Guid &aId,
161 ComPtr<IHostUSBDevice> &aDevice);
162 HRESULT findUSBDeviceByAddress(const com::Utf8Str &aName,
163 ComPtr<IHostUSBDevice> &aDevice);
164 HRESULT generateMACAddress(com::Utf8Str &aAddress);
165
166 HRESULT addUSBDeviceSource(const com::Utf8Str &aBackend, const com::Utf8Str &aId, const com::Utf8Str &aAddress,
167 const std::vector<com::Utf8Str> &aPropertyNames, const std::vector<com::Utf8Str> &aPropertyValues);
168
169 HRESULT removeUSBDeviceSource(const com::Utf8Str &aId);
170 HRESULT UpdateCheck(UpdateCheckType_T aCheckType,
171 ComPtr<IProgress> &aProgress);
172
173 // Internal Methods.
174
175 HRESULT i_buildDVDDrivesList(MediaList &list);
176 HRESULT i_buildFloppyDrivesList(MediaList &list);
177 HRESULT i_findHostDriveByNameOrId(DeviceType_T mediumType, const Utf8Str &strNameOrId, ComObjPtr<Medium> &pMedium);
178
179#if defined(RT_OS_SOLARIS) && defined(VBOX_USE_LIBHAL)
180 bool i_getDVDInfoFromHal(std::list< ComObjPtr<Medium> > &list);
181 bool i_getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list);
182 HRESULT i_getFixedDrivesFromHal(std::list<std::pair<com::Utf8Str, com::Utf8Str> > &list) RT_NOEXCEPT;
183#endif
184
185#if defined(RT_OS_SOLARIS)
186 void i_getDVDInfoFromDevTree(std::list< ComObjPtr<Medium> > &list);
187 void i_parseMountTable(char *mountTable, std::list< ComObjPtr<Medium> > &list);
188 bool i_validateDevice(const char *deviceNode, bool isCDROM);
189 HRESULT i_getFixedDrivesFromDevTree(std::list<std::pair<com::Utf8Str, com::Utf8Str> > &list) RT_NOEXCEPT;
190#endif
191
192 HRESULT i_updateNetIfList();
193
194#ifndef RT_OS_WINDOWS
195 HRESULT i_parseResolvConf();
196#else
197 HRESULT i_fetchNameResolvingInformation();
198#endif
199
200#ifdef VBOX_WITH_RESOURCE_USAGE_API
201 void i_registerMetrics(PerformanceCollector *aCollector);
202 void i_registerDiskMetrics(PerformanceCollector *aCollector);
203 void i_unregisterMetrics(PerformanceCollector *aCollector);
204#endif /* VBOX_WITH_RESOURCE_USAGE_API */
205
206#ifdef RT_OS_WINDOWS
207 HRESULT i_getFixedDrivesFromGlobalNamespace(std::list<std::pair<com::Utf8Str, com::Utf8Str> > &aDriveList) RT_NOEXCEPT;
208#endif
209 HRESULT i_getDrivesPathsList(std::list<std::pair<com::Utf8Str, com::Utf8Str> > &aDriveList) RT_NOEXCEPT;
210
211 struct Data; // opaque data structure, defined in HostImpl.cpp
212 Data *m;
213};
214
215#endif /* !MAIN_INCLUDED_HostImpl_h */
216
Note: See TracBrowser for help on using the repository browser.

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