1 | /* $Id: USBDeviceFiltersImpl.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox USBDeviceFilters COM Class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2013-2024 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef MAIN_INCLUDED_USBDeviceFiltersImpl_h
|
---|
29 | #define MAIN_INCLUDED_USBDeviceFiltersImpl_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include "USBDeviceFiltersWrap.h"
|
---|
35 |
|
---|
36 | class HostUSBDevice;
|
---|
37 | class USBDeviceFilter;
|
---|
38 |
|
---|
39 | namespace settings
|
---|
40 | {
|
---|
41 | struct USB;
|
---|
42 | }
|
---|
43 |
|
---|
44 | class ATL_NO_VTABLE USBDeviceFilters :
|
---|
45 | public USBDeviceFiltersWrap
|
---|
46 | {
|
---|
47 | public:
|
---|
48 |
|
---|
49 | DECLARE_COMMON_CLASS_METHODS(USBDeviceFilters)
|
---|
50 |
|
---|
51 | HRESULT FinalConstruct();
|
---|
52 | void FinalRelease();
|
---|
53 |
|
---|
54 | // public initializer/uninitializer for internal purposes only
|
---|
55 | HRESULT init(Machine *aParent);
|
---|
56 | HRESULT init(Machine *aParent, USBDeviceFilters *aThat);
|
---|
57 | HRESULT initCopy(Machine *aParent, USBDeviceFilters *aThat);
|
---|
58 | void uninit();
|
---|
59 |
|
---|
60 | // public methods only for internal purposes
|
---|
61 | HRESULT i_loadSettings(const settings::USB &data);
|
---|
62 | HRESULT i_saveSettings(settings::USB &data);
|
---|
63 |
|
---|
64 | void i_rollback();
|
---|
65 | void i_commit();
|
---|
66 | void i_copyFrom(USBDeviceFilters *aThat);
|
---|
67 |
|
---|
68 | #ifdef VBOX_WITH_USB
|
---|
69 | HRESULT i_onDeviceFilterChange(USBDeviceFilter *aFilter,
|
---|
70 | BOOL aActiveChanged = FALSE);
|
---|
71 | bool i_hasMatchingFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
|
---|
72 | bool i_hasMatchingFilter(IUSBDevice *aUSBDevice, ULONG *aMaskedIfs);
|
---|
73 | HRESULT i_notifyProxy(bool aInsertFilters);
|
---|
74 | #endif /* VBOX_WITH_USB */
|
---|
75 |
|
---|
76 | // public methods for internal purposes only
|
---|
77 | // (ensure there is a caller and a read lock before calling them!)
|
---|
78 | Machine* i_getMachine();
|
---|
79 |
|
---|
80 | private:
|
---|
81 |
|
---|
82 | // Wrapped IUSBDeviceFilters attributes
|
---|
83 | HRESULT getDeviceFilters(std::vector<ComPtr<IUSBDeviceFilter> > &aDeviceFilters);
|
---|
84 |
|
---|
85 | // wrapped IUSBDeviceFilters methods
|
---|
86 | HRESULT createDeviceFilter(const com::Utf8Str &aName,
|
---|
87 | ComPtr<IUSBDeviceFilter> &aFilter);
|
---|
88 | HRESULT insertDeviceFilter(ULONG aPosition,
|
---|
89 | const ComPtr<IUSBDeviceFilter> &aFilter);
|
---|
90 | HRESULT removeDeviceFilter(ULONG aPosition,
|
---|
91 | ComPtr<IUSBDeviceFilter> &aFilter);
|
---|
92 | struct Data;
|
---|
93 | Data *m;
|
---|
94 | };
|
---|
95 |
|
---|
96 | #endif /* !MAIN_INCLUDED_USBDeviceFiltersImpl_h */
|
---|
97 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|