1 | /* $Id: NetworkAdapterImpl.h 61170 2016-05-24 16:44:44Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | *
|
---|
5 | * VirtualBox COM class implementation
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2006-2016 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 |
|
---|
61 | ComObjPtr<NetworkAdapter> i_getPeer();
|
---|
62 |
|
---|
63 | private:
|
---|
64 |
|
---|
65 | // wrapped INetworkAdapter properties
|
---|
66 | HRESULT getAdapterType(NetworkAdapterType_T *aAdapterType);
|
---|
67 | HRESULT setAdapterType(NetworkAdapterType_T aAdapterType);
|
---|
68 | HRESULT getSlot(ULONG *aSlot);
|
---|
69 | HRESULT getEnabled(BOOL *aEnabled);
|
---|
70 | HRESULT setEnabled(BOOL aEnabled);
|
---|
71 | HRESULT getMACAddress(com::Utf8Str &aMACAddress);
|
---|
72 | HRESULT setMACAddress(const com::Utf8Str &aMACAddress);
|
---|
73 | HRESULT getAttachmentType(NetworkAttachmentType_T *aAttachmentType);
|
---|
74 | HRESULT setAttachmentType(NetworkAttachmentType_T aAttachmentType);
|
---|
75 | HRESULT getBridgedInterface(com::Utf8Str &aBridgedInterface);
|
---|
76 | HRESULT setBridgedInterface(const com::Utf8Str &aBridgedInterface);
|
---|
77 | HRESULT getHostOnlyInterface(com::Utf8Str &aHostOnlyInterface);
|
---|
78 | HRESULT setHostOnlyInterface(const com::Utf8Str &aHostOnlyInterface);
|
---|
79 | HRESULT getInternalNetwork(com::Utf8Str &aInternalNetwork);
|
---|
80 | HRESULT setInternalNetwork(const com::Utf8Str &aInternalNetwork);
|
---|
81 | HRESULT getNATNetwork(com::Utf8Str &aNATNetwork);
|
---|
82 | HRESULT setNATNetwork(const com::Utf8Str &aNATNetwork);
|
---|
83 | HRESULT getGenericDriver(com::Utf8Str &aGenericDriver);
|
---|
84 | HRESULT setGenericDriver(const com::Utf8Str &aGenericDriver);
|
---|
85 | HRESULT getCableConnected(BOOL *aCableConnected);
|
---|
86 | HRESULT setCableConnected(BOOL aCableConnected);
|
---|
87 | HRESULT getLineSpeed(ULONG *aLineSpeed);
|
---|
88 | HRESULT setLineSpeed(ULONG aLineSpeed);
|
---|
89 | HRESULT getPromiscModePolicy(NetworkAdapterPromiscModePolicy_T *aPromiscModePolicy);
|
---|
90 | HRESULT setPromiscModePolicy(NetworkAdapterPromiscModePolicy_T aPromiscModePolicy);
|
---|
91 | HRESULT getTraceEnabled(BOOL *aTraceEnabled);
|
---|
92 | HRESULT setTraceEnabled(BOOL aTraceEnabled);
|
---|
93 | HRESULT getTraceFile(com::Utf8Str &aTraceFile);
|
---|
94 | HRESULT setTraceFile(const com::Utf8Str &aTraceFile);
|
---|
95 | HRESULT getNATEngine(ComPtr<INATEngine> &aNATEngine);
|
---|
96 | HRESULT getBootPriority(ULONG *aBootPriority);
|
---|
97 | HRESULT setBootPriority(ULONG aBootPriority);
|
---|
98 | HRESULT getBandwidthGroup(ComPtr<IBandwidthGroup> &aBandwidthGroup);
|
---|
99 | HRESULT setBandwidthGroup(const ComPtr<IBandwidthGroup> &aBandwidthGroup);
|
---|
100 |
|
---|
101 | // wrapped INetworkAdapter methods
|
---|
102 | HRESULT getProperty(const com::Utf8Str &aKey,
|
---|
103 | com::Utf8Str &aValue);
|
---|
104 | HRESULT setProperty(const com::Utf8Str &aKey,
|
---|
105 | const com::Utf8Str &aValue);
|
---|
106 | HRESULT getProperties(const com::Utf8Str &aNames,
|
---|
107 | std::vector<com::Utf8Str> &aReturnNames,
|
---|
108 | std::vector<com::Utf8Str> &aReturnValues);
|
---|
109 | // Misc.
|
---|
110 | void i_generateMACAddress();
|
---|
111 | HRESULT i_updateMacAddress(Utf8Str aMacAddress);
|
---|
112 | void i_updateBandwidthGroup(BandwidthGroup *aBwGroup);
|
---|
113 | HRESULT i_checkAndSwitchFromNatNetworking(com::Utf8Str networkName);
|
---|
114 | HRESULT i_switchToNatNetworking(const com::Utf8Str &aNatNetworkName);
|
---|
115 |
|
---|
116 |
|
---|
117 | Machine * const mParent;
|
---|
118 | const ComObjPtr<NetworkAdapter> mPeer;
|
---|
119 | const ComObjPtr<NATEngine> mNATEngine;
|
---|
120 |
|
---|
121 | Backupable<settings::NetworkAdapter> mData;
|
---|
122 | };
|
---|
123 |
|
---|
124 | #endif // ____H_NETWORKADAPTER
|
---|
125 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|