VirtualBox

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

Last change on this file since 35638 was 35638, checked in by vboxsync, 14 years ago

Main. QT/FE: fix long standing COM issue

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.1 KB
Line 
1/* $Id: NetworkAdapterImpl.h 35638 2011-01-19 19:10:49Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class implementation
6 */
7
8/*
9 * Copyright (C) 2006-2010 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 "VirtualBoxBase.h"
24#include "NATEngineImpl.h"
25
26class GuestOSType;
27
28namespace settings
29{
30 struct NetworkAdapter;
31}
32
33class ATL_NO_VTABLE NetworkAdapter :
34 public VirtualBoxBase,
35 VBOX_SCRIPTABLE_IMPL(INetworkAdapter)
36{
37public:
38
39 struct Data
40 {
41 Data() : mSlot(0),
42 mEnabled(FALSE),
43 mAttachmentType(NetworkAttachmentType_Null),
44 mCableConnected(TRUE),
45 mLineSpeed(0),
46 mTraceEnabled(FALSE),
47 mHostInterface("") /* cannot be null */,
48#ifdef VBOX_WITH_VDE
49 mVDENetwork("") /* can be null */,
50#endif
51 mNATNetwork("") /* cannot be null */,
52 mBootPriority(0)
53 {}
54
55 NetworkAdapterType_T mAdapterType;
56 ULONG mSlot;
57 BOOL mEnabled;
58 Bstr mMACAddress;
59 NetworkAttachmentType_T mAttachmentType;
60 BOOL mCableConnected;
61 ULONG mLineSpeed;
62 BOOL mTraceEnabled;
63 Bstr mTraceFile;
64 Bstr mHostInterface;
65 Bstr mInternalNetwork;
66#ifdef VBOX_WITH_VDE
67 Bstr mVDENetwork;
68#endif
69 Bstr mNATNetwork;
70 ULONG mBootPriority;
71 ULONG mBandwidthLimit;
72 };
73
74 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(NetworkAdapter, INetworkAdapter)
75
76 DECLARE_NOT_AGGREGATABLE(NetworkAdapter)
77
78 DECLARE_PROTECT_FINAL_CONSTRUCT()
79
80 BEGIN_COM_MAP(NetworkAdapter)
81 VBOX_DEFAULT_INTERFACE_ENTRIES (INetworkAdapter)
82 END_COM_MAP()
83
84 DECLARE_EMPTY_CTOR_DTOR (NetworkAdapter)
85
86 HRESULT FinalConstruct();
87 void FinalRelease();
88
89 // public initializer/uninitializer for internal purposes only
90 HRESULT init (Machine *aParent, ULONG aSlot);
91 HRESULT init (Machine *aParent, NetworkAdapter *aThat);
92 HRESULT initCopy (Machine *aParent, NetworkAdapter *aThat);
93 void uninit();
94
95 // INetworkAdapter properties
96 STDMETHOD(COMGETTER(AdapterType))(NetworkAdapterType_T *aAdapterType);
97 STDMETHOD(COMSETTER(AdapterType))(NetworkAdapterType_T aAdapterType);
98 STDMETHOD(COMGETTER(Slot)) (ULONG *aSlot);
99 STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
100 STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled);
101 STDMETHOD(COMGETTER(MACAddress)) (BSTR *aMACAddress);
102 STDMETHOD(COMSETTER(MACAddress)) (IN_BSTR aMACAddress);
103 STDMETHOD(COMGETTER(AttachmentType)) (NetworkAttachmentType_T *aAttachmentType);
104 STDMETHOD(COMGETTER(HostInterface)) (BSTR *aHostInterface);
105 STDMETHOD(COMSETTER(HostInterface)) (IN_BSTR aHostInterface);
106 STDMETHOD(COMGETTER(InternalNetwork)) (BSTR *aInternalNetwork);
107 STDMETHOD(COMSETTER(InternalNetwork)) (IN_BSTR aInternalNetwork);
108 STDMETHOD(COMGETTER(NATNetwork)) (BSTR *aNATNetwork);
109 STDMETHOD(COMSETTER(NATNetwork)) (IN_BSTR aNATNetwork);
110 STDMETHOD(COMGETTER(VDENetwork)) (BSTR *aVDENetwork);
111 STDMETHOD(COMSETTER(VDENetwork)) (IN_BSTR aVDENetwork);
112 STDMETHOD(COMGETTER(CableConnected)) (BOOL *aConnected);
113 STDMETHOD(COMSETTER(CableConnected)) (BOOL aConnected);
114 STDMETHOD(COMGETTER(TraceEnabled)) (BOOL *aEnabled);
115 STDMETHOD(COMSETTER(TraceEnabled)) (BOOL aEnabled);
116 STDMETHOD(COMGETTER(LineSpeed)) (ULONG *aSpeed);
117 STDMETHOD(COMSETTER(LineSpeed)) (ULONG aSpeed);
118 STDMETHOD(COMGETTER(TraceFile)) (BSTR *aTraceFile);
119 STDMETHOD(COMSETTER(TraceFile)) (IN_BSTR aTraceFile);
120 STDMETHOD(COMGETTER(NatDriver)) (INATEngine **aNatDriver);
121 STDMETHOD(COMGETTER(BootPriority)) (ULONG *aBootPriority);
122 STDMETHOD(COMSETTER(BootPriority)) (ULONG aBootPriority);
123 STDMETHOD(COMGETTER(BandwidthLimit)) (ULONG *aLimit);
124 STDMETHOD(COMSETTER(BandwidthLimit)) (ULONG aLimit);
125
126 // INetworkAdapter methods
127 STDMETHOD(AttachToNAT)();
128 STDMETHOD(AttachToBridgedInterface)();
129 STDMETHOD(AttachToInternalNetwork)();
130 STDMETHOD(AttachToHostOnlyInterface)();
131 STDMETHOD(AttachToVDE)();
132 STDMETHOD(Detach)();
133
134 // public methods only for internal purposes
135
136 HRESULT loadSettings(const settings::NetworkAdapter &data);
137 HRESULT saveSettings(settings::NetworkAdapter &data);
138
139 bool isModified();
140 void rollback();
141 void commit();
142 void copyFrom (NetworkAdapter *aThat);
143 void applyDefaults (GuestOSType *aOsType);
144
145private:
146
147 void detach();
148 void generateMACAddress();
149
150 Machine * const mParent;
151 const ComObjPtr<NetworkAdapter> mPeer;
152 const ComObjPtr<NATEngine> mNATEngine;
153
154 bool m_fModified;
155 Backupable<Data> mData;
156};
157
158#endif // ____H_NETWORKADAPTER
159/* 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