VirtualBox

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

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

HostImpl: Removed the return parameter from RemoveHostOnlyNetworkInterface()
and RemoveUSBDeviceFilter() methods so as to be consistent with Main API.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.7 KB
Line 
1/* $Id: HostImpl.h 22211 2009-08-12 16:05:19Z 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#ifdef VBOX_WITH_USB
27# include "HostUSBDeviceImpl.h"
28# include "USBDeviceFilterImpl.h"
29# include "USBProxyService.h"
30# include "VirtualBoxImpl.h"
31#else
32class USBProxyService;
33#endif
34#include "HostPower.h"
35
36#ifdef RT_OS_LINUX
37# include <HostHardwareLinux.h>
38#endif
39
40#ifdef VBOX_WITH_RESOURCE_USAGE_API
41# include "PerformanceImpl.h"
42#endif /* VBOX_WITH_RESOURCE_USAGE_API */
43
44class VirtualBox;
45class SessionMachine;
46class HostDVDDrive;
47class HostFloppyDrive;
48class Progress;
49
50namespace settings
51{
52 struct Host;
53}
54
55#include <list>
56
57class ATL_NO_VTABLE Host :
58 public VirtualBoxBaseWithChildren,
59 public VirtualBoxSupportErrorInfoImpl<Host, IHost>,
60 public VirtualBoxSupportTranslation<Host>,
61 VBOX_SCRIPTABLE_IMPL(IHost)
62{
63public:
64
65 DECLARE_NOT_AGGREGATABLE(Host)
66
67 DECLARE_PROTECT_FINAL_CONSTRUCT()
68
69 BEGIN_COM_MAP(Host)
70 COM_INTERFACE_ENTRY(ISupportErrorInfo)
71 COM_INTERFACE_ENTRY(IHost)
72 COM_INTERFACE_ENTRY(IDispatch)
73 END_COM_MAP()
74
75 NS_DECL_ISUPPORTS
76
77 HRESULT FinalConstruct();
78 void FinalRelease();
79
80 // public initializer/uninitializer for internal purposes only
81 HRESULT init(VirtualBox *aParent);
82 void uninit();
83
84 // IHost properties
85 STDMETHOD(COMGETTER(DVDDrives))(ComSafeArrayOut (IHostDVDDrive*, drives));
86 STDMETHOD(COMGETTER(FloppyDrives))(ComSafeArrayOut (IHostFloppyDrive*, drives));
87 STDMETHOD(COMGETTER(USBDevices))(ComSafeArrayOut (IHostUSBDevice *, aUSBDevices));
88 STDMETHOD(COMGETTER(USBDeviceFilters))(ComSafeArrayOut (IHostUSBDeviceFilter *, aUSBDeviceFilters));
89 STDMETHOD(COMGETTER(NetworkInterfaces))(ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces));
90 STDMETHOD(COMGETTER(ProcessorCount))(ULONG *count);
91 STDMETHOD(COMGETTER(ProcessorOnlineCount))(ULONG *count);
92 STDMETHOD(GetProcessorSpeed)(ULONG cpuId, ULONG *speed);
93 STDMETHOD(GetProcessorDescription)(ULONG cpuId, BSTR *description);
94 STDMETHOD(GetProcessorFeature) (ProcessorFeature_T feature, BOOL *supported);
95 STDMETHOD(COMGETTER(MemorySize))(ULONG *size);
96 STDMETHOD(COMGETTER(MemoryAvailable))(ULONG *available);
97 STDMETHOD(COMGETTER(OperatingSystem))(BSTR *os);
98 STDMETHOD(COMGETTER(OSVersion))(BSTR *version);
99 STDMETHOD(COMGETTER(UTCTime))(LONG64 *aUTCTime);
100 STDMETHOD(COMGETTER(Acceleration3DAvailable))(BOOL *aSupported);
101
102 // IHost methods
103 STDMETHOD(CreateHostOnlyNetworkInterface) (IHostNetworkInterface **aHostNetworkInterface,
104 IProgress **aProgress);
105 STDMETHOD(RemoveHostOnlyNetworkInterface) (IN_BSTR aId, IProgress **aProgress);
106 STDMETHOD(CreateUSBDeviceFilter) (IN_BSTR aName, IHostUSBDeviceFilter **aFilter);
107 STDMETHOD(InsertUSBDeviceFilter) (ULONG aPosition, IHostUSBDeviceFilter *aFilter);
108 STDMETHOD(RemoveUSBDeviceFilter) (ULONG aPosition);
109
110 STDMETHOD(FindHostDVDDrive) (IN_BSTR aName, IHostDVDDrive **aDrive);
111 STDMETHOD(FindHostFloppyDrive) (IN_BSTR aName, IHostFloppyDrive **aDrive);
112 STDMETHOD(FindHostNetworkInterfaceByName) (IN_BSTR aName, IHostNetworkInterface **networkInterface);
113 STDMETHOD(FindHostNetworkInterfaceById) (IN_BSTR id, IHostNetworkInterface **networkInterface);
114 STDMETHOD(FindHostNetworkInterfacesOfType) (HostNetworkInterfaceType_T type, ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces));
115 STDMETHOD(FindUSBDeviceByAddress) (IN_BSTR aAddress, IHostUSBDevice **aDevice);
116 STDMETHOD(FindUSBDeviceById) (IN_BSTR aId, IHostUSBDevice **aDevice);
117
118 // public methods only for internal purposes
119 HRESULT loadSettings(const settings::Host &data);
120 HRESULT saveSettings(settings::Host &data);
121
122#ifdef VBOX_WITH_USB
123 typedef std::list <ComObjPtr<HostUSBDeviceFilter> > USBDeviceFilterList;
124
125 /** Must be called from under this object's lock. */
126 USBProxyService *usbProxyService() { return mUSBProxyService; }
127
128 HRESULT onUSBDeviceFilterChange (HostUSBDeviceFilter *aFilter, BOOL aActiveChanged = FALSE);
129 void getUSBFilters(USBDeviceFilterList *aGlobalFiltes, VirtualBox::SessionMachineVector *aMachines);
130 HRESULT checkUSBProxyService();
131#endif /* !VBOX_WITH_USB */
132
133 // for VirtualBoxSupportErrorInfoImpl
134 static const wchar_t *getComponentName() { return L"Host"; }
135
136private:
137
138#if (defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)) && defined(VBOX_USE_LIBHAL)
139 bool getDVDInfoFromHal(std::list <ComObjPtr<HostDVDDrive> > &list);
140 bool getFloppyInfoFromHal(std::list <ComObjPtr<HostFloppyDrive> > &list);
141#endif
142
143#if defined(RT_OS_SOLARIS)
144 void parseMountTable(char *mountTable, std::list <ComObjPtr<HostDVDDrive> > &list);
145 bool validateDevice(const char *deviceNode, bool isCDROM);
146#endif
147
148#ifdef VBOX_WITH_USB
149 /** specialization for IHostUSBDeviceFilter */
150 ComObjPtr<HostUSBDeviceFilter> getDependentChild (IHostUSBDeviceFilter *aFilter)
151 {
152 VirtualBoxBase *child = VirtualBoxBaseWithChildren::
153 getDependentChild (ComPtr<IUnknown> (aFilter));
154 return child ? dynamic_cast <HostUSBDeviceFilter *> (child)
155 : NULL;
156 }
157#endif /* VBOX_WITH_USB */
158
159#ifdef VBOX_WITH_RESOURCE_USAGE_API
160 void registerMetrics (PerformanceCollector *aCollector);
161 void unregisterMetrics (PerformanceCollector *aCollector);
162#endif /* VBOX_WITH_RESOURCE_USAGE_API */
163
164 ComObjPtr<VirtualBox, ComWeakRef> mParent;
165
166#ifdef VBOX_WITH_USB
167 USBDeviceFilterList mUSBDeviceFilters;
168
169 /** Pointer to the USBProxyService object. */
170 USBProxyService *mUSBProxyService;
171#endif /* VBOX_WITH_USB */
172
173#ifdef RT_OS_LINUX
174 /** Object with information about host drives */
175 VBoxMainDriveInfo mHostDrives;
176#endif
177 /* Features that can be queried with GetProcessorFeature */
178 BOOL fVTxAMDVSupported, fLongModeSupported, fPAESupported;
179 /* 3D hardware acceleration supported? */
180 BOOL f3DAccelerationSupported;
181
182 HostPowerService *mHostPowerService;
183};
184
185#endif // ____H_HOSTIMPL
186/* vi: set tabstop=4 shiftwidth=4 expandtab: */
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