VirtualBox

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

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

NetAdp/win: enabled add/remove tap if UI, make the proper adapters to be displayed in the list

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.1 KB
Line 
1/* $Id: HostImpl.h 16927 2009-02-18 18:27:52Z vboxsync $ */
2/** @file
3 * Implemenation of IHost.
4 */
5
6/*
7 * Copyright (C) 2006-2007 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))(IHostDVDDriveCollection **drives);
84 STDMETHOD(COMGETTER(FloppyDrives))(IHostFloppyDriveCollection **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 STDMETHOD(COMGETTER(TapInterfaces))(ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces));
102
103 STDMETHOD(CreateHostNetworkInterface) (IN_BSTR aName,
104 IHostNetworkInterface **aHostNetworkInterface,
105 IProgress **aProgress);
106 STDMETHOD(RemoveHostNetworkInterface) (IN_GUID aId,
107 IHostNetworkInterface **aHostNetworkInterface,
108 IProgress **aProgress);
109#endif
110 STDMETHOD(CreateUSBDeviceFilter) (IN_BSTR aName, IHostUSBDeviceFilter **aFilter);
111 STDMETHOD(InsertUSBDeviceFilter) (ULONG aPosition, IHostUSBDeviceFilter *aFilter);
112 STDMETHOD(RemoveUSBDeviceFilter) (ULONG aPosition, IHostUSBDeviceFilter **aFilter);
113
114 STDMETHOD(FindHostNetworkInterfaceByName) (IN_BSTR aName, IHostNetworkInterface **networkInterface);
115 STDMETHOD(FindHostNetworkInterfaceById) (IN_GUID id, IHostNetworkInterface **networkInterface);
116
117 // public methods only for internal purposes
118
119 HRESULT loadSettings (const settings::Key &aGlobal);
120 HRESULT saveSettings (settings::Key &aGlobal);
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#ifdef RT_OS_WINDOWS
134 static int networkInterfaceHelperServer (SVCHlpClient *aClient,
135 SVCHlpMsg::Code aMsgCode);
136#endif
137
138 // for VirtualBoxSupportErrorInfoImpl
139 static const wchar_t *getComponentName() { return L"Host"; }
140
141private:
142
143#if defined(RT_OS_SOLARIS)
144# if defined(VBOX_USE_LIBHAL)
145 bool getDVDInfoFromHal(std::list <ComObjPtr <HostDVDDrive> > &list);
146 bool getFloppyInfoFromHal(std::list <ComObjPtr <HostFloppyDrive> > &list);
147# endif
148 void parseMountTable(char *mountTable, std::list <ComObjPtr <HostDVDDrive> > &list);
149 bool validateDevice(const char *deviceNode, bool isCDROM);
150#endif
151
152#ifdef VBOX_WITH_USB
153 /** specialization for IHostUSBDeviceFilter */
154 ComObjPtr <HostUSBDeviceFilter> getDependentChild (IHostUSBDeviceFilter *aFilter)
155 {
156 VirtualBoxBase *child = VirtualBoxBaseWithChildren::
157 getDependentChild (ComPtr <IUnknown> (aFilter));
158 return child ? dynamic_cast <HostUSBDeviceFilter *> (child)
159 : NULL;
160 }
161#endif /* VBOX_WITH_USB */
162
163#ifdef RT_OS_WINDOWS
164 static int createNetworkInterface (SVCHlpClient *aClient,
165 const Utf8Str &aName,
166 Guid &aGUID, Utf8Str &aErrMsg);
167 static int removeNetworkInterface (SVCHlpClient *aClient,
168 const Guid &aGUID,
169 Utf8Str &aErrMsg);
170 static HRESULT networkInterfaceHelperClient (SVCHlpClient *aClient,
171 Progress *aProgress,
172 void *aUser, int *aVrc);
173#endif
174
175#ifdef VBOX_WITH_RESOURCE_USAGE_API
176 void registerMetrics (PerformanceCollector *aCollector);
177 void unregisterMetrics (PerformanceCollector *aCollector);
178#endif /* VBOX_WITH_RESOURCE_USAGE_API */
179
180 ComObjPtr <VirtualBox, ComWeakRef> mParent;
181
182#ifdef VBOX_WITH_USB
183 USBDeviceFilterList mUSBDeviceFilters;
184
185 /** Pointer to the USBProxyService object. */
186 USBProxyService *mUSBProxyService;
187#endif /* VBOX_WITH_USB */
188
189#ifdef RT_OS_LINUX
190 /** Object with information about host drives */
191 VBoxMainDriveInfo mHostDrives;
192#endif
193 /* Features that can be queried with GetProcessorFeature */
194 BOOL fVTxAMDVSupported, fLongModeSupported, fPAESupported;
195
196 HostPowerService *mHostPowerService;
197};
198
199#endif // ____H_HOSTIMPL
200/* 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