VirtualBox

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

Last change on this file since 35429 was 35429, checked in by vboxsync, 14 years ago

Main: fix bug that dvd/floppy host drives would not be restored from machine settings but always result in empty drives

  • 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 35429 2011-01-07 14:42:24Z vboxsync $ */
2/** @file
3 * Implementation 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 VBOX_SCRIPTABLE_IMPL(IHost)
39{
40public:
41 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Host, IHost)
42
43 DECLARE_NOT_AGGREGATABLE(Host)
44
45 DECLARE_PROTECT_FINAL_CONSTRUCT()
46
47 BEGIN_COM_MAP(Host)
48 COM_INTERFACE_ENTRY(ISupportErrorInfo)
49 COM_INTERFACE_ENTRY(IHost)
50 COM_INTERFACE_ENTRY(IDispatch)
51 END_COM_MAP()
52
53 HRESULT FinalConstruct();
54 void FinalRelease();
55
56 // public initializer/uninitializer for internal purposes only
57 HRESULT init(VirtualBox *aParent);
58 void uninit();
59
60 // IHost properties
61 STDMETHOD(COMGETTER(DVDDrives))(ComSafeArrayOut (IMedium *, drives));
62 STDMETHOD(COMGETTER(FloppyDrives))(ComSafeArrayOut (IMedium *, drives));
63 STDMETHOD(COMGETTER(USBDevices))(ComSafeArrayOut (IHostUSBDevice *, aUSBDevices));
64 STDMETHOD(COMGETTER(USBDeviceFilters))(ComSafeArrayOut (IHostUSBDeviceFilter *, aUSBDeviceFilters));
65 STDMETHOD(COMGETTER(NetworkInterfaces))(ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces));
66 STDMETHOD(COMGETTER(ProcessorCount))(ULONG *count);
67 STDMETHOD(COMGETTER(ProcessorOnlineCount))(ULONG *count);
68 STDMETHOD(COMGETTER(ProcessorCoreCount))(ULONG *count);
69 STDMETHOD(GetProcessorSpeed)(ULONG cpuId, ULONG *speed);
70 STDMETHOD(GetProcessorDescription)(ULONG cpuId, BSTR *description);
71 STDMETHOD(GetProcessorFeature) (ProcessorFeature_T feature, BOOL *supported);
72 STDMETHOD(GetProcessorCPUIDLeaf)(ULONG aCpuId, ULONG aLeaf, ULONG aSubLeaf, ULONG *aValEAX, ULONG *aValEBX, ULONG *aValECX, ULONG *aValEDX);
73 STDMETHOD(COMGETTER(MemorySize))(ULONG *size);
74 STDMETHOD(COMGETTER(MemoryAvailable))(ULONG *available);
75 STDMETHOD(COMGETTER(OperatingSystem))(BSTR *os);
76 STDMETHOD(COMGETTER(OSVersion))(BSTR *version);
77 STDMETHOD(COMGETTER(UTCTime))(LONG64 *aUTCTime);
78 STDMETHOD(COMGETTER(Acceleration3DAvailable))(BOOL *aSupported);
79
80 // IHost methods
81 STDMETHOD(CreateHostOnlyNetworkInterface) (IHostNetworkInterface **aHostNetworkInterface,
82 IProgress **aProgress);
83 STDMETHOD(RemoveHostOnlyNetworkInterface) (IN_BSTR aId, IProgress **aProgress);
84 STDMETHOD(CreateUSBDeviceFilter) (IN_BSTR aName, IHostUSBDeviceFilter **aFilter);
85 STDMETHOD(InsertUSBDeviceFilter) (ULONG aPosition, IHostUSBDeviceFilter *aFilter);
86 STDMETHOD(RemoveUSBDeviceFilter) (ULONG aPosition);
87
88 STDMETHOD(FindHostDVDDrive) (IN_BSTR aName, IMedium **aDrive);
89 STDMETHOD(FindHostFloppyDrive) (IN_BSTR aName, IMedium **aDrive);
90 STDMETHOD(FindHostNetworkInterfaceByName) (IN_BSTR aName, IHostNetworkInterface **networkInterface);
91 STDMETHOD(FindHostNetworkInterfaceById) (IN_BSTR id, IHostNetworkInterface **networkInterface);
92 STDMETHOD(FindHostNetworkInterfacesOfType) (HostNetworkInterfaceType_T type, ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces));
93 STDMETHOD(FindUSBDeviceByAddress) (IN_BSTR aAddress, IHostUSBDevice **aDevice);
94 STDMETHOD(FindUSBDeviceById) (IN_BSTR aId, IHostUSBDevice **aDevice);
95
96 // public methods only for internal purposes
97
98 /**
99 * Override of the default locking class to be used for validating lock
100 * order with the standard member lock handle.
101 */
102 virtual VBoxLockingClass getLockingClass() const
103 {
104 return LOCKCLASS_HOSTOBJECT;
105 }
106
107 HRESULT loadSettings(const settings::Host &data);
108 HRESULT saveSettings(settings::Host &data);
109
110 HRESULT getDrives(DeviceType_T mediumType, bool fRefresh, MediaList *&pll);
111 HRESULT findHostDriveById(DeviceType_T mediumType, const Guid &uuid, bool fRefresh, ComObjPtr<Medium> &pMedium);
112 HRESULT findHostDriveByName(DeviceType_T mediumType, const Utf8Str &strLocationFull, bool fRefresh, ComObjPtr<Medium> &pMedium);
113
114#ifdef VBOX_WITH_USB
115 typedef std::list< ComObjPtr<HostUSBDeviceFilter> > USBDeviceFilterList;
116
117 /** Must be called from under this object's lock. */
118 USBProxyService* usbProxyService();
119
120 HRESULT addChild(HostUSBDeviceFilter *pChild);
121 HRESULT removeChild(HostUSBDeviceFilter *pChild);
122 VirtualBox* parent();
123
124 HRESULT onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter, BOOL aActiveChanged = FALSE);
125 void getUSBFilters(USBDeviceFilterList *aGlobalFiltes);
126 HRESULT checkUSBProxyService();
127#endif /* !VBOX_WITH_USB */
128
129private:
130
131 HRESULT buildDVDDrivesList(MediaList &list);
132 HRESULT buildFloppyDrivesList(MediaList &list);
133
134#if defined(RT_OS_SOLARIS) && defined(VBOX_USE_LIBHAL)
135 bool getDVDInfoFromHal(std::list< ComObjPtr<Medium> > &list);
136 bool getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list);
137#endif
138
139#if defined(RT_OS_SOLARIS)
140 void getDVDInfoFromDevTree(std::list< ComObjPtr<Medium> > &list);
141 void parseMountTable(char *mountTable, std::list< ComObjPtr<Medium> > &list);
142 bool validateDevice(const char *deviceNode, bool isCDROM);
143#endif
144
145#ifdef VBOX_WITH_RESOURCE_USAGE_API
146 void registerMetrics (PerformanceCollector *aCollector);
147 void unregisterMetrics (PerformanceCollector *aCollector);
148#endif /* VBOX_WITH_RESOURCE_USAGE_API */
149
150 struct Data; // opaque data structure, defined in HostImpl.cpp
151 Data *m;
152};
153
154#endif // ____H_HOSTIMPL
155
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