VirtualBox

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

Last change on this file since 49240 was 48765, checked in by vboxsync, 11 years ago

Main/Qt/VBoxManage: introduced IHost::ProcessorOnlineCoreCount and use it to determine the maximum allowed number of CPU virtual cores the user may assign to a guest

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.6 KB
Line 
1/* $Id: HostImpl.h 48765 2013-09-30 08:51:08Z vboxsync $ */
2/** @file
3 * Implementation of IHost.
4 */
5
6/*
7 * Copyright (C) 2006-2012 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
21#include "VirtualBoxBase.h"
22
23class HostUSBDeviceFilter;
24class USBProxyService;
25class SessionMachine;
26class Progress;
27class PerformanceCollector;
28
29namespace settings
30{
31 struct Host;
32}
33
34#include <list>
35
36class ATL_NO_VTABLE Host :
37 public VirtualBoxBase,
38 VBOX_SCRIPTABLE_IMPL(IHost)
39{
40public:
41 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Host, IHost)
42
43 DECLARE_NOT_AGGREGATABLE(Host)
44
45 DECLARE_PROTECT_FINAL_CONSTRUCT()
46
47 BEGIN_COM_MAP(Host)
48 VBOX_DEFAULT_INTERFACE_ENTRIES(IHost)
49 END_COM_MAP()
50
51 HRESULT FinalConstruct();
52 void FinalRelease();
53
54 // public initializer/uninitializer for internal purposes only
55 HRESULT init(VirtualBox *aParent);
56 void uninit();
57
58 // IHost properties
59 STDMETHOD(COMGETTER(DVDDrives))(ComSafeArrayOut(IMedium *, drives));
60 STDMETHOD(COMGETTER(FloppyDrives))(ComSafeArrayOut(IMedium *, drives));
61 STDMETHOD(COMGETTER(USBDevices))(ComSafeArrayOut(IHostUSBDevice *, aUSBDevices));
62 STDMETHOD(COMGETTER(USBDeviceFilters))(ComSafeArrayOut(IHostUSBDeviceFilter *, aUSBDeviceFilters));
63 STDMETHOD(COMGETTER(NetworkInterfaces))(ComSafeArrayOut(IHostNetworkInterface *, aNetworkInterfaces));
64 STDMETHOD(COMGETTER(NameServers))(ComSafeArrayOut(BSTR, aNameServers));
65 STDMETHOD(COMGETTER(DomainName))(BSTR *aDomainName);
66 STDMETHOD(COMGETTER(SearchStrings))(ComSafeArrayOut(BSTR, aSearchStrings));
67 STDMETHOD(COMGETTER(ProcessorCount))(ULONG *count);
68 STDMETHOD(COMGETTER(ProcessorOnlineCount))(ULONG *count);
69 STDMETHOD(COMGETTER(ProcessorCoreCount))(ULONG *count);
70 STDMETHOD(COMGETTER(ProcessorOnlineCoreCount))(ULONG *count);
71 STDMETHOD(GetProcessorSpeed)(ULONG cpuId, ULONG *speed);
72 STDMETHOD(GetProcessorDescription)(ULONG cpuId, BSTR *description);
73 STDMETHOD(GetProcessorFeature)(ProcessorFeature_T feature, BOOL *supported);
74 STDMETHOD(GetProcessorCPUIDLeaf)(ULONG aCpuId, ULONG aLeaf, ULONG aSubLeaf, ULONG *aValEAX, ULONG *aValEBX, ULONG *aValECX, ULONG *aValEDX);
75 STDMETHOD(COMGETTER(MemorySize))(ULONG *size);
76 STDMETHOD(COMGETTER(MemoryAvailable))(ULONG *available);
77 STDMETHOD(COMGETTER(OperatingSystem))(BSTR *os);
78 STDMETHOD(COMGETTER(OSVersion))(BSTR *version);
79 STDMETHOD(COMGETTER(UTCTime))(LONG64 *aUTCTime);
80 STDMETHOD(COMGETTER(Acceleration3DAvailable))(BOOL *aSupported);
81 STDMETHOD(COMGETTER(VideoInputDevices))(ComSafeArrayOut(IHostVideoInputDevice*, aVideoInputDevices));
82
83 // IHost methods
84 STDMETHOD(CreateHostOnlyNetworkInterface)(IHostNetworkInterface **aHostNetworkInterface,
85 IProgress **aProgress);
86 STDMETHOD(RemoveHostOnlyNetworkInterface)(IN_BSTR aId, IProgress **aProgress);
87 STDMETHOD(CreateUSBDeviceFilter)(IN_BSTR aName, IHostUSBDeviceFilter **aFilter);
88 STDMETHOD(InsertUSBDeviceFilter)(ULONG aPosition, IHostUSBDeviceFilter *aFilter);
89 STDMETHOD(RemoveUSBDeviceFilter)(ULONG aPosition);
90
91 STDMETHOD(FindHostDVDDrive)(IN_BSTR aName, IMedium **aDrive);
92 STDMETHOD(FindHostFloppyDrive)(IN_BSTR aName, IMedium **aDrive);
93 STDMETHOD(FindHostNetworkInterfaceByName)(IN_BSTR aName, IHostNetworkInterface **networkInterface);
94 STDMETHOD(FindHostNetworkInterfaceById)(IN_BSTR id, IHostNetworkInterface **networkInterface);
95 STDMETHOD(FindHostNetworkInterfacesOfType)(HostNetworkInterfaceType_T type, ComSafeArrayOut(IHostNetworkInterface *, aNetworkInterfaces));
96 STDMETHOD(FindUSBDeviceByAddress)(IN_BSTR aAddress, IHostUSBDevice **aDevice);
97 STDMETHOD(FindUSBDeviceById)(IN_BSTR aId, IHostUSBDevice **aDevice);
98 STDMETHOD(GenerateMACAddress)(BSTR *aAddress);
99
100 // public methods only for internal purposes
101
102 /**
103 * Override of the default locking class to be used for validating lock
104 * order with the standard member lock handle.
105 */
106 virtual VBoxLockingClass getLockingClass() const
107 {
108 return LOCKCLASS_HOSTOBJECT;
109 }
110
111 HRESULT loadSettings(const settings::Host &data);
112 HRESULT saveSettings(settings::Host &data);
113
114 HRESULT getDrives(DeviceType_T mediumType, bool fRefresh, MediaList *&pll);
115 HRESULT findHostDriveById(DeviceType_T mediumType, const Guid &uuid, bool fRefresh, ComObjPtr<Medium> &pMedium);
116 HRESULT findHostDriveByName(DeviceType_T mediumType, const Utf8Str &strLocationFull, bool fRefresh, ComObjPtr<Medium> &pMedium);
117
118#ifdef VBOX_WITH_USB
119 typedef std::list< ComObjPtr<HostUSBDeviceFilter> > USBDeviceFilterList;
120
121 /** Must be called from under this object's lock. */
122 USBProxyService* usbProxyService();
123
124 HRESULT addChild(HostUSBDeviceFilter *pChild);
125 HRESULT removeChild(HostUSBDeviceFilter *pChild);
126 VirtualBox* parent();
127
128 HRESULT onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter, BOOL aActiveChanged = FALSE);
129 void getUSBFilters(USBDeviceFilterList *aGlobalFiltes);
130 HRESULT checkUSBProxyService();
131#endif /* !VBOX_WITH_USB */
132
133 static void generateMACAddress(Utf8Str &mac);
134
135private:
136
137 HRESULT buildDVDDrivesList(MediaList &list);
138 HRESULT buildFloppyDrivesList(MediaList &list);
139 HRESULT findHostDriveByNameOrId(DeviceType_T mediumType, const Utf8Str &strNameOrId, ComObjPtr<Medium> &pMedium);
140
141#if defined(RT_OS_SOLARIS) && defined(VBOX_USE_LIBHAL)
142 bool getDVDInfoFromHal(std::list< ComObjPtr<Medium> > &list);
143 bool getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list);
144#endif
145
146#if defined(RT_OS_SOLARIS)
147 void getDVDInfoFromDevTree(std::list< ComObjPtr<Medium> > &list);
148 void parseMountTable(char *mountTable, std::list< ComObjPtr<Medium> > &list);
149 bool validateDevice(const char *deviceNode, bool isCDROM);
150#endif
151
152 HRESULT updateNetIfList();
153
154#ifndef RT_OS_WINDOWS
155 HRESULT parseResolvConf();
156#else
157 HRESULT fetchNameResolvingInformation();
158#endif
159
160#ifdef VBOX_WITH_RESOURCE_USAGE_API
161 void registerMetrics(PerformanceCollector *aCollector);
162 void registerDiskMetrics(PerformanceCollector *aCollector);
163 void unregisterMetrics(PerformanceCollector *aCollector);
164#endif /* VBOX_WITH_RESOURCE_USAGE_API */
165
166 struct Data; // opaque data structure, defined in HostImpl.cpp
167 Data *m;
168};
169
170#endif // ____H_HOSTIMPL
171
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