VirtualBox

source: vbox/trunk/src/VBox/Main/include/NetworkAdapterImpl.h@ 96861

Last change on this file since 96861 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.3 KB
Line 
1/* $Id: NetworkAdapterImpl.h 96407 2022-08-22 17:43:14Z vboxsync $ */
2/** @file
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2022 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_NetworkAdapterImpl_h
29#define MAIN_INCLUDED_NetworkAdapterImpl_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include "NetworkAdapterWrap.h"
35
36class GuestOSType;
37class BandwidthControl;
38class BandwidthGroup;
39class NATEngine;
40
41namespace settings
42{
43 struct NetworkAdapter;
44}
45
46class ATL_NO_VTABLE NetworkAdapter :
47 public NetworkAdapterWrap
48{
49public:
50
51 DECLARE_COMMON_CLASS_METHODS(NetworkAdapter)
52
53 HRESULT FinalConstruct();
54 void FinalRelease();
55
56 // public initializer/uninitializer for internal purposes only
57 HRESULT init(Machine *aParent, ULONG aSlot);
58 HRESULT init(Machine *aParent, NetworkAdapter *aThat, bool aReshare = false);
59 HRESULT initCopy(Machine *aParent, NetworkAdapter *aThat);
60 void uninit();
61
62 // public methods only for internal purposes
63 HRESULT i_loadSettings(BandwidthControl *bwctl, const settings::NetworkAdapter &data);
64 HRESULT i_saveSettings(settings::NetworkAdapter &data);
65
66 bool i_isModified();
67 void i_rollback();
68 void i_commit();
69 void i_copyFrom(NetworkAdapter *aThat);
70 void i_applyDefaults(GuestOSType *aOsType);
71 bool i_hasDefaults();
72
73 ComObjPtr<NetworkAdapter> i_getPeer();
74
75private:
76
77 // wrapped INetworkAdapter properties
78 HRESULT getAdapterType(NetworkAdapterType_T *aAdapterType);
79 HRESULT setAdapterType(NetworkAdapterType_T aAdapterType);
80 HRESULT getSlot(ULONG *aSlot);
81 HRESULT getEnabled(BOOL *aEnabled);
82 HRESULT setEnabled(BOOL aEnabled);
83 HRESULT getMACAddress(com::Utf8Str &aMACAddress);
84 HRESULT setMACAddress(const com::Utf8Str &aMACAddress);
85 HRESULT getAttachmentType(NetworkAttachmentType_T *aAttachmentType);
86 HRESULT setAttachmentType(NetworkAttachmentType_T aAttachmentType);
87 HRESULT getBridgedInterface(com::Utf8Str &aBridgedInterface);
88 HRESULT setBridgedInterface(const com::Utf8Str &aBridgedInterface);
89 HRESULT getHostOnlyInterface(com::Utf8Str &aHostOnlyInterface);
90 HRESULT setHostOnlyInterface(const com::Utf8Str &aHostOnlyInterface);
91 HRESULT getHostOnlyNetwork(com::Utf8Str &aHostOnlyNetwork);
92 HRESULT setHostOnlyNetwork(const com::Utf8Str &aHostOnlyNetwork);
93 HRESULT getInternalNetwork(com::Utf8Str &aInternalNetwork);
94 HRESULT setInternalNetwork(const com::Utf8Str &aInternalNetwork);
95 HRESULT getNATNetwork(com::Utf8Str &aNATNetwork);
96 HRESULT setNATNetwork(const com::Utf8Str &aNATNetwork);
97 HRESULT getGenericDriver(com::Utf8Str &aGenericDriver);
98 HRESULT setGenericDriver(const com::Utf8Str &aGenericDriver);
99 HRESULT getCloudNetwork(com::Utf8Str &aCloudNetwork);
100 HRESULT setCloudNetwork(const com::Utf8Str &aCloudNetwork);
101 HRESULT getCableConnected(BOOL *aCableConnected);
102 HRESULT setCableConnected(BOOL aCableConnected);
103 HRESULT getLineSpeed(ULONG *aLineSpeed);
104 HRESULT setLineSpeed(ULONG aLineSpeed);
105 HRESULT getPromiscModePolicy(NetworkAdapterPromiscModePolicy_T *aPromiscModePolicy);
106 HRESULT setPromiscModePolicy(NetworkAdapterPromiscModePolicy_T aPromiscModePolicy);
107 HRESULT getTraceEnabled(BOOL *aTraceEnabled);
108 HRESULT setTraceEnabled(BOOL aTraceEnabled);
109 HRESULT getTraceFile(com::Utf8Str &aTraceFile);
110 HRESULT setTraceFile(const com::Utf8Str &aTraceFile);
111 HRESULT getNATEngine(ComPtr<INATEngine> &aNATEngine);
112 HRESULT getBootPriority(ULONG *aBootPriority);
113 HRESULT setBootPriority(ULONG aBootPriority);
114 HRESULT getBandwidthGroup(ComPtr<IBandwidthGroup> &aBandwidthGroup);
115 HRESULT setBandwidthGroup(const ComPtr<IBandwidthGroup> &aBandwidthGroup);
116
117 // wrapped INetworkAdapter methods
118 HRESULT getProperty(const com::Utf8Str &aKey,
119 com::Utf8Str &aValue);
120 HRESULT setProperty(const com::Utf8Str &aKey,
121 const com::Utf8Str &aValue);
122 HRESULT getProperties(const com::Utf8Str &aNames,
123 std::vector<com::Utf8Str> &aReturnNames,
124 std::vector<com::Utf8Str> &aReturnValues);
125 // Misc.
126 void i_generateMACAddress();
127 HRESULT i_updateMacAddress(Utf8Str aMacAddress);
128 void i_updateBandwidthGroup(BandwidthGroup *aBwGroup);
129 HRESULT i_switchFromNatNetworking(const com::Utf8Str &aNatnetworkName);
130 HRESULT i_switchToNatNetworking(const com::Utf8Str &aNatNetworkName);
131
132
133 Machine * const mParent;
134 const ComObjPtr<NetworkAdapter> mPeer;
135 const ComObjPtr<NATEngine> mNATEngine;
136
137 Backupable<settings::NetworkAdapter> mData;
138};
139
140#endif /* !MAIN_INCLUDED_NetworkAdapterImpl_h */
141/* vi: set tabstop=4 shiftwidth=4 expandtab: */
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