VirtualBox

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

Last change on this file since 30764 was 30764, checked in by vboxsync, 15 years ago

back out r63543, r63544 until windows build problems can be solved properly

  • 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 30764 2010-07-09 14:12:12Z 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 };
72
73 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(NetworkAdapter, INetworkAdapter)
74
75 DECLARE_NOT_AGGREGATABLE(NetworkAdapter)
76
77 DECLARE_PROTECT_FINAL_CONSTRUCT()
78
79 BEGIN_COM_MAP(NetworkAdapter)
80 COM_INTERFACE_ENTRY (ISupportErrorInfo)
81 COM_INTERFACE_ENTRY (INetworkAdapter)
82 COM_INTERFACE_ENTRY2 (IDispatch, INetworkAdapter)
83 END_COM_MAP()
84
85 DECLARE_EMPTY_CTOR_DTOR (NetworkAdapter)
86
87 HRESULT FinalConstruct();
88 void FinalRelease();
89
90 // public initializer/uninitializer for internal purposes only
91 HRESULT init (Machine *aParent, ULONG aSlot);
92 HRESULT init (Machine *aParent, NetworkAdapter *aThat);
93 HRESULT initCopy (Machine *aParent, NetworkAdapter *aThat);
94 void uninit();
95
96 // INetworkAdapter properties
97 STDMETHOD(COMGETTER(AdapterType))(NetworkAdapterType_T *aAdapterType);
98 STDMETHOD(COMSETTER(AdapterType))(NetworkAdapterType_T aAdapterType);
99 STDMETHOD(COMGETTER(Slot)) (ULONG *aSlot);
100 STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
101 STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled);
102 STDMETHOD(COMGETTER(MACAddress)) (BSTR *aMACAddress);
103 STDMETHOD(COMSETTER(MACAddress)) (IN_BSTR aMACAddress);
104 STDMETHOD(COMGETTER(AttachmentType)) (NetworkAttachmentType_T *aAttachmentType);
105 STDMETHOD(COMGETTER(HostInterface)) (BSTR *aHostInterface);
106 STDMETHOD(COMSETTER(HostInterface)) (IN_BSTR aHostInterface);
107 STDMETHOD(COMGETTER(InternalNetwork)) (BSTR *aInternalNetwork);
108 STDMETHOD(COMSETTER(InternalNetwork)) (IN_BSTR aInternalNetwork);
109 STDMETHOD(COMGETTER(NATNetwork)) (BSTR *aNATNetwork);
110 STDMETHOD(COMSETTER(NATNetwork)) (IN_BSTR aNATNetwork);
111 STDMETHOD(COMGETTER(VDENetwork)) (BSTR *aVDENetwork);
112 STDMETHOD(COMSETTER(VDENetwork)) (IN_BSTR aVDENetwork);
113 STDMETHOD(COMGETTER(CableConnected)) (BOOL *aConnected);
114 STDMETHOD(COMSETTER(CableConnected)) (BOOL aConnected);
115 STDMETHOD(COMGETTER(TraceEnabled)) (BOOL *aEnabled);
116 STDMETHOD(COMSETTER(TraceEnabled)) (BOOL aEnabled);
117 STDMETHOD(COMGETTER(LineSpeed)) (ULONG *aSpeed);
118 STDMETHOD(COMSETTER(LineSpeed)) (ULONG aSpeed);
119 STDMETHOD(COMGETTER(TraceFile)) (BSTR *aTraceFile);
120 STDMETHOD(COMSETTER(TraceFile)) (IN_BSTR aTraceFile);
121 STDMETHOD(COMGETTER(NatDriver)) (INATEngine **aNatDriver);
122 STDMETHOD(COMGETTER(BootPriority)) (ULONG *aBootPriority);
123 STDMETHOD(COMSETTER(BootPriority)) (ULONG aBootPriority);
124
125 // INetworkAdapter methods
126 STDMETHOD(AttachToNAT)();
127 STDMETHOD(AttachToBridgedInterface)();
128 STDMETHOD(AttachToInternalNetwork)();
129 STDMETHOD(AttachToHostOnlyInterface)();
130 STDMETHOD(AttachToVDE)();
131 STDMETHOD(Detach)();
132
133 // public methods only for internal purposes
134
135 HRESULT loadSettings(const settings::NetworkAdapter &data);
136 HRESULT saveSettings(settings::NetworkAdapter &data);
137
138 bool isModified();
139 void rollback();
140 void commit();
141 void copyFrom (NetworkAdapter *aThat);
142 void applyDefaults (GuestOSType *aOsType);
143
144private:
145
146 void detach();
147 void generateMACAddress();
148
149 Machine * const mParent;
150 const ComObjPtr<NetworkAdapter> mPeer;
151 const ComObjPtr<NATEngine> mNATEngine;
152
153 bool m_fModified;
154 Backupable<Data> mData;
155};
156
157#endif // ____H_NETWORKADAPTER
158/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette