VirtualBox

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

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

Main/Update check: Big overhaul of the API and functionality.

  • Now uses VBOX_WITH_UPDATE_AGENT to entirely disable the feature (enabled by default).
  • Main: Uses new (more abstract) API as proposed in the latest UML docs.
  • Main: Added support for several events.
  • Main: Added support for update severities, order and dependencies (all optional).
  • Settings/XML: Now has own "Updates" branch to also cover other updatable components (later); not part of the system properties anymore.
  • Prepared for GuestAdditions and ExtPack updates.
  • FE/Qt: Adapted to new API.
  • FE/VBoxManage: Adapted to new API; uses more uniform (common) synopsis "modify" and "list" for modifying and listing (showing) update settings.
  • Docs: Fixed various typos, extended documentation.

Work in progress. bugref:7983

  • 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 94643 2022-04-20 09:08:37Z 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 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 getUpdateHost(ComPtr<IUpdateAgent> &aUpdate);
122 HRESULT getUpdateExtPack(ComPtr<IUpdateAgent> &aUpdate);
123 HRESULT getUpdateGuestAdditions(ComPtr<IUpdateAgent> &aUpdate);
124 HRESULT getUpdateResponse(BOOL *aUpdateNeeded);
125 HRESULT getUpdateVersion(com::Utf8Str &aUpdateVersion);
126 HRESULT getUpdateURL(com::Utf8Str &aUpdateURL);
127 HRESULT getUpdateCheckNeeded(BOOL *aUpdateCheckNeeded);
128
129 // wrapped IHost methods
130 HRESULT getProcessorSpeed(ULONG aCpuId,
131 ULONG *aSpeed);
132 HRESULT getProcessorFeature(ProcessorFeature_T aFeature,
133 BOOL *aSupported);
134 HRESULT getProcessorDescription(ULONG aCpuId,
135 com::Utf8Str &aDescription);
136 HRESULT getProcessorCPUIDLeaf(ULONG aCpuId,
137 ULONG aLeaf,
138 ULONG aSubLeaf,
139 ULONG *aValEax,
140 ULONG *aValEbx,
141 ULONG *aValEcx,
142 ULONG *aValEdx);
143 HRESULT createHostOnlyNetworkInterface(ComPtr<IHostNetworkInterface> &aHostInterface,
144 ComPtr<IProgress> &aProgress);
145 HRESULT removeHostOnlyNetworkInterface(const com::Guid &aId,
146 ComPtr<IProgress> &aProgress);
147 HRESULT createUSBDeviceFilter(const com::Utf8Str &aName,
148 ComPtr<IHostUSBDeviceFilter> &aFilter);
149 HRESULT insertUSBDeviceFilter(ULONG aPosition,
150 const ComPtr<IHostUSBDeviceFilter> &aFilter);
151 HRESULT removeUSBDeviceFilter(ULONG aPosition);
152 HRESULT findHostDVDDrive(const com::Utf8Str &aName,
153 ComPtr<IMedium> &aDrive);
154 HRESULT findHostFloppyDrive(const com::Utf8Str &aName,
155 ComPtr<IMedium> &aDrive);
156 HRESULT findHostNetworkInterfaceByName(const com::Utf8Str &aName,
157 ComPtr<IHostNetworkInterface> &aNetworkInterface);
158 HRESULT findHostNetworkInterfaceById(const com::Guid &aId,
159 ComPtr<IHostNetworkInterface> &aNetworkInterface);
160 HRESULT findHostNetworkInterfacesOfType(HostNetworkInterfaceType_T aType,
161 std::vector<ComPtr<IHostNetworkInterface> > &aNetworkInterfaces);
162 HRESULT findUSBDeviceById(const com::Guid &aId,
163 ComPtr<IHostUSBDevice> &aDevice);
164 HRESULT findUSBDeviceByAddress(const com::Utf8Str &aName,
165 ComPtr<IHostUSBDevice> &aDevice);
166 HRESULT generateMACAddress(com::Utf8Str &aAddress);
167
168 HRESULT addUSBDeviceSource(const com::Utf8Str &aBackend, const com::Utf8Str &aId, const com::Utf8Str &aAddress,
169 const std::vector<com::Utf8Str> &aPropertyNames, const std::vector<com::Utf8Str> &aPropertyValues);
170
171 HRESULT removeUSBDeviceSource(const com::Utf8Str &aId);
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