VirtualBox

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

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

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.2 KB
Line 
1/* $Id: NetworkAdapterImpl.h 28800 2010-04-27 08:22:32Z 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 public VirtualBoxSupportErrorInfoImpl<NetworkAdapter, INetworkAdapter>,
36 public VirtualBoxSupportTranslation<NetworkAdapter>,
37 VBOX_SCRIPTABLE_IMPL(INetworkAdapter)
38{
39public:
40
41 struct Data
42 {
43 Data() : mSlot(0), mEnabled(FALSE),
44 mAttachmentType(NetworkAttachmentType_Null),
45 mCableConnected(TRUE), mLineSpeed(0), mTraceEnabled(FALSE),
46 mHostInterface("") /* cannot be null */,
47#ifdef VBOX_WITH_VDE
48 mVDENetwork("") /* can be null */,
49#endif
50 mNATNetwork("") /* cannot be null */
51 {}
52
53 NetworkAdapterType_T mAdapterType;
54 ULONG mSlot;
55 BOOL mEnabled;
56 Bstr mMACAddress;
57 NetworkAttachmentType_T mAttachmentType;
58 BOOL mCableConnected;
59 ULONG mLineSpeed;
60 BOOL mTraceEnabled;
61 Bstr mTraceFile;
62 Bstr mHostInterface;
63 Bstr mInternalNetwork;
64#ifdef VBOX_WITH_VDE
65 Bstr mVDENetwork;
66#endif
67 Bstr mNATNetwork;
68 ULONG mBootPriority;
69 };
70
71 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (NetworkAdapter)
72
73 DECLARE_NOT_AGGREGATABLE(NetworkAdapter)
74
75 DECLARE_PROTECT_FINAL_CONSTRUCT()
76
77 BEGIN_COM_MAP(NetworkAdapter)
78 COM_INTERFACE_ENTRY (ISupportErrorInfo)
79 COM_INTERFACE_ENTRY (INetworkAdapter)
80 COM_INTERFACE_ENTRY2 (IDispatch, INetworkAdapter)
81 END_COM_MAP()
82
83 DECLARE_EMPTY_CTOR_DTOR (NetworkAdapter)
84
85 HRESULT FinalConstruct();
86 void FinalRelease();
87
88 // public initializer/uninitializer for internal purposes only
89 HRESULT init (Machine *aParent, ULONG aSlot);
90 HRESULT init (Machine *aParent, NetworkAdapter *aThat);
91 HRESULT initCopy (Machine *aParent, NetworkAdapter *aThat);
92 void uninit();
93
94 // INetworkAdapter properties
95 STDMETHOD(COMGETTER(AdapterType))(NetworkAdapterType_T *aAdapterType);
96 STDMETHOD(COMSETTER(AdapterType))(NetworkAdapterType_T aAdapterType);
97 STDMETHOD(COMGETTER(Slot)) (ULONG *aSlot);
98 STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
99 STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled);
100 STDMETHOD(COMGETTER(MACAddress)) (BSTR *aMACAddress);
101 STDMETHOD(COMSETTER(MACAddress)) (IN_BSTR aMACAddress);
102 STDMETHOD(COMGETTER(AttachmentType)) (NetworkAttachmentType_T *aAttachmentType);
103 STDMETHOD(COMGETTER(HostInterface)) (BSTR *aHostInterface);
104 STDMETHOD(COMSETTER(HostInterface)) (IN_BSTR aHostInterface);
105 STDMETHOD(COMGETTER(InternalNetwork)) (BSTR *aInternalNetwork);
106 STDMETHOD(COMSETTER(InternalNetwork)) (IN_BSTR aInternalNetwork);
107 STDMETHOD(COMGETTER(NATNetwork)) (BSTR *aNATNetwork);
108 STDMETHOD(COMSETTER(NATNetwork)) (IN_BSTR aNATNetwork);
109 STDMETHOD(COMGETTER(VDENetwork)) (BSTR *aVDENetwork);
110 STDMETHOD(COMSETTER(VDENetwork)) (IN_BSTR aVDENetwork);
111 STDMETHOD(COMGETTER(CableConnected)) (BOOL *aConnected);
112 STDMETHOD(COMSETTER(CableConnected)) (BOOL aConnected);
113 STDMETHOD(COMGETTER(TraceEnabled)) (BOOL *aEnabled);
114 STDMETHOD(COMSETTER(TraceEnabled)) (BOOL aEnabled);
115 STDMETHOD(COMGETTER(LineSpeed)) (ULONG *aSpeed);
116 STDMETHOD(COMSETTER(LineSpeed)) (ULONG aSpeed);
117 STDMETHOD(COMGETTER(TraceFile)) (BSTR *aTraceFile);
118 STDMETHOD(COMSETTER(TraceFile)) (IN_BSTR aTraceFile);
119 STDMETHOD(COMGETTER(NatDriver)) (INATEngine **aNatDriver);
120 STDMETHOD(COMGETTER(BootPriority)) (ULONG *aBootPriority);
121 STDMETHOD(COMSETTER(BootPriority)) (ULONG aBootPriority);
122
123 // INetworkAdapter methods
124 STDMETHOD(AttachToNAT)();
125 STDMETHOD(AttachToBridgedInterface)();
126 STDMETHOD(AttachToInternalNetwork)();
127 STDMETHOD(AttachToHostOnlyInterface)();
128 STDMETHOD(AttachToVDE)();
129 STDMETHOD(Detach)();
130
131 // public methods only for internal purposes
132
133 HRESULT loadSettings(const settings::NetworkAdapter &data);
134 HRESULT saveSettings(settings::NetworkAdapter &data);
135
136 bool isModified();
137 void rollback();
138 void commit();
139 void copyFrom (NetworkAdapter *aThat);
140 void applyDefaults (GuestOSType *aOsType);
141
142 // for VirtualBoxSupportErrorInfoImpl
143 static const wchar_t *getComponentName() { return L"NetworkAdapter"; }
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