VirtualBox

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

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

Main: Added Host::GetProcessorCpuIdLeaf.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.5 KB
Line 
1/* $Id: HostImpl.h 24403 2009-11-05 17:12:55Z vboxsync $ */
2/** @file
3 * Implemenation of IHost.
4 */
5
6/*
7 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22#ifndef ____H_HOSTIMPL
23#define ____H_HOSTIMPL
24
25#include "VirtualBoxBase.h"
26
27class HostUSBDeviceFilter;
28class USBProxyService;
29class VirtualBox;
30class SessionMachine;
31class Progress;
32class PerformanceCollector;
33class Medium;
34
35namespace settings
36{
37 struct Host;
38}
39
40#include <list>
41
42class ATL_NO_VTABLE Host :
43 public VirtualBoxBase,
44 public VirtualBoxSupportErrorInfoImpl<Host, IHost>,
45 public VirtualBoxSupportTranslation<Host>,
46 VBOX_SCRIPTABLE_IMPL(IHost)
47{
48public:
49
50 DECLARE_NOT_AGGREGATABLE(Host)
51
52 DECLARE_PROTECT_FINAL_CONSTRUCT()
53
54 BEGIN_COM_MAP(Host)
55 COM_INTERFACE_ENTRY(ISupportErrorInfo)
56 COM_INTERFACE_ENTRY(IHost)
57 COM_INTERFACE_ENTRY(IDispatch)
58 END_COM_MAP()
59
60 HRESULT FinalConstruct();
61 void FinalRelease();
62
63 // public initializer/uninitializer for internal purposes only
64 HRESULT init(VirtualBox *aParent);
65 void uninit();
66
67 // IHost properties
68 STDMETHOD(COMGETTER(DVDDrives))(ComSafeArrayOut (IMedium *, drives));
69 STDMETHOD(COMGETTER(FloppyDrives))(ComSafeArrayOut (IMedium *, drives));
70 STDMETHOD(COMGETTER(USBDevices))(ComSafeArrayOut (IHostUSBDevice *, aUSBDevices));
71 STDMETHOD(COMGETTER(USBDeviceFilters))(ComSafeArrayOut (IHostUSBDeviceFilter *, aUSBDeviceFilters));
72 STDMETHOD(COMGETTER(NetworkInterfaces))(ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces));
73 STDMETHOD(COMGETTER(ProcessorCount))(ULONG *count);
74 STDMETHOD(COMGETTER(ProcessorOnlineCount))(ULONG *count);
75 STDMETHOD(GetProcessorSpeed)(ULONG cpuId, ULONG *speed);
76 STDMETHOD(GetProcessorDescription)(ULONG cpuId, BSTR *description);
77 STDMETHOD(GetProcessorFeature) (ProcessorFeature_T feature, BOOL *supported);
78 STDMETHOD(GetProcessorCpuIdLeaf)(ULONG aCpuId, ULONG aLeaf, ULONG aSubLeaf, ULONG *aValEAX, ULONG *aValEBX, ULONG *aValECX, ULONG *aValEDX);
79 STDMETHOD(COMGETTER(MemorySize))(ULONG *size);
80 STDMETHOD(COMGETTER(MemoryAvailable))(ULONG *available);
81 STDMETHOD(COMGETTER(OperatingSystem))(BSTR *os);
82 STDMETHOD(COMGETTER(OSVersion))(BSTR *version);
83 STDMETHOD(COMGETTER(UTCTime))(LONG64 *aUTCTime);
84 STDMETHOD(COMGETTER(Acceleration3DAvailable))(BOOL *aSupported);
85
86 // IHost methods
87 STDMETHOD(CreateHostOnlyNetworkInterface) (IHostNetworkInterface **aHostNetworkInterface,
88 IProgress **aProgress);
89 STDMETHOD(RemoveHostOnlyNetworkInterface) (IN_BSTR aId, IProgress **aProgress);
90 STDMETHOD(CreateUSBDeviceFilter) (IN_BSTR aName, IHostUSBDeviceFilter **aFilter);
91 STDMETHOD(InsertUSBDeviceFilter) (ULONG aPosition, IHostUSBDeviceFilter *aFilter);
92 STDMETHOD(RemoveUSBDeviceFilter) (ULONG aPosition);
93
94 STDMETHOD(FindHostDVDDrive) (IN_BSTR aName, IMedium **aDrive);
95 STDMETHOD(FindHostFloppyDrive) (IN_BSTR aName, IMedium **aDrive);
96 STDMETHOD(FindHostNetworkInterfaceByName) (IN_BSTR aName, IHostNetworkInterface **networkInterface);
97 STDMETHOD(FindHostNetworkInterfaceById) (IN_BSTR id, IHostNetworkInterface **networkInterface);
98 STDMETHOD(FindHostNetworkInterfacesOfType) (HostNetworkInterfaceType_T type, ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces));
99 STDMETHOD(FindUSBDeviceByAddress) (IN_BSTR aAddress, IHostUSBDevice **aDevice);
100 STDMETHOD(FindUSBDeviceById) (IN_BSTR aId, IHostUSBDevice **aDevice);
101
102 // public methods only for internal purposes
103 HRESULT loadSettings(const settings::Host &data);
104 HRESULT saveSettings(settings::Host &data);
105
106#ifdef VBOX_WITH_USB
107 typedef std::list< ComObjPtr<HostUSBDeviceFilter> > USBDeviceFilterList;
108
109 /** Must be called from under this object's lock. */
110 USBProxyService* usbProxyService();
111
112 HRESULT addChild(HostUSBDeviceFilter *pChild);
113 HRESULT removeChild(HostUSBDeviceFilter *pChild);
114 VirtualBox* parent();
115
116 HRESULT onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter, BOOL aActiveChanged = FALSE);
117 void getUSBFilters(USBDeviceFilterList *aGlobalFiltes);
118 HRESULT checkUSBProxyService();
119#endif /* !VBOX_WITH_USB */
120
121 // for VirtualBoxSupportErrorInfoImpl
122 static const wchar_t *getComponentName() { return L"Host"; }
123
124private:
125
126#if defined(RT_OS_SOLARIS) && defined(VBOX_USE_LIBHAL)
127 bool getDVDInfoFromHal(std::list< ComObjPtr<Medium> > &list);
128 bool getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list);
129#endif
130
131#if defined(RT_OS_SOLARIS)
132 void parseMountTable(char *mountTable, std::list< ComObjPtr<Medium> > &list);
133 bool validateDevice(const char *deviceNode, bool isCDROM);
134#endif
135
136#ifdef VBOX_WITH_RESOURCE_USAGE_API
137 void registerMetrics (PerformanceCollector *aCollector);
138 void unregisterMetrics (PerformanceCollector *aCollector);
139#endif /* VBOX_WITH_RESOURCE_USAGE_API */
140
141 struct Data; // opaque data structure, defined in HostImpl.cpp
142 Data *m;
143};
144
145#endif // ____H_HOSTIMPL
146
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use