VirtualBox

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

最後變更 在這個檔案從28787是 28406,由 vboxsync 提交於 15 年 前

Devices, Main, FE/Qt: re-committed support for VDE virtual network switches for Linux and FreeBSD hosts. Contributed by Renzo Davoli, VirtualSquare, University of Bologna

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 5.4 KB
 
1/* $Id: NetworkAdapterImpl.h 28406 2010-04-16 10:45:18Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class implementation
6 */
7
8/*
9 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.alldomusa.eu.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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
20 * Clara, CA 95054 USA or visit http://www.sun.com if you need
21 * additional information or have any questions.
22 */
23
24#ifndef ____H_NETWORKADAPTER
25#define ____H_NETWORKADAPTER
26
27#include "VirtualBoxBase.h"
28#include "NATEngineImpl.h"
29
30class GuestOSType;
31
32namespace settings
33{
34 struct NetworkAdapter;
35}
36
37class ATL_NO_VTABLE NetworkAdapter :
38 public VirtualBoxBase,
39 public VirtualBoxSupportErrorInfoImpl<NetworkAdapter, INetworkAdapter>,
40 public VirtualBoxSupportTranslation<NetworkAdapter>,
41 VBOX_SCRIPTABLE_IMPL(INetworkAdapter)
42{
43public:
44
45 struct Data
46 {
47 Data() : mSlot(0), mEnabled(FALSE),
48 mAttachmentType(NetworkAttachmentType_Null),
49 mCableConnected(TRUE), mLineSpeed(0), mTraceEnabled(FALSE),
50 mHostInterface("") /* cannot be null */,
51#ifdef VBOX_WITH_VDE
52 mVDENetwork("") /* can be null */,
53#endif
54 mNATNetwork("") /* cannot be null */
55 {}
56
57 NetworkAdapterType_T mAdapterType;
58 ULONG mSlot;
59 BOOL mEnabled;
60 Bstr mMACAddress;
61 NetworkAttachmentType_T mAttachmentType;
62 BOOL mCableConnected;
63 ULONG mLineSpeed;
64 BOOL mTraceEnabled;
65 Bstr mTraceFile;
66 Bstr mHostInterface;
67 Bstr mInternalNetwork;
68#ifdef VBOX_WITH_VDE
69 Bstr mVDENetwork;
70#endif
71 Bstr mNATNetwork;
72 ULONG mBootPriority;
73 };
74
75 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (NetworkAdapter)
76
77 DECLARE_NOT_AGGREGATABLE(NetworkAdapter)
78
79 DECLARE_PROTECT_FINAL_CONSTRUCT()
80
81 BEGIN_COM_MAP(NetworkAdapter)
82 COM_INTERFACE_ENTRY (ISupportErrorInfo)
83 COM_INTERFACE_ENTRY (INetworkAdapter)
84 COM_INTERFACE_ENTRY2 (IDispatch, INetworkAdapter)
85 END_COM_MAP()
86
87 DECLARE_EMPTY_CTOR_DTOR (NetworkAdapter)
88
89 HRESULT FinalConstruct();
90 void FinalRelease();
91
92 // public initializer/uninitializer for internal purposes only
93 HRESULT init (Machine *aParent, ULONG aSlot);
94 HRESULT init (Machine *aParent, NetworkAdapter *aThat);
95 HRESULT initCopy (Machine *aParent, NetworkAdapter *aThat);
96 void uninit();
97
98 // INetworkAdapter properties
99 STDMETHOD(COMGETTER(AdapterType))(NetworkAdapterType_T *aAdapterType);
100 STDMETHOD(COMSETTER(AdapterType))(NetworkAdapterType_T aAdapterType);
101 STDMETHOD(COMGETTER(Slot)) (ULONG *aSlot);
102 STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
103 STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled);
104 STDMETHOD(COMGETTER(MACAddress)) (BSTR *aMACAddress);
105 STDMETHOD(COMSETTER(MACAddress)) (IN_BSTR aMACAddress);
106 STDMETHOD(COMGETTER(AttachmentType)) (NetworkAttachmentType_T *aAttachmentType);
107 STDMETHOD(COMGETTER(HostInterface)) (BSTR *aHostInterface);
108 STDMETHOD(COMSETTER(HostInterface)) (IN_BSTR aHostInterface);
109 STDMETHOD(COMGETTER(InternalNetwork)) (BSTR *aInternalNetwork);
110 STDMETHOD(COMSETTER(InternalNetwork)) (IN_BSTR aInternalNetwork);
111 STDMETHOD(COMGETTER(NATNetwork)) (BSTR *aNATNetwork);
112 STDMETHOD(COMSETTER(NATNetwork)) (IN_BSTR aNATNetwork);
113 STDMETHOD(COMGETTER(VDENetwork)) (BSTR *aVDENetwork);
114 STDMETHOD(COMSETTER(VDENetwork)) (IN_BSTR aVDENetwork);
115 STDMETHOD(COMGETTER(CableConnected)) (BOOL *aConnected);
116 STDMETHOD(COMSETTER(CableConnected)) (BOOL aConnected);
117 STDMETHOD(COMGETTER(TraceEnabled)) (BOOL *aEnabled);
118 STDMETHOD(COMSETTER(TraceEnabled)) (BOOL aEnabled);
119 STDMETHOD(COMGETTER(LineSpeed)) (ULONG *aSpeed);
120 STDMETHOD(COMSETTER(LineSpeed)) (ULONG aSpeed);
121 STDMETHOD(COMGETTER(TraceFile)) (BSTR *aTraceFile);
122 STDMETHOD(COMSETTER(TraceFile)) (IN_BSTR aTraceFile);
123 STDMETHOD(COMGETTER(NatDriver)) (INATEngine **aNatDriver);
124 STDMETHOD(COMGETTER(BootPriority)) (ULONG *aBootPriority);
125 STDMETHOD(COMSETTER(BootPriority)) (ULONG aBootPriority);
126
127 // INetworkAdapter methods
128 STDMETHOD(AttachToNAT)();
129 STDMETHOD(AttachToBridgedInterface)();
130 STDMETHOD(AttachToInternalNetwork)();
131 STDMETHOD(AttachToHostOnlyInterface)();
132 STDMETHOD(AttachToVDE)();
133 STDMETHOD(Detach)();
134
135 // public methods only for internal purposes
136
137 HRESULT loadSettings(const settings::NetworkAdapter &data);
138 HRESULT saveSettings(settings::NetworkAdapter &data);
139
140 bool isModified();
141 void rollback();
142 void commit();
143 void copyFrom (NetworkAdapter *aThat);
144 void applyDefaults (GuestOSType *aOsType);
145
146 // for VirtualBoxSupportErrorInfoImpl
147 static const wchar_t *getComponentName() { return L"NetworkAdapter"; }
148
149private:
150
151 void detach();
152 void generateMACAddress();
153
154 Machine * const mParent;
155 const ComObjPtr<NetworkAdapter> mPeer;
156 const ComObjPtr<NATEngine> mNATEngine;
157
158 bool m_fModified;
159 Backupable<Data> mData;
160};
161
162#endif // ____H_NETWORKADAPTER
163/* vi: set tabstop=4 shiftwidth=4 expandtab: */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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