VirtualBox

source: vbox/trunk/src/VBox/Main/include/HostNetworkInterfaceImpl.h@ 88539

Last change on this file since 88539 was 82968, checked in by vboxsync, 5 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.6 KB
Line 
1/* $Id: HostNetworkInterfaceImpl.h 82968 2020-02-04 10:35:17Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class implementation
6 */
7
8/*
9 * Copyright (C) 2006-2020 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 MAIN_INCLUDED_HostNetworkInterfaceImpl_h
21#define MAIN_INCLUDED_HostNetworkInterfaceImpl_h
22#ifndef RT_WITHOUT_PRAGMA_ONCE
23# pragma once
24#endif
25
26#include "HostNetworkInterfaceWrap.h"
27
28#ifdef VBOX_WITH_HOSTNETIF_API
29struct NETIFINFO;
30#endif
31
32class PerformanceCollector;
33
34class ATL_NO_VTABLE HostNetworkInterface :
35 public HostNetworkInterfaceWrap
36{
37public:
38
39 DECLARE_EMPTY_CTOR_DTOR(HostNetworkInterface)
40
41 HRESULT FinalConstruct();
42 void FinalRelease();
43
44 // public initializer/uninitializer for internal purposes only
45 HRESULT init(Utf8Str aInterfaceName, Utf8Str aShortName, Guid aGuid, HostNetworkInterfaceType_T ifType);
46#ifdef VBOX_WITH_HOSTNETIF_API
47 HRESULT init(Utf8Str aInterfaceName, HostNetworkInterfaceType_T ifType, struct NETIFINFO *pIfs);
48 HRESULT updateConfig();
49#endif
50
51 HRESULT i_setVirtualBox(VirtualBox *pVirtualBox);
52#ifdef RT_OS_WINDOWS
53 HRESULT i_updatePersistentConfig();
54#endif /* RT_OS_WINDOWS */
55
56#ifdef VBOX_WITH_RESOURCE_USAGE_API
57 void i_registerMetrics(PerformanceCollector *aCollector, ComPtr<IUnknown> objptr);
58 void i_unregisterMetrics(PerformanceCollector *aCollector, ComPtr<IUnknown> objptr);
59#endif
60
61private:
62
63 // Wrapped IHostNetworkInterface properties
64 HRESULT getName(com::Utf8Str &aName);
65 HRESULT getShortName(com::Utf8Str &aShortName);
66 HRESULT getId(com::Guid &aGuiId);
67 HRESULT getDHCPEnabled(BOOL *aDHCPEnabled);
68 HRESULT getIPAddress(com::Utf8Str &aIPAddress);
69 HRESULT getNetworkMask(com::Utf8Str &aNetworkMask);
70 HRESULT getIPV6Supported(BOOL *aIPV6Supported);
71 HRESULT getIPV6Address(com::Utf8Str &aIPV6Address);
72 HRESULT getIPV6NetworkMaskPrefixLength(ULONG *aIPV6NetworkMaskPrefixLength);
73 HRESULT getHardwareAddress(com::Utf8Str &aHardwareAddress);
74 HRESULT getMediumType(HostNetworkInterfaceMediumType_T *aType);
75 HRESULT getStatus(HostNetworkInterfaceStatus_T *aStatus);
76 HRESULT getInterfaceType(HostNetworkInterfaceType_T *aType);
77 HRESULT getNetworkName(com::Utf8Str &aNetworkName);
78 HRESULT getWireless(BOOL *aWireless);
79
80 // Wrapped IHostNetworkInterface methods
81 HRESULT enableStaticIPConfig(const com::Utf8Str &aIPAddress,
82 const com::Utf8Str &aNetworkMask);
83 HRESULT enableStaticIPConfigV6(const com::Utf8Str &aIPV6Address,
84 ULONG aIPV6NetworkMaskPrefixLength);
85 HRESULT enableDynamicIPConfig();
86 HRESULT dHCPRediscover();
87
88 Utf8Str i_composeNetworkName(const Utf8Str szShortName);
89
90#if defined(RT_OS_WINDOWS)
91 HRESULT eraseAdapterConfigParameter(const char *szParamName);
92 HRESULT saveAdapterConfigParameter(const char *szParamName, const Utf8Str& strValue);
93 HRESULT saveAdapterConfigIPv4Dhcp();
94 HRESULT saveAdapterConfigIPv4(ULONG addr, ULONG mask);
95 HRESULT saveAdapterConfigIPv6(const Utf8Str& addr, ULONG prefix);
96 HRESULT saveAdapterConfig();
97 bool isInConfigFile();
98#endif /* defined(RT_OS_WINDOWS) */
99
100 const Utf8Str mInterfaceName;
101 const Guid mGuid;
102 const Utf8Str mNetworkName;
103 const Utf8Str mShortName;
104 HostNetworkInterfaceType_T mIfType;
105
106 VirtualBox * const mVirtualBox;
107
108 struct Data
109 {
110 Data() : IPAddress(0), networkMask(0), dhcpEnabled(FALSE),
111 mediumType(HostNetworkInterfaceMediumType_Unknown),
112 status(HostNetworkInterfaceStatus_Down), wireless(FALSE){}
113
114 ULONG IPAddress;
115 ULONG networkMask;
116 Utf8Str IPV6Address;
117 ULONG IPV6NetworkMaskPrefixLength;
118 ULONG realIPAddress;
119 ULONG realNetworkMask;
120 Utf8Str realIPV6Address;
121 ULONG realIPV6PrefixLength;
122 BOOL dhcpEnabled;
123 Utf8Str hardwareAddress;
124 HostNetworkInterfaceMediumType_T mediumType;
125 HostNetworkInterfaceStatus_T status;
126 ULONG speedMbits;
127 BOOL wireless;
128 } m;
129
130};
131
132typedef std::list<ComObjPtr<HostNetworkInterface> > HostNetworkInterfaceList;
133
134#endif /* !MAIN_INCLUDED_HostNetworkInterfaceImpl_h */
135/* 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