VirtualBox

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

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

NetAdp/Win: (bugref:9409) Store host-only adapter configuration in extra data. Create missing adapters when listing/creating/removing adapters.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.8 KB
Line 
1/* $Id: HostImpl.h 77804 2019-03-20 08:05:37Z 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 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;
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
88#ifdef RT_OS_WINDOWS
89 HRESULT i_updatePersistentConfigForHostOnlyAdapters(void);
90 HRESULT i_removePersistentConfig(const Bstr &bstrGuid);
91#endif /* RT_OS_WINDOWS */
92
93
94private:
95
96 // wrapped IHost properties
97 HRESULT getDVDDrives(std::vector<ComPtr<IMedium> > &aDVDDrives);
98 HRESULT getFloppyDrives(std::vector<ComPtr<IMedium> > &aFloppyDrives);
99 HRESULT getUSBDevices(std::vector<ComPtr<IHostUSBDevice> > &aUSBDevices);
100 HRESULT getUSBDeviceFilters(std::vector<ComPtr<IHostUSBDeviceFilter> > &aUSBDeviceFilters);
101 HRESULT getNetworkInterfaces(std::vector<ComPtr<IHostNetworkInterface> > &aNetworkInterfaces);
102 HRESULT getNameServers(std::vector<com::Utf8Str> &aNameServers);
103 HRESULT getDomainName(com::Utf8Str &aDomainName);
104 HRESULT getSearchStrings(std::vector<com::Utf8Str> &aSearchStrings);
105 HRESULT getProcessorCount(ULONG *aProcessorCount);
106 HRESULT getProcessorOnlineCount(ULONG *aProcessorOnlineCount);
107 HRESULT getProcessorCoreCount(ULONG *aProcessorCoreCount);
108 HRESULT getProcessorOnlineCoreCount(ULONG *aProcessorOnlineCoreCount);
109 HRESULT getMemorySize(ULONG *aMemorySize);
110 HRESULT getMemoryAvailable(ULONG *aMemoryAvailable);
111 HRESULT getOperatingSystem(com::Utf8Str &aOperatingSystem);
112 HRESULT getOSVersion(com::Utf8Str &aOSVersion);
113 HRESULT getUTCTime(LONG64 *aUTCTime);
114 HRESULT getAcceleration3DAvailable(BOOL *aAcceleration3DAvailable);
115 HRESULT getVideoInputDevices(std::vector<ComPtr<IHostVideoInputDevice> > &aVideoInputDevices);
116
117 // wrapped IHost methods
118 HRESULT getProcessorSpeed(ULONG aCpuId,
119 ULONG *aSpeed);
120 HRESULT getProcessorFeature(ProcessorFeature_T aFeature,
121 BOOL *aSupported);
122 HRESULT getProcessorDescription(ULONG aCpuId,
123 com::Utf8Str &aDescription);
124 HRESULT getProcessorCPUIDLeaf(ULONG aCpuId,
125 ULONG aLeaf,
126 ULONG aSubLeaf,
127 ULONG *aValEax,
128 ULONG *aValEbx,
129 ULONG *aValEcx,
130 ULONG *aValEdx);
131 HRESULT createHostOnlyNetworkInterface(ComPtr<IHostNetworkInterface> &aHostInterface,
132 ComPtr<IProgress> &aProgress);
133 HRESULT removeHostOnlyNetworkInterface(const com::Guid &aId,
134 ComPtr<IProgress> &aProgress);
135 HRESULT createUSBDeviceFilter(const com::Utf8Str &aName,
136 ComPtr<IHostUSBDeviceFilter> &aFilter);
137 HRESULT insertUSBDeviceFilter(ULONG aPosition,
138 const ComPtr<IHostUSBDeviceFilter> &aFilter);
139 HRESULT removeUSBDeviceFilter(ULONG aPosition);
140 HRESULT findHostDVDDrive(const com::Utf8Str &aName,
141 ComPtr<IMedium> &aDrive);
142 HRESULT findHostFloppyDrive(const com::Utf8Str &aName,
143 ComPtr<IMedium> &aDrive);
144 HRESULT findHostNetworkInterfaceByName(const com::Utf8Str &aName,
145 ComPtr<IHostNetworkInterface> &aNetworkInterface);
146 HRESULT findHostNetworkInterfaceById(const com::Guid &aId,
147 ComPtr<IHostNetworkInterface> &aNetworkInterface);
148 HRESULT findHostNetworkInterfacesOfType(HostNetworkInterfaceType_T aType,
149 std::vector<ComPtr<IHostNetworkInterface> > &aNetworkInterfaces);
150 HRESULT findUSBDeviceById(const com::Guid &aId,
151 ComPtr<IHostUSBDevice> &aDevice);
152 HRESULT findUSBDeviceByAddress(const com::Utf8Str &aName,
153 ComPtr<IHostUSBDevice> &aDevice);
154 HRESULT generateMACAddress(com::Utf8Str &aAddress);
155
156 HRESULT addUSBDeviceSource(const com::Utf8Str &aBackend, const com::Utf8Str &aId, const com::Utf8Str &aAddress,
157 const std::vector<com::Utf8Str> &aPropertyNames, const std::vector<com::Utf8Str> &aPropertyValues);
158
159 HRESULT removeUSBDeviceSource(const com::Utf8Str &aId);
160
161 // Internal Methods.
162
163 HRESULT i_buildDVDDrivesList(MediaList &list);
164 HRESULT i_buildFloppyDrivesList(MediaList &list);
165 HRESULT i_findHostDriveByNameOrId(DeviceType_T mediumType, const Utf8Str &strNameOrId, ComObjPtr<Medium> &pMedium);
166
167#if defined(RT_OS_SOLARIS) && defined(VBOX_USE_LIBHAL)
168 bool i_getDVDInfoFromHal(std::list< ComObjPtr<Medium> > &list);
169 bool i_getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list);
170#endif
171
172#if defined(RT_OS_SOLARIS)
173 void i_getDVDInfoFromDevTree(std::list< ComObjPtr<Medium> > &list);
174 void i_parseMountTable(char *mountTable, std::list< ComObjPtr<Medium> > &list);
175 bool i_validateDevice(const char *deviceNode, bool isCDROM);
176#endif
177
178 HRESULT i_updateNetIfList();
179
180#ifndef RT_OS_WINDOWS
181 HRESULT i_parseResolvConf();
182#else
183 HRESULT i_fetchNameResolvingInformation();
184#endif
185
186#ifdef VBOX_WITH_RESOURCE_USAGE_API
187 void i_registerMetrics(PerformanceCollector *aCollector);
188 void i_registerDiskMetrics(PerformanceCollector *aCollector);
189 void i_unregisterMetrics(PerformanceCollector *aCollector);
190#endif /* VBOX_WITH_RESOURCE_USAGE_API */
191
192 struct Data; // opaque data structure, defined in HostImpl.cpp
193 Data *m;
194};
195
196#endif /* !MAIN_INCLUDED_HostImpl_h */
197
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