VirtualBox

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

Last change on this file since 17375 was 17280, checked in by vboxsync, 16 years ago

Fix burns.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.3 KB
Line 
1/* $Id: HostImpl.h 17280 2009-03-03 14:19:22Z 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_WINDOWS
37# include "win/svchlp.h"
38#endif
39
40#ifdef RT_OS_LINUX
41# include <HostHardwareLinux.h>
42#endif
43
44#ifdef VBOX_WITH_RESOURCE_USAGE_API
45# include "PerformanceImpl.h"
46#endif /* VBOX_WITH_RESOURCE_USAGE_API */
47
48class VirtualBox;
49class SessionMachine;
50class HostDVDDrive;
51class HostFloppyDrive;
52class Progress;
53
54#include <list>
55
56class ATL_NO_VTABLE Host :
57 public VirtualBoxBaseWithChildren,
58 public VirtualBoxSupportErrorInfoImpl <Host, IHost>,
59 public VirtualBoxSupportTranslation <Host>,
60 public IHost
61{
62public:
63
64 DECLARE_NOT_AGGREGATABLE(Host)
65
66 DECLARE_PROTECT_FINAL_CONSTRUCT()
67
68 BEGIN_COM_MAP(Host)
69 COM_INTERFACE_ENTRY(ISupportErrorInfo)
70 COM_INTERFACE_ENTRY(IHost)
71 END_COM_MAP()
72
73 NS_DECL_ISUPPORTS
74
75 HRESULT FinalConstruct();
76 void FinalRelease();
77
78 // public initializer/uninitializer for internal purposes only
79 HRESULT init (VirtualBox *aParent);
80 void uninit();
81
82 // IHost properties
83 STDMETHOD(COMGETTER(DVDDrives))(ComSafeArrayOut (IHostDVDDrive*, drives));
84 STDMETHOD(COMGETTER(FloppyDrives))(ComSafeArrayOut (IHostFloppyDrive*, drives));
85 STDMETHOD(COMGETTER(USBDevices))(IHostUSBDeviceCollection **aUSBDevices);
86 STDMETHOD(COMGETTER(USBDeviceFilters))(IHostUSBDeviceFilterCollection ** aUSBDeviceFilters);
87 STDMETHOD(COMGETTER(NetworkInterfaces))(ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces));
88 STDMETHOD(COMGETTER(ProcessorCount))(ULONG *count);
89 STDMETHOD(COMGETTER(ProcessorOnlineCount))(ULONG *count);
90 STDMETHOD(GetProcessorSpeed)(ULONG cpuId, ULONG *speed);
91 STDMETHOD(GetProcessorDescription)(ULONG cpuId, BSTR *description);
92 STDMETHOD(GetProcessorFeature) (ProcessorFeature_T feature, BOOL *supported);
93 STDMETHOD(COMGETTER(MemorySize))(ULONG *size);
94 STDMETHOD(COMGETTER(MemoryAvailable))(ULONG *available);
95 STDMETHOD(COMGETTER(OperatingSystem))(BSTR *os);
96 STDMETHOD(COMGETTER(OSVersion))(BSTR *version);
97 STDMETHOD(COMGETTER(UTCTime))(LONG64 *aUTCTime);
98
99 // IHost methods
100#ifdef RT_OS_WINDOWS
101
102 STDMETHOD(CreateHostOnlyNetworkInterface) (IN_BSTR aName,
103 IHostNetworkInterface **aHostNetworkInterface,
104 IProgress **aProgress);
105 STDMETHOD(RemoveHostOnlyNetworkInterface) (IN_GUID aId,
106 IHostNetworkInterface **aHostNetworkInterface,
107 IProgress **aProgress);
108#endif
109 STDMETHOD(CreateUSBDeviceFilter) (IN_BSTR aName, IHostUSBDeviceFilter **aFilter);
110 STDMETHOD(InsertUSBDeviceFilter) (ULONG aPosition, IHostUSBDeviceFilter *aFilter);
111 STDMETHOD(RemoveUSBDeviceFilter) (ULONG aPosition, IHostUSBDeviceFilter **aFilter);
112
113 STDMETHOD(FindHostDVDDrive) (IN_BSTR aName, IHostDVDDrive **aDrive);
114 STDMETHOD(FindHostFloppyDrive) (IN_BSTR aName, IHostFloppyDrive **aDrive);
115 STDMETHOD(FindHostNetworkInterfaceByName) (IN_BSTR aName, IHostNetworkInterface **networkInterface);
116 STDMETHOD(FindHostNetworkInterfaceById) (IN_GUID id, IHostNetworkInterface **networkInterface);
117 STDMETHOD(FindHostNetworkInterfacesOfType) (HostNetworkInterfaceType_T type, ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces));
118
119 // public methods only for internal purposes
120
121 HRESULT loadSettings (const settings::Key &aGlobal);
122 HRESULT saveSettings (settings::Key &aGlobal);
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() { return mUSBProxyService; }
129
130 HRESULT onUSBDeviceFilterChange (HostUSBDeviceFilter *aFilter, BOOL aActiveChanged = FALSE);
131 void getUSBFilters(USBDeviceFilterList *aGlobalFiltes, VirtualBox::SessionMachineVector *aMachines);
132 HRESULT checkUSBProxyService();
133#endif /* !VBOX_WITH_USB */
134
135#ifdef RT_OS_WINDOWS
136 static int networkInterfaceHelperServer (SVCHlpClient *aClient,
137 SVCHlpMsg::Code aMsgCode);
138#endif
139
140 // for VirtualBoxSupportErrorInfoImpl
141 static const wchar_t *getComponentName() { return L"Host"; }
142
143private:
144
145#if defined(RT_OS_SOLARIS)
146# if defined(VBOX_USE_LIBHAL)
147 bool getDVDInfoFromHal(std::list <ComObjPtr <HostDVDDrive> > &list);
148 bool getFloppyInfoFromHal(std::list <ComObjPtr <HostFloppyDrive> > &list);
149# endif
150 void parseMountTable(char *mountTable, std::list <ComObjPtr <HostDVDDrive> > &list);
151 bool validateDevice(const char *deviceNode, bool isCDROM);
152#endif
153
154#ifdef VBOX_WITH_USB
155 /** specialization for IHostUSBDeviceFilter */
156 ComObjPtr <HostUSBDeviceFilter> getDependentChild (IHostUSBDeviceFilter *aFilter)
157 {
158 VirtualBoxBase *child = VirtualBoxBaseWithChildren::
159 getDependentChild (ComPtr <IUnknown> (aFilter));
160 return child ? dynamic_cast <HostUSBDeviceFilter *> (child)
161 : NULL;
162 }
163#endif /* VBOX_WITH_USB */
164
165#ifdef RT_OS_WINDOWS
166 static int createNetworkInterface (SVCHlpClient *aClient,
167 const Utf8Str &aName,
168 Guid &aGUID, Utf8Str &aErrMsg);
169 static int removeNetworkInterface (SVCHlpClient *aClient,
170 const Guid &aGUID,
171 Utf8Str &aErrMsg);
172 static HRESULT networkInterfaceHelperClient (SVCHlpClient *aClient,
173 Progress *aProgress,
174 void *aUser, int *aVrc);
175#endif
176
177#ifdef VBOX_WITH_RESOURCE_USAGE_API
178 void registerMetrics (PerformanceCollector *aCollector);
179 void unregisterMetrics (PerformanceCollector *aCollector);
180#endif /* VBOX_WITH_RESOURCE_USAGE_API */
181
182 ComObjPtr <VirtualBox, ComWeakRef> mParent;
183
184#ifdef VBOX_WITH_USB
185 USBDeviceFilterList mUSBDeviceFilters;
186
187 /** Pointer to the USBProxyService object. */
188 USBProxyService *mUSBProxyService;
189#endif /* VBOX_WITH_USB */
190
191#ifdef RT_OS_LINUX
192 /** Object with information about host drives */
193 VBoxMainDriveInfo mHostDrives;
194#endif
195 /* Features that can be queried with GetProcessorFeature */
196 BOOL fVTxAMDVSupported, fLongModeSupported, fPAESupported;
197
198 HostPowerService *mHostPowerService;
199};
200
201#endif // ____H_HOSTIMPL
202/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette