VirtualBox

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

Last change on this file since 29615 was 29615, checked in by vboxsync, 15 years ago

Main: implemented IHost::GetProcessorCoreCount()

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.9 KB
Line 
1/* $Id: HostImpl.h 29615 2010-05-18 11:54:24Z vboxsync $ */
2/** @file
3 * Implemenation of IHost.
4 */
5
6/*
7 * Copyright (C) 2006-2009 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 public VirtualBoxSupportErrorInfoImpl<Host, IHost>,
39 public VirtualBoxSupportTranslation<Host>,
40 VBOX_SCRIPTABLE_IMPL(IHost)
41{
42public:
43
44 DECLARE_NOT_AGGREGATABLE(Host)
45
46 DECLARE_PROTECT_FINAL_CONSTRUCT()
47
48 BEGIN_COM_MAP(Host)
49 COM_INTERFACE_ENTRY(ISupportErrorInfo)
50 COM_INTERFACE_ENTRY(IHost)
51 COM_INTERFACE_ENTRY(IDispatch)
52 END_COM_MAP()
53
54 HRESULT FinalConstruct();
55 void FinalRelease();
56
57 // public initializer/uninitializer for internal purposes only
58 HRESULT init(VirtualBox *aParent);
59 void uninit();
60
61 // IHost properties
62 STDMETHOD(COMGETTER(DVDDrives))(ComSafeArrayOut (IMedium *, drives));
63 STDMETHOD(COMGETTER(FloppyDrives))(ComSafeArrayOut (IMedium *, drives));
64 STDMETHOD(COMGETTER(USBDevices))(ComSafeArrayOut (IHostUSBDevice *, aUSBDevices));
65 STDMETHOD(COMGETTER(USBDeviceFilters))(ComSafeArrayOut (IHostUSBDeviceFilter *, aUSBDeviceFilters));
66 STDMETHOD(COMGETTER(NetworkInterfaces))(ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces));
67 STDMETHOD(COMGETTER(ProcessorCount))(ULONG *count);
68 STDMETHOD(COMGETTER(ProcessorOnlineCount))(ULONG *count);
69 STDMETHOD(COMGETTER(ProcessorCoreCount))(ULONG *count);
70 STDMETHOD(GetProcessorSpeed)(ULONG cpuId, ULONG *speed);
71 STDMETHOD(GetProcessorDescription)(ULONG cpuId, BSTR *description);
72 STDMETHOD(GetProcessorFeature) (ProcessorFeature_T feature, BOOL *supported);
73 STDMETHOD(GetProcessorCPUIDLeaf)(ULONG aCpuId, ULONG aLeaf, ULONG aSubLeaf, ULONG *aValEAX, ULONG *aValEBX, ULONG *aValECX, ULONG *aValEDX);
74 STDMETHOD(COMGETTER(MemorySize))(ULONG *size);
75 STDMETHOD(COMGETTER(MemoryAvailable))(ULONG *available);
76 STDMETHOD(COMGETTER(OperatingSystem))(BSTR *os);
77 STDMETHOD(COMGETTER(OSVersion))(BSTR *version);
78 STDMETHOD(COMGETTER(UTCTime))(LONG64 *aUTCTime);
79 STDMETHOD(COMGETTER(Acceleration3DAvailable))(BOOL *aSupported);
80
81 // IHost methods
82 STDMETHOD(CreateHostOnlyNetworkInterface) (IHostNetworkInterface **aHostNetworkInterface,
83 IProgress **aProgress);
84 STDMETHOD(RemoveHostOnlyNetworkInterface) (IN_BSTR aId, IProgress **aProgress);
85 STDMETHOD(CreateUSBDeviceFilter) (IN_BSTR aName, IHostUSBDeviceFilter **aFilter);
86 STDMETHOD(InsertUSBDeviceFilter) (ULONG aPosition, IHostUSBDeviceFilter *aFilter);
87 STDMETHOD(RemoveUSBDeviceFilter) (ULONG aPosition);
88
89 STDMETHOD(FindHostDVDDrive) (IN_BSTR aName, IMedium **aDrive);
90 STDMETHOD(FindHostFloppyDrive) (IN_BSTR aName, IMedium **aDrive);
91 STDMETHOD(FindHostNetworkInterfaceByName) (IN_BSTR aName, IHostNetworkInterface **networkInterface);
92 STDMETHOD(FindHostNetworkInterfaceById) (IN_BSTR id, IHostNetworkInterface **networkInterface);
93 STDMETHOD(FindHostNetworkInterfacesOfType) (HostNetworkInterfaceType_T type, ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces));
94 STDMETHOD(FindUSBDeviceByAddress) (IN_BSTR aAddress, IHostUSBDevice **aDevice);
95 STDMETHOD(FindUSBDeviceById) (IN_BSTR aId, IHostUSBDevice **aDevice);
96
97 // public methods only for internal purposes
98
99 /**
100 * Simple run-time type identification without having to enable C++ RTTI.
101 * The class IDs are defined in VirtualBoxBase.h.
102 * @return
103 */
104 virtual VBoxClsID getClassID() const
105 {
106 return clsidHost;
107 }
108
109 /**
110 * Override of the default locking class to be used for validating lock
111 * order with the standard member lock handle.
112 */
113 virtual VBoxLockingClass getLockingClass() const
114 {
115 return LOCKCLASS_HOSTOBJECT;
116 }
117
118 HRESULT loadSettings(const settings::Host &data);
119 HRESULT saveSettings(settings::Host &data);
120
121 HRESULT getDVDDrives(MediaList &ll);
122 HRESULT getFloppyDrives(MediaList &ll);
123
124#ifdef VBOX_WITH_USB
125 typedef std::list< ComObjPtr<HostUSBDeviceFilter> > USBDeviceFilterList;
126
127 /** Must be called from under this object's lock. */
128 USBProxyService* usbProxyService();
129
130 HRESULT addChild(HostUSBDeviceFilter *pChild);
131 HRESULT removeChild(HostUSBDeviceFilter *pChild);
132 VirtualBox* parent();
133
134 HRESULT onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter, BOOL aActiveChanged = FALSE);
135 void getUSBFilters(USBDeviceFilterList *aGlobalFiltes);
136 HRESULT checkUSBProxyService();
137#endif /* !VBOX_WITH_USB */
138
139 // for VirtualBoxSupportErrorInfoImpl
140 static const wchar_t *getComponentName() { return L"Host"; }
141
142private:
143
144#if defined(RT_OS_SOLARIS) && defined(VBOX_USE_LIBHAL)
145 bool getDVDInfoFromHal(std::list< ComObjPtr<Medium> > &list);
146 bool getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list);
147#endif
148
149#if defined(RT_OS_SOLARIS)
150 void parseMountTable(char *mountTable, std::list< ComObjPtr<Medium> > &list);
151 bool validateDevice(const char *deviceNode, bool isCDROM);
152#endif
153
154#ifdef VBOX_WITH_RESOURCE_USAGE_API
155 void registerMetrics (PerformanceCollector *aCollector);
156 void unregisterMetrics (PerformanceCollector *aCollector);
157#endif /* VBOX_WITH_RESOURCE_USAGE_API */
158
159 struct Data; // opaque data structure, defined in HostImpl.cpp
160 Data *m;
161};
162
163#endif // ____H_HOSTIMPL
164
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