1 | /* $Id: NATEngineImpl.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | *
|
---|
5 | * VirtualBox COM class implementation
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2006-2024 Oracle and/or its affiliates.
|
---|
10 | *
|
---|
11 | * This file is part of VirtualBox base platform packages, as
|
---|
12 | * available from https://www.virtualbox.org.
|
---|
13 | *
|
---|
14 | * This program is free software; you can redistribute it and/or
|
---|
15 | * modify it under the terms of the GNU General Public License
|
---|
16 | * as published by the Free Software Foundation, in version 3 of the
|
---|
17 | * License.
|
---|
18 | *
|
---|
19 | * This program is distributed in the hope that it will be useful, but
|
---|
20 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
22 | * General Public License for more details.
|
---|
23 | *
|
---|
24 | * You should have received a copy of the GNU General Public License
|
---|
25 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
26 | *
|
---|
27 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
28 | */
|
---|
29 |
|
---|
30 | #ifndef MAIN_INCLUDED_NATEngineImpl_h
|
---|
31 | #define MAIN_INCLUDED_NATEngineImpl_h
|
---|
32 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
33 | # pragma once
|
---|
34 | #endif
|
---|
35 |
|
---|
36 | #include "NATEngineWrap.h"
|
---|
37 |
|
---|
38 | namespace settings
|
---|
39 | {
|
---|
40 | struct NAT;
|
---|
41 | }
|
---|
42 |
|
---|
43 |
|
---|
44 | class ATL_NO_VTABLE NATEngine :
|
---|
45 | public NATEngineWrap
|
---|
46 | {
|
---|
47 | public:
|
---|
48 |
|
---|
49 | DECLARE_COMMON_CLASS_METHODS(NATEngine)
|
---|
50 |
|
---|
51 | HRESULT FinalConstruct();
|
---|
52 | void FinalRelease();
|
---|
53 |
|
---|
54 | HRESULT init(Machine *aParent, INetworkAdapter *aAdapter);
|
---|
55 | HRESULT init(Machine *aParent, INetworkAdapter *aAdapter, NATEngine *aThat);
|
---|
56 | HRESULT initCopy(Machine *aParent, INetworkAdapter *aAdapter, NATEngine *aThat);
|
---|
57 | void uninit();
|
---|
58 |
|
---|
59 | bool i_isModified();
|
---|
60 | void i_rollback();
|
---|
61 | void i_commit();
|
---|
62 | void i_copyFrom(NATEngine *aThat);
|
---|
63 | void i_applyDefaults();
|
---|
64 | bool i_hasDefaults();
|
---|
65 | HRESULT i_loadSettings(const settings::NAT &data);
|
---|
66 | HRESULT i_saveSettings(settings::NAT &data);
|
---|
67 |
|
---|
68 | private:
|
---|
69 |
|
---|
70 | // wrapped INATEngine properties
|
---|
71 | HRESULT setNetwork(const com::Utf8Str &aNetwork);
|
---|
72 | HRESULT getNetwork(com::Utf8Str &aNetwork);
|
---|
73 | HRESULT setHostIP(const com::Utf8Str &aHostIP);
|
---|
74 | HRESULT getHostIP(com::Utf8Str &aBindIP);
|
---|
75 | HRESULT setLocalhostReachable(BOOL fLocalhostReachable);
|
---|
76 | HRESULT getLocalhostReachable(BOOL *pfLocalhostReachable);
|
---|
77 | /* TFTP properties */
|
---|
78 | HRESULT setTFTPPrefix(const com::Utf8Str &aTFTPPrefix);
|
---|
79 | HRESULT getTFTPPrefix(com::Utf8Str &aTFTPPrefix);
|
---|
80 | HRESULT setTFTPBootFile(const com::Utf8Str &aTFTPBootFile);
|
---|
81 | HRESULT getTFTPBootFile(com::Utf8Str &aTFTPBootFile);
|
---|
82 | HRESULT setTFTPNextServer(const com::Utf8Str &aTFTPNextServer);
|
---|
83 | HRESULT getTFTPNextServer(com::Utf8Str &aTFTPNextServer);
|
---|
84 | /* DNS properties */
|
---|
85 | HRESULT setDNSPassDomain(BOOL aDNSPassDomain);
|
---|
86 | HRESULT getDNSPassDomain(BOOL *aDNSPassDomain);
|
---|
87 | HRESULT setDNSProxy(BOOL aDNSProxy);
|
---|
88 | HRESULT getDNSProxy(BOOL *aDNSProxy);
|
---|
89 | HRESULT getDNSUseHostResolver(BOOL *aDNSUseHostResolver);
|
---|
90 | HRESULT setDNSUseHostResolver(BOOL aDNSUseHostResolver);
|
---|
91 | /* Alias properties */
|
---|
92 | HRESULT setAliasMode(ULONG aAliasMode);
|
---|
93 | HRESULT getAliasMode(ULONG *aAliasMode);
|
---|
94 |
|
---|
95 | HRESULT getRedirects(std::vector<com::Utf8Str> &aRedirects);
|
---|
96 |
|
---|
97 | HRESULT setNetworkSettings(ULONG aMtu,
|
---|
98 | ULONG aSockSnd,
|
---|
99 | ULONG aSockRcv,
|
---|
100 | ULONG aTcpWndSnd,
|
---|
101 | ULONG aTcpWndRcv);
|
---|
102 |
|
---|
103 | HRESULT getNetworkSettings(ULONG *aMtu,
|
---|
104 | ULONG *aSockSnd,
|
---|
105 | ULONG *aSockRcv,
|
---|
106 | ULONG *aTcpWndSnd,
|
---|
107 | ULONG *aTcpWndRcv);
|
---|
108 |
|
---|
109 | HRESULT addRedirect(const com::Utf8Str &aName,
|
---|
110 | NATProtocol_T aProto,
|
---|
111 | const com::Utf8Str &aHostIP,
|
---|
112 | USHORT aHostPort,
|
---|
113 | const com::Utf8Str &aGuestIP,
|
---|
114 | USHORT aGuestPort);
|
---|
115 |
|
---|
116 | HRESULT removeRedirect(const com::Utf8Str &aName);
|
---|
117 |
|
---|
118 | struct Data;
|
---|
119 | Data *mData;
|
---|
120 | const ComObjPtr<NATEngine> mPeer;
|
---|
121 | Machine * const mParent;
|
---|
122 | INetworkAdapter * const mAdapter;
|
---|
123 | };
|
---|
124 | #endif /* !MAIN_INCLUDED_NATEngineImpl_h */
|
---|