VirtualBox

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

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

Main: finish integration of Main lock validation with IPRT; only enabled with VBOX_WITH_STRICT_LOCKS=1 (do NOT enable unless you want Main to stop working now)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.0 KB
Line 
1/* $Id: HostImpl.h 25834 2010-01-14 16:21:05Z 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
104 /**
105 * Simple run-time type identification without having to enable C++ RTTI.
106 * The class IDs are defined in VirtualBoxBase.h.
107 * @return
108 */
109 virtual VBoxClsID getClassID() const
110 {
111 return clsidHost;
112 }
113
114 /**
115 * Override of the default locking class to be used for validating lock
116 * order with the standard member lock handle.
117 */
118 virtual VBoxLockingClass getLockingClass() const
119 {
120 return LOCKCLASS_HOSTOBJECT;
121 }
122
123 HRESULT loadSettings(const settings::Host &data);
124 HRESULT saveSettings(settings::Host &data);
125
126#ifdef VBOX_WITH_USB
127 typedef std::list< ComObjPtr<HostUSBDeviceFilter> > USBDeviceFilterList;
128
129 /** Must be called from under this object's lock. */
130 USBProxyService* usbProxyService();
131
132 HRESULT addChild(HostUSBDeviceFilter *pChild);
133 HRESULT removeChild(HostUSBDeviceFilter *pChild);
134 VirtualBox* parent();
135
136 HRESULT onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter, BOOL aActiveChanged = FALSE);
137 void getUSBFilters(USBDeviceFilterList *aGlobalFiltes);
138 HRESULT checkUSBProxyService();
139#endif /* !VBOX_WITH_USB */
140
141 // for VirtualBoxSupportErrorInfoImpl
142 static const wchar_t *getComponentName() { return L"Host"; }
143
144private:
145
146#if defined(RT_OS_SOLARIS) && defined(VBOX_USE_LIBHAL)
147 bool getDVDInfoFromHal(std::list< ComObjPtr<Medium> > &list);
148 bool getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list);
149#endif
150
151#if defined(RT_OS_SOLARIS)
152 void parseMountTable(char *mountTable, std::list< ComObjPtr<Medium> > &list);
153 bool validateDevice(const char *deviceNode, bool isCDROM);
154#endif
155
156#ifdef VBOX_WITH_RESOURCE_USAGE_API
157 void registerMetrics (PerformanceCollector *aCollector);
158 void unregisterMetrics (PerformanceCollector *aCollector);
159#endif /* VBOX_WITH_RESOURCE_USAGE_API */
160
161 struct Data; // opaque data structure, defined in HostImpl.cpp
162 Data *m;
163};
164
165#endif // ____H_HOSTIMPL
166
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