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