1 | /* $Id: HostNetworkInterfaceImpl.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-2009 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_HOSTNETWORKINTERFACEIMPL
|
---|
21 | #define ____H_HOSTNETWORKINTERFACEIMPL
|
---|
22 |
|
---|
23 | #include "VirtualBoxBase.h"
|
---|
24 | #include "VirtualBoxImpl.h"
|
---|
25 |
|
---|
26 | #ifdef VBOX_WITH_HOSTNETIF_API
|
---|
27 | /* class HostNetworkInterface; */
|
---|
28 | /* #include "netif.h" */
|
---|
29 | struct NETIFINFO;
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | class ATL_NO_VTABLE HostNetworkInterface :
|
---|
33 | public VirtualBoxBase,
|
---|
34 | public VirtualBoxSupportErrorInfoImpl<HostNetworkInterface, IHostNetworkInterface>,
|
---|
35 | public VirtualBoxSupportTranslation<HostNetworkInterface>,
|
---|
36 | VBOX_SCRIPTABLE_IMPL(IHostNetworkInterface)
|
---|
37 | {
|
---|
38 | public:
|
---|
39 |
|
---|
40 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (HostNetworkInterface)
|
---|
41 |
|
---|
42 | DECLARE_NOT_AGGREGATABLE (HostNetworkInterface)
|
---|
43 |
|
---|
44 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
45 |
|
---|
46 | BEGIN_COM_MAP (HostNetworkInterface)
|
---|
47 | COM_INTERFACE_ENTRY (ISupportErrorInfo)
|
---|
48 | COM_INTERFACE_ENTRY (IHostNetworkInterface)
|
---|
49 | COM_INTERFACE_ENTRY (IDispatch)
|
---|
50 | END_COM_MAP()
|
---|
51 |
|
---|
52 | DECLARE_EMPTY_CTOR_DTOR (HostNetworkInterface)
|
---|
53 |
|
---|
54 | HRESULT FinalConstruct();
|
---|
55 | void FinalRelease();
|
---|
56 |
|
---|
57 | // public initializer/uninitializer for internal purposes only
|
---|
58 | HRESULT init (Bstr interfaceName, Guid guid, HostNetworkInterfaceType_T ifType);
|
---|
59 | #ifdef VBOX_WITH_HOSTNETIF_API
|
---|
60 | HRESULT init (Bstr aInterfaceName, HostNetworkInterfaceType_T ifType, struct NETIFINFO *pIfs);
|
---|
61 | HRESULT updateConfig ();
|
---|
62 | #endif
|
---|
63 |
|
---|
64 | // IHostNetworkInterface properties
|
---|
65 | STDMETHOD(COMGETTER(Name)) (BSTR *aInterfaceName);
|
---|
66 | STDMETHOD(COMGETTER(Id)) (BSTR *aGuid);
|
---|
67 | STDMETHOD(COMGETTER(DhcpEnabled)) (BOOL *aDhcpEnabled);
|
---|
68 | STDMETHOD(COMGETTER(IPAddress)) (BSTR *aIPAddress);
|
---|
69 | STDMETHOD(COMGETTER(NetworkMask)) (BSTR *aNetworkMask);
|
---|
70 | STDMETHOD(COMGETTER(IPV6Supported)) (BOOL *aIPV6Supported);
|
---|
71 | STDMETHOD(COMGETTER(IPV6Address)) (BSTR *aIPV6Address);
|
---|
72 | STDMETHOD(COMGETTER(IPV6NetworkMaskPrefixLength)) (ULONG *aIPV6NetworkMaskPrefixLength);
|
---|
73 | STDMETHOD(COMGETTER(HardwareAddress)) (BSTR *aHardwareAddress);
|
---|
74 | STDMETHOD(COMGETTER(MediumType)) (HostNetworkInterfaceMediumType_T *aType);
|
---|
75 | STDMETHOD(COMGETTER(Status)) (HostNetworkInterfaceStatus_T *aStatus);
|
---|
76 | STDMETHOD(COMGETTER(InterfaceType)) (HostNetworkInterfaceType_T *aType);
|
---|
77 | STDMETHOD(COMGETTER(NetworkName)) (BSTR *aNetworkName);
|
---|
78 |
|
---|
79 | STDMETHOD(EnableStaticIpConfig) (IN_BSTR aIPAddress, IN_BSTR aNetworkMask);
|
---|
80 | STDMETHOD(EnableStaticIpConfigV6) (IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength);
|
---|
81 | STDMETHOD(EnableDynamicIpConfig) ();
|
---|
82 | STDMETHOD(DhcpRediscover) ();
|
---|
83 |
|
---|
84 | // for VirtualBoxSupportErrorInfoImpl
|
---|
85 | static const wchar_t *getComponentName() { return L"HostNetworkInterface"; }
|
---|
86 |
|
---|
87 | HRESULT setVirtualBox(VirtualBox *pVBox);
|
---|
88 | private:
|
---|
89 | const Bstr mInterfaceName;
|
---|
90 | const Guid mGuid;
|
---|
91 | HostNetworkInterfaceType_T mIfType;
|
---|
92 |
|
---|
93 | VirtualBox * const mVBox;
|
---|
94 |
|
---|
95 | struct Data
|
---|
96 | {
|
---|
97 | Data() : IPAddress (0), networkMask (0), dhcpEnabled(FALSE),
|
---|
98 | mediumType (HostNetworkInterfaceMediumType_Unknown),
|
---|
99 | status(HostNetworkInterfaceStatus_Down){}
|
---|
100 |
|
---|
101 | ULONG IPAddress;
|
---|
102 | ULONG networkMask;
|
---|
103 | Bstr IPV6Address;
|
---|
104 | ULONG IPV6NetworkMaskPrefixLength;
|
---|
105 | ULONG realIPAddress;
|
---|
106 | ULONG realNetworkMask;
|
---|
107 | Bstr realIPV6Address;
|
---|
108 | ULONG realIPV6PrefixLength;
|
---|
109 | BOOL dhcpEnabled;
|
---|
110 | Bstr hardwareAddress;
|
---|
111 | HostNetworkInterfaceMediumType_T mediumType;
|
---|
112 | HostNetworkInterfaceStatus_T status;
|
---|
113 | } m;
|
---|
114 |
|
---|
115 | };
|
---|
116 |
|
---|
117 | #endif // ____H_H_HOSTNETWORKINTERFACEIMPL
|
---|
118 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|