1 | /* $Id: HostNetworkInterfaceImpl.h 69498 2017-10-28 15:07:25Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | *
|
---|
5 | * VirtualBox COM class implementation
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2006-2016 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 "HostNetworkInterfaceWrap.h"
|
---|
24 |
|
---|
25 | #ifdef VBOX_WITH_HOSTNETIF_API
|
---|
26 | struct NETIFINFO;
|
---|
27 | #endif
|
---|
28 |
|
---|
29 | class PerformanceCollector;
|
---|
30 |
|
---|
31 | class ATL_NO_VTABLE HostNetworkInterface :
|
---|
32 | public HostNetworkInterfaceWrap
|
---|
33 | {
|
---|
34 | public:
|
---|
35 |
|
---|
36 | DECLARE_EMPTY_CTOR_DTOR(HostNetworkInterface)
|
---|
37 |
|
---|
38 | HRESULT FinalConstruct();
|
---|
39 | void FinalRelease();
|
---|
40 |
|
---|
41 | // public initializer/uninitializer for internal purposes only
|
---|
42 | HRESULT init(Bstr aInterfaceName, Bstr aShortName, Guid aGuid, HostNetworkInterfaceType_T ifType);
|
---|
43 | #ifdef VBOX_WITH_HOSTNETIF_API
|
---|
44 | HRESULT init(Bstr aInterfaceName, HostNetworkInterfaceType_T ifType, struct NETIFINFO *pIfs);
|
---|
45 | HRESULT updateConfig();
|
---|
46 | #endif
|
---|
47 |
|
---|
48 | HRESULT i_setVirtualBox(VirtualBox *pVirtualBox);
|
---|
49 |
|
---|
50 | #ifdef VBOX_WITH_RESOURCE_USAGE_API
|
---|
51 | void i_registerMetrics(PerformanceCollector *aCollector, ComPtr<IUnknown> objptr);
|
---|
52 | void i_unregisterMetrics(PerformanceCollector *aCollector, ComPtr<IUnknown> objptr);
|
---|
53 | #endif
|
---|
54 |
|
---|
55 | private:
|
---|
56 |
|
---|
57 | // Wrapped IHostNetworkInterface properties
|
---|
58 | HRESULT getName(com::Utf8Str &aName);
|
---|
59 | HRESULT getShortName(com::Utf8Str &aShortName);
|
---|
60 | HRESULT getId(com::Guid &aGuiId);
|
---|
61 | HRESULT getDHCPEnabled(BOOL *aDHCPEnabled);
|
---|
62 | HRESULT getIPAddress(com::Utf8Str &aIPAddress);
|
---|
63 | HRESULT getNetworkMask(com::Utf8Str &aNetworkMask);
|
---|
64 | HRESULT getIPV6Supported(BOOL *aIPV6Supported);
|
---|
65 | HRESULT getIPV6Address(com::Utf8Str &aIPV6Address);
|
---|
66 | HRESULT getIPV6NetworkMaskPrefixLength(ULONG *aIPV6NetworkMaskPrefixLength);
|
---|
67 | HRESULT getHardwareAddress(com::Utf8Str &aHardwareAddress);
|
---|
68 | HRESULT getMediumType(HostNetworkInterfaceMediumType_T *aType);
|
---|
69 | HRESULT getStatus(HostNetworkInterfaceStatus_T *aStatus);
|
---|
70 | HRESULT getInterfaceType(HostNetworkInterfaceType_T *aType);
|
---|
71 | HRESULT getNetworkName(com::Utf8Str &aNetworkName);
|
---|
72 | HRESULT getWireless(BOOL *aWireless);
|
---|
73 |
|
---|
74 | // Wrapped IHostNetworkInterface methods
|
---|
75 | HRESULT enableStaticIPConfig(const com::Utf8Str &aIPAddress,
|
---|
76 | const com::Utf8Str &aNetworkMask);
|
---|
77 | HRESULT enableStaticIPConfigV6(const com::Utf8Str &aIPV6Address,
|
---|
78 | ULONG aIPV6NetworkMaskPrefixLength);
|
---|
79 | HRESULT enableDynamicIPConfig();
|
---|
80 | HRESULT dHCPRediscover();
|
---|
81 |
|
---|
82 | Bstr i_composeNetworkName(const Utf8Str szShortName);
|
---|
83 |
|
---|
84 | const Bstr mInterfaceName;
|
---|
85 | const Guid mGuid;
|
---|
86 | const Bstr mNetworkName;
|
---|
87 | const Bstr mShortName;
|
---|
88 | HostNetworkInterfaceType_T mIfType;
|
---|
89 |
|
---|
90 | VirtualBox * const mVirtualBox;
|
---|
91 |
|
---|
92 | struct Data
|
---|
93 | {
|
---|
94 | Data() : IPAddress(0), networkMask(0), dhcpEnabled(FALSE),
|
---|
95 | mediumType(HostNetworkInterfaceMediumType_Unknown),
|
---|
96 | status(HostNetworkInterfaceStatus_Down), wireless(FALSE){}
|
---|
97 |
|
---|
98 | ULONG IPAddress;
|
---|
99 | ULONG networkMask;
|
---|
100 | Bstr IPV6Address;
|
---|
101 | ULONG IPV6NetworkMaskPrefixLength;
|
---|
102 | ULONG realIPAddress;
|
---|
103 | ULONG realNetworkMask;
|
---|
104 | Bstr realIPV6Address;
|
---|
105 | ULONG realIPV6PrefixLength;
|
---|
106 | BOOL dhcpEnabled;
|
---|
107 | Bstr hardwareAddress;
|
---|
108 | HostNetworkInterfaceMediumType_T mediumType;
|
---|
109 | HostNetworkInterfaceStatus_T status;
|
---|
110 | ULONG speedMbits;
|
---|
111 | BOOL wireless;
|
---|
112 | } m;
|
---|
113 |
|
---|
114 | };
|
---|
115 |
|
---|
116 | typedef std::list<ComObjPtr<HostNetworkInterface> > HostNetworkInterfaceList;
|
---|
117 |
|
---|
118 | #endif // ____H_H_HOSTNETWORKINTERFACEIMPL
|
---|
119 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|