1 | /* $Id: USBDeviceFiltersImpl.h 82968 2020-02-04 10:35:17Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox USBDeviceFilters COM Class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2013-2020 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 MAIN_INCLUDED_USBDeviceFiltersImpl_h
|
---|
19 | #define MAIN_INCLUDED_USBDeviceFiltersImpl_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include "USBDeviceFiltersWrap.h"
|
---|
25 |
|
---|
26 | class HostUSBDevice;
|
---|
27 | class USBDeviceFilter;
|
---|
28 |
|
---|
29 | namespace settings
|
---|
30 | {
|
---|
31 | struct USB;
|
---|
32 | }
|
---|
33 |
|
---|
34 | class ATL_NO_VTABLE USBDeviceFilters :
|
---|
35 | public USBDeviceFiltersWrap
|
---|
36 | {
|
---|
37 | public:
|
---|
38 |
|
---|
39 | DECLARE_EMPTY_CTOR_DTOR(USBDeviceFilters)
|
---|
40 |
|
---|
41 | HRESULT FinalConstruct();
|
---|
42 | void FinalRelease();
|
---|
43 |
|
---|
44 | // public initializer/uninitializer for internal purposes only
|
---|
45 | HRESULT init(Machine *aParent);
|
---|
46 | HRESULT init(Machine *aParent, USBDeviceFilters *aThat);
|
---|
47 | HRESULT initCopy(Machine *aParent, USBDeviceFilters *aThat);
|
---|
48 | void uninit();
|
---|
49 |
|
---|
50 | // public methods only for internal purposes
|
---|
51 | HRESULT i_loadSettings(const settings::USB &data);
|
---|
52 | HRESULT i_saveSettings(settings::USB &data);
|
---|
53 |
|
---|
54 | void i_rollback();
|
---|
55 | void i_commit();
|
---|
56 | void i_copyFrom(USBDeviceFilters *aThat);
|
---|
57 |
|
---|
58 | #ifdef VBOX_WITH_USB
|
---|
59 | HRESULT i_onDeviceFilterChange(USBDeviceFilter *aFilter,
|
---|
60 | BOOL aActiveChanged = FALSE);
|
---|
61 | bool i_hasMatchingFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
|
---|
62 | bool i_hasMatchingFilter(IUSBDevice *aUSBDevice, ULONG *aMaskedIfs);
|
---|
63 | HRESULT i_notifyProxy(bool aInsertFilters);
|
---|
64 | #endif /* VBOX_WITH_USB */
|
---|
65 |
|
---|
66 | // public methods for internal purposes only
|
---|
67 | // (ensure there is a caller and a read lock before calling them!)
|
---|
68 | Machine* i_getMachine();
|
---|
69 |
|
---|
70 | private:
|
---|
71 |
|
---|
72 | // Wrapped IUSBDeviceFilters attributes
|
---|
73 | HRESULT getDeviceFilters(std::vector<ComPtr<IUSBDeviceFilter> > &aDeviceFilters);
|
---|
74 |
|
---|
75 | // wrapped IUSBDeviceFilters methods
|
---|
76 | HRESULT createDeviceFilter(const com::Utf8Str &aName,
|
---|
77 | ComPtr<IUSBDeviceFilter> &aFilter);
|
---|
78 | HRESULT insertDeviceFilter(ULONG aPosition,
|
---|
79 | const ComPtr<IUSBDeviceFilter> &aFilter);
|
---|
80 | HRESULT removeDeviceFilter(ULONG aPosition,
|
---|
81 | ComPtr<IUSBDeviceFilter> &aFilter);
|
---|
82 | struct Data;
|
---|
83 | Data *m;
|
---|
84 | };
|
---|
85 |
|
---|
86 | #endif /* !MAIN_INCLUDED_USBDeviceFiltersImpl_h */
|
---|
87 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|