VirtualBox

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

Last change on this file since 76553 was 76553, checked in by vboxsync, 6 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.6 KB
Line 
1/* $Id: HostImpl.h 76553 2019-01-01 01:45:53Z vboxsync $ */
2/** @file
3 * Implementation of IHost.
4 */
5
6/*
7 * Copyright (C) 2006-2019 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 ____H_HOSTIMPL
19#define ____H_HOSTIMPL
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;
31
32namespace settings
33{
34 struct Host;
35}
36
37#include <list>
38
39class ATL_NO_VTABLE Host :
40 public HostWrap
41{
42public:
43
44 DECLARE_EMPTY_CTOR_DTOR(Host)
45
46 HRESULT FinalConstruct();
47 void FinalRelease();
48
49 // public initializer/uninitializer for internal purposes only
50 HRESULT init(VirtualBox *aParent);
51 void uninit();
52
53 // public methods only for internal purposes
54
55 /**
56 * Override of the default locking class to be used for validating lock
57 * order with the standard member lock handle.
58 */
59 virtual VBoxLockingClass getLockingClass() const
60 {
61 return LOCKCLASS_HOSTOBJECT;
62 }
63
64 HRESULT i_loadSettings(const settings::Host &data);
65 HRESULT i_saveSettings(settings::Host &data);
66
67 HRESULT i_getDrives(DeviceType_T mediumType, bool fRefresh, MediaList *&pll, AutoWriteLock &treeLock);
68 HRESULT i_findHostDriveById(DeviceType_T mediumType, const Guid &uuid, bool fRefresh, ComObjPtr<Medium> &pMedium);
69 HRESULT i_findHostDriveByName(DeviceType_T mediumType, const Utf8Str &strLocationFull, bool fRefresh, ComObjPtr<Medium> &pMedium);
70
71#ifdef VBOX_WITH_USB
72 typedef std::list< ComObjPtr<HostUSBDeviceFilter> > USBDeviceFilterList;
73
74 /** Must be called from under this object's lock. */
75 USBProxyService* i_usbProxyService();
76
77 HRESULT i_addChild(HostUSBDeviceFilter *pChild);
78 HRESULT i_removeChild(HostUSBDeviceFilter *pChild);
79 VirtualBox* i_parent();
80
81 HRESULT i_onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter, BOOL aActiveChanged = FALSE);
82 void i_getUSBFilters(USBDeviceFilterList *aGlobalFiltes);
83 HRESULT i_checkUSBProxyService();
84#endif /* !VBOX_WITH_USB */
85
86 static void i_generateMACAddress(Utf8Str &mac);
87
88private:
89
90 // wrapped IHost properties
91 HRESULT getDVDDrives(std::vector<ComPtr<IMedium> > &aDVDDrives);
92 HRESULT getFloppyDrives(std::vector<ComPtr<IMedium> > &aFloppyDrives);
93 HRESULT getUSBDevices(std::vector<ComPtr<IHostUSBDevice> > &aUSBDevices);
94 HRESULT getUSBDeviceFilters(std::vector<ComPtr<IHostUSBDeviceFilter> > &aUSBDeviceFilters);
95 HRESULT getNetworkInterfaces(std::vector<ComPtr<IHostNetworkInterface> > &aNetworkInterfaces);
96 HRESULT getNameServers(std::vector<com::Utf8Str> &aNameServers);
97 HRESULT getDomainName(com::Utf8Str &aDomainName);
98 HRESULT getSearchStrings(std::vector<com::Utf8Str> &aSearchStrings);
99 HRESULT getProcessorCount(ULONG *aProcessorCount);
100 HRESULT getProcessorOnlineCount(ULONG *aProcessorOnlineCount);
101 HRESULT getProcessorCoreCount(ULONG *aProcessorCoreCount);
102 HRESULT getProcessorOnlineCoreCount(ULONG *aProcessorOnlineCoreCount);
103 HRESULT getMemorySize(ULONG *aMemorySize);
104 HRESULT getMemoryAvailable(ULONG *aMemoryAvailable);
105 HRESULT getOperatingSystem(com::Utf8Str &aOperatingSystem);
106 HRESULT getOSVersion(com::Utf8Str &aOSVersion);
107 HRESULT getUTCTime(LONG64 *aUTCTime);
108 HRESULT getAcceleration3DAvailable(BOOL *aAcceleration3DAvailable);
109 HRESULT getVideoInputDevices(std::vector<ComPtr<IHostVideoInputDevice> > &aVideoInputDevices);
110
111 // wrapped IHost methods
112 HRESULT getProcessorSpeed(ULONG aCpuId,
113 ULONG *aSpeed);
114 HRESULT getProcessorFeature(ProcessorFeature_T aFeature,
115 BOOL *aSupported);
116 HRESULT getProcessorDescription(ULONG aCpuId,
117 com::Utf8Str &aDescription);
118 HRESULT getProcessorCPUIDLeaf(ULONG aCpuId,
119 ULONG aLeaf,
120 ULONG aSubLeaf,
121 ULONG *aValEax,
122 ULONG *aValEbx,
123 ULONG *aValEcx,
124 ULONG *aValEdx);
125 HRESULT createHostOnlyNetworkInterface(ComPtr<IHostNetworkInterface> &aHostInterface,
126 ComPtr<IProgress> &aProgress);
127 HRESULT removeHostOnlyNetworkInterface(const com::Guid &aId,
128 ComPtr<IProgress> &aProgress);
129 HRESULT createUSBDeviceFilter(const com::Utf8Str &aName,
130 ComPtr<IHostUSBDeviceFilter> &aFilter);
131 HRESULT insertUSBDeviceFilter(ULONG aPosition,
132 const ComPtr<IHostUSBDeviceFilter> &aFilter);
133 HRESULT removeUSBDeviceFilter(ULONG aPosition);
134 HRESULT findHostDVDDrive(const com::Utf8Str &aName,
135 ComPtr<IMedium> &aDrive);
136 HRESULT findHostFloppyDrive(const com::Utf8Str &aName,
137 ComPtr<IMedium> &aDrive);
138 HRESULT findHostNetworkInterfaceByName(const com::Utf8Str &aName,
139 ComPtr<IHostNetworkInterface> &aNetworkInterface);
140 HRESULT findHostNetworkInterfaceById(const com::Guid &aId,
141 ComPtr<IHostNetworkInterface> &aNetworkInterface);
142 HRESULT findHostNetworkInterfacesOfType(HostNetworkInterfaceType_T aType,
143 std::vector<ComPtr<IHostNetworkInterface> > &aNetworkInterfaces);
144 HRESULT findUSBDeviceById(const com::Guid &aId,
145 ComPtr<IHostUSBDevice> &aDevice);
146 HRESULT findUSBDeviceByAddress(const com::Utf8Str &aName,
147 ComPtr<IHostUSBDevice> &aDevice);
148 HRESULT generateMACAddress(com::Utf8Str &aAddress);
149
150 HRESULT addUSBDeviceSource(const com::Utf8Str &aBackend, const com::Utf8Str &aId, const com::Utf8Str &aAddress,
151 const std::vector<com::Utf8Str> &aPropertyNames, const std::vector<com::Utf8Str> &aPropertyValues);
152
153 HRESULT removeUSBDeviceSource(const com::Utf8Str &aId);
154
155 // Internal Methods.
156
157 HRESULT i_buildDVDDrivesList(MediaList &list);
158 HRESULT i_buildFloppyDrivesList(MediaList &list);
159 HRESULT i_findHostDriveByNameOrId(DeviceType_T mediumType, const Utf8Str &strNameOrId, ComObjPtr<Medium> &pMedium);
160
161#if defined(RT_OS_SOLARIS) && defined(VBOX_USE_LIBHAL)
162 bool i_getDVDInfoFromHal(std::list< ComObjPtr<Medium> > &list);
163 bool i_getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list);
164#endif
165
166#if defined(RT_OS_SOLARIS)
167 void i_getDVDInfoFromDevTree(std::list< ComObjPtr<Medium> > &list);
168 void i_parseMountTable(char *mountTable, std::list< ComObjPtr<Medium> > &list);
169 bool i_validateDevice(const char *deviceNode, bool isCDROM);
170#endif
171
172 HRESULT i_updateNetIfList();
173
174#ifndef RT_OS_WINDOWS
175 HRESULT i_parseResolvConf();
176#else
177 HRESULT i_fetchNameResolvingInformation();
178#endif
179
180#ifdef VBOX_WITH_RESOURCE_USAGE_API
181 void i_registerMetrics(PerformanceCollector *aCollector);
182 void i_registerDiskMetrics(PerformanceCollector *aCollector);
183 void i_unregisterMetrics(PerformanceCollector *aCollector);
184#endif /* VBOX_WITH_RESOURCE_USAGE_API */
185
186 struct Data; // opaque data structure, defined in HostImpl.cpp
187 Data *m;
188};
189
190#endif // !____H_HOSTIMPL
191
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