1 | /* $Id: NetworkAdapterImpl.h 69500 2017-10-28 15:14:05Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | *
|
---|
5 | * VirtualBox COM class implementation
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2006-2017 Oracle Corporation
|
---|
10 | *
|
---|
11 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
12 | * available from http://www.virtualbox.org. This file is free software;
|
---|
13 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
14 | * General Public License (GPL) as published by the Free Software
|
---|
15 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
16 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
17 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
18 | */
|
---|
19 |
|
---|
20 | #ifndef ____H_NETWORKADAPTER
|
---|
21 | #define ____H_NETWORKADAPTER
|
---|
22 |
|
---|
23 | #include "NetworkAdapterWrap.h"
|
---|
24 |
|
---|
25 | class GuestOSType;
|
---|
26 | class BandwidthControl;
|
---|
27 | class BandwidthGroup;
|
---|
28 | class NATEngine;
|
---|
29 |
|
---|
30 | namespace settings
|
---|
31 | {
|
---|
32 | struct NetworkAdapter;
|
---|
33 | }
|
---|
34 |
|
---|
35 | class ATL_NO_VTABLE NetworkAdapter :
|
---|
36 | public NetworkAdapterWrap
|
---|
37 | {
|
---|
38 | public:
|
---|
39 |
|
---|
40 | DECLARE_EMPTY_CTOR_DTOR(NetworkAdapter)
|
---|
41 |
|
---|
42 | HRESULT FinalConstruct();
|
---|
43 | void FinalRelease();
|
---|
44 |
|
---|
45 | // public initializer/uninitializer for internal purposes only
|
---|
46 | HRESULT init(Machine *aParent, ULONG aSlot);
|
---|
47 | HRESULT init(Machine *aParent, NetworkAdapter *aThat, bool aReshare = false);
|
---|
48 | HRESULT initCopy(Machine *aParent, NetworkAdapter *aThat);
|
---|
49 | void uninit();
|
---|
50 |
|
---|
51 | // public methods only for internal purposes
|
---|
52 | HRESULT i_loadSettings(BandwidthControl *bwctl, const settings::NetworkAdapter &data);
|
---|
53 | HRESULT i_saveSettings(settings::NetworkAdapter &data);
|
---|
54 |
|
---|
55 | bool i_isModified();
|
---|
56 | void i_rollback();
|
---|
57 | void i_commit();
|
---|
58 | void i_copyFrom(NetworkAdapter *aThat);
|
---|
59 | void i_applyDefaults(GuestOSType *aOsType);
|
---|
60 | bool i_hasDefaults();
|
---|
61 |
|
---|
62 | ComObjPtr<NetworkAdapter> i_getPeer();
|
---|
63 |
|
---|
64 | private:
|
---|
65 |
|
---|
66 | // wrapped INetworkAdapter properties
|
---|
67 | HRESULT getAdapterType(NetworkAdapterType_T *aAdapterType);
|
---|
68 | HRESULT setAdapterType(NetworkAdapterType_T aAdapterType);
|
---|
69 | HRESULT getSlot(ULONG *aSlot);
|
---|
70 | HRESULT getEnabled(BOOL *aEnabled);
|
---|
71 | HRESULT setEnabled(BOOL aEnabled);
|
---|
72 | HRESULT getMACAddress(com::Utf8Str &aMACAddress);
|
---|
73 | HRESULT setMACAddress(const com::Utf8Str &aMACAddress);
|
---|
74 | HRESULT getAttachmentType(NetworkAttachmentType_T *aAttachmentType);
|
---|
75 | HRESULT setAttachmentType(NetworkAttachmentType_T aAttachmentType);
|
---|
76 | HRESULT getBridgedInterface(com::Utf8Str &aBridgedInterface);
|
---|
77 | HRESULT setBridgedInterface(const com::Utf8Str &aBridgedInterface);
|
---|
78 | HRESULT getHostOnlyInterface(com::Utf8Str &aHostOnlyInterface);
|
---|
79 | HRESULT setHostOnlyInterface(const com::Utf8Str &aHostOnlyInterface);
|
---|
80 | HRESULT getInternalNetwork(com::Utf8Str &aInternalNetwork);
|
---|
81 | HRESULT setInternalNetwork(const com::Utf8Str &aInternalNetwork);
|
---|
82 | HRESULT getNATNetwork(com::Utf8Str &aNATNetwork);
|
---|
83 | HRESULT setNATNetwork(const com::Utf8Str &aNATNetwork);
|
---|
84 | HRESULT getGenericDriver(com::Utf8Str &aGenericDriver);
|
---|
85 | HRESULT setGenericDriver(const com::Utf8Str &aGenericDriver);
|
---|
86 | HRESULT getCableConnected(BOOL *aCableConnected);
|
---|
87 | HRESULT setCableConnected(BOOL aCableConnected);
|
---|
88 | HRESULT getLineSpeed(ULONG *aLineSpeed);
|
---|
89 | HRESULT setLineSpeed(ULONG aLineSpeed);
|
---|
90 | HRESULT getPromiscModePolicy(NetworkAdapterPromiscModePolicy_T *aPromiscModePolicy);
|
---|
91 | HRESULT setPromiscModePolicy(NetworkAdapterPromiscModePolicy_T aPromiscModePolicy);
|
---|
92 | HRESULT getTraceEnabled(BOOL *aTraceEnabled);
|
---|
93 | HRESULT setTraceEnabled(BOOL aTraceEnabled);
|
---|
94 | HRESULT getTraceFile(com::Utf8Str &aTraceFile);
|
---|
95 | HRESULT setTraceFile(const com::Utf8Str &aTraceFile);
|
---|
96 | HRESULT getNATEngine(ComPtr<INATEngine> &aNATEngine);
|
---|
97 | HRESULT getBootPriority(ULONG *aBootPriority);
|
---|
98 | HRESULT setBootPriority(ULONG aBootPriority);
|
---|
99 | HRESULT getBandwidthGroup(ComPtr<IBandwidthGroup> &aBandwidthGroup);
|
---|
100 | HRESULT setBandwidthGroup(const ComPtr<IBandwidthGroup> &aBandwidthGroup);
|
---|
101 |
|
---|
102 | // wrapped INetworkAdapter methods
|
---|
103 | HRESULT getProperty(const com::Utf8Str &aKey,
|
---|
104 | com::Utf8Str &aValue);
|
---|
105 | HRESULT setProperty(const com::Utf8Str &aKey,
|
---|
106 | const com::Utf8Str &aValue);
|
---|
107 | HRESULT getProperties(const com::Utf8Str &aNames,
|
---|
108 | std::vector<com::Utf8Str> &aReturnNames,
|
---|
109 | std::vector<com::Utf8Str> &aReturnValues);
|
---|
110 | // Misc.
|
---|
111 | void i_generateMACAddress();
|
---|
112 | HRESULT i_updateMacAddress(Utf8Str aMacAddress);
|
---|
113 | void i_updateBandwidthGroup(BandwidthGroup *aBwGroup);
|
---|
114 | HRESULT i_switchFromNatNetworking(const com::Utf8Str &aNatnetworkName);
|
---|
115 | HRESULT i_switchToNatNetworking(const com::Utf8Str &aNatNetworkName);
|
---|
116 |
|
---|
117 |
|
---|
118 | Machine * const mParent;
|
---|
119 | const ComObjPtr<NetworkAdapter> mPeer;
|
---|
120 | const ComObjPtr<NATEngine> mNATEngine;
|
---|
121 |
|
---|
122 | Backupable<settings::NetworkAdapter> mData;
|
---|
123 | };
|
---|
124 |
|
---|
125 | #endif // ____H_NETWORKADAPTER
|
---|
126 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|