1 | /* $Id: HostNetworkInterfaceImpl.h 62485 2016-07-22 18:36:43Z 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 interfaceName, Bstr shortName, Guid guid, 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 |
|
---|
73 | // Wrapped IHostNetworkInterface methods
|
---|
74 | HRESULT enableStaticIPConfig(const com::Utf8Str &aIPAddress,
|
---|
75 | const com::Utf8Str &aNetworkMask);
|
---|
76 | HRESULT enableStaticIPConfigV6(const com::Utf8Str &aIPV6Address,
|
---|
77 | ULONG aIPV6NetworkMaskPrefixLength);
|
---|
78 | HRESULT enableDynamicIPConfig();
|
---|
79 | HRESULT dHCPRediscover();
|
---|
80 |
|
---|
81 | Bstr i_composeNetworkName(const Utf8Str szShortName);
|
---|
82 |
|
---|
83 | const Bstr mInterfaceName;
|
---|
84 | const Guid mGuid;
|
---|
85 | const Bstr mNetworkName;
|
---|
86 | const Bstr mShortName;
|
---|
87 | HostNetworkInterfaceType_T mIfType;
|
---|
88 |
|
---|
89 | VirtualBox * const mVirtualBox;
|
---|
90 |
|
---|
91 | struct Data
|
---|
92 | {
|
---|
93 | Data() : IPAddress(0), networkMask(0), dhcpEnabled(FALSE),
|
---|
94 | mediumType(HostNetworkInterfaceMediumType_Unknown),
|
---|
95 | status(HostNetworkInterfaceStatus_Down){}
|
---|
96 |
|
---|
97 | ULONG IPAddress;
|
---|
98 | ULONG networkMask;
|
---|
99 | Bstr IPV6Address;
|
---|
100 | ULONG IPV6NetworkMaskPrefixLength;
|
---|
101 | ULONG realIPAddress;
|
---|
102 | ULONG realNetworkMask;
|
---|
103 | Bstr realIPV6Address;
|
---|
104 | ULONG realIPV6PrefixLength;
|
---|
105 | BOOL dhcpEnabled;
|
---|
106 | Bstr hardwareAddress;
|
---|
107 | HostNetworkInterfaceMediumType_T mediumType;
|
---|
108 | HostNetworkInterfaceStatus_T status;
|
---|
109 | ULONG speedMbits;
|
---|
110 | } m;
|
---|
111 |
|
---|
112 | };
|
---|
113 |
|
---|
114 | typedef std::list<ComObjPtr<HostNetworkInterface> > HostNetworkInterfaceList;
|
---|
115 |
|
---|
116 | #endif // ____H_H_HOSTNETWORKINTERFACEIMPL
|
---|
117 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|