1 | /* $Id: HostNetworkInterfaceImpl.h 48101 2013-08-27 18:23:47Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | *
|
---|
5 | * VirtualBox COM class implementation
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2006-2013 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 | VBOX_SCRIPTABLE_IMPL(IHostNetworkInterface)
|
---|
35 | {
|
---|
36 | public:
|
---|
37 |
|
---|
38 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(HostNetworkInterface, IHostNetworkInterface)
|
---|
39 |
|
---|
40 | DECLARE_NOT_AGGREGATABLE(HostNetworkInterface)
|
---|
41 |
|
---|
42 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
43 |
|
---|
44 | BEGIN_COM_MAP(HostNetworkInterface)
|
---|
45 | VBOX_DEFAULT_INTERFACE_ENTRIES(IHostNetworkInterface)
|
---|
46 | END_COM_MAP()
|
---|
47 |
|
---|
48 | DECLARE_EMPTY_CTOR_DTOR(HostNetworkInterface)
|
---|
49 |
|
---|
50 | HRESULT FinalConstruct();
|
---|
51 | void FinalRelease();
|
---|
52 |
|
---|
53 | // public initializer/uninitializer for internal purposes only
|
---|
54 | HRESULT init(Bstr interfaceName, Bstr shortName, Guid guid, HostNetworkInterfaceType_T ifType);
|
---|
55 | #ifdef VBOX_WITH_HOSTNETIF_API
|
---|
56 | HRESULT init(Bstr aInterfaceName, HostNetworkInterfaceType_T ifType, struct NETIFINFO *pIfs);
|
---|
57 | HRESULT updateConfig();
|
---|
58 | #endif
|
---|
59 |
|
---|
60 | // IHostNetworkInterface properties
|
---|
61 | STDMETHOD(COMGETTER(Name))(BSTR *aInterfaceName);
|
---|
62 | STDMETHOD(COMGETTER(ShortName))(BSTR *aShortName);
|
---|
63 | STDMETHOD(COMGETTER(Id))(BSTR *aGuid);
|
---|
64 | STDMETHOD(COMGETTER(DHCPEnabled))(BOOL *aDHCPEnabled);
|
---|
65 | STDMETHOD(COMGETTER(IPAddress))(BSTR *aIPAddress);
|
---|
66 | STDMETHOD(COMGETTER(NetworkMask))(BSTR *aNetworkMask);
|
---|
67 | STDMETHOD(COMGETTER(IPV6Supported))(BOOL *aIPV6Supported);
|
---|
68 | STDMETHOD(COMGETTER(IPV6Address))(BSTR *aIPV6Address);
|
---|
69 | STDMETHOD(COMGETTER(IPV6NetworkMaskPrefixLength))(ULONG *aIPV6NetworkMaskPrefixLength);
|
---|
70 | STDMETHOD(COMGETTER(HardwareAddress))(BSTR *aHardwareAddress);
|
---|
71 | STDMETHOD(COMGETTER(MediumType))(HostNetworkInterfaceMediumType_T *aType);
|
---|
72 | STDMETHOD(COMGETTER(Status))(HostNetworkInterfaceStatus_T *aStatus);
|
---|
73 | STDMETHOD(COMGETTER(InterfaceType))(HostNetworkInterfaceType_T *aType);
|
---|
74 | STDMETHOD(COMGETTER(NetworkName))(BSTR *aNetworkName);
|
---|
75 |
|
---|
76 | STDMETHOD(EnableStaticIPConfig)(IN_BSTR aIPAddress, IN_BSTR aNetworkMask);
|
---|
77 | STDMETHOD(EnableStaticIPConfigV6)(IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength);
|
---|
78 | STDMETHOD(EnableDynamicIPConfig)();
|
---|
79 | STDMETHOD(DHCPRediscover)();
|
---|
80 |
|
---|
81 | HRESULT setVirtualBox(VirtualBox *pVBox);
|
---|
82 | #ifdef VBOX_WITH_RESOURCE_USAGE_API
|
---|
83 | void registerMetrics(PerformanceCollector *aCollector, ComPtr<IUnknown> objptr);
|
---|
84 | void unregisterMetrics(PerformanceCollector *aCollector, ComPtr<IUnknown> objptr);
|
---|
85 | #endif
|
---|
86 |
|
---|
87 | private:
|
---|
88 | Bstr composeNetworkName(const Utf8Str szShortName);
|
---|
89 |
|
---|
90 | const Bstr mInterfaceName;
|
---|
91 | const Guid mGuid;
|
---|
92 | const Bstr mNetworkName;
|
---|
93 | const Bstr mShortName;
|
---|
94 | HostNetworkInterfaceType_T mIfType;
|
---|
95 |
|
---|
96 | VirtualBox * const mVBox;
|
---|
97 |
|
---|
98 | struct Data
|
---|
99 | {
|
---|
100 | Data() : IPAddress(0), networkMask(0), dhcpEnabled(FALSE),
|
---|
101 | mediumType(HostNetworkInterfaceMediumType_Unknown),
|
---|
102 | status(HostNetworkInterfaceStatus_Down){}
|
---|
103 |
|
---|
104 | ULONG IPAddress;
|
---|
105 | ULONG networkMask;
|
---|
106 | Bstr IPV6Address;
|
---|
107 | ULONG IPV6NetworkMaskPrefixLength;
|
---|
108 | ULONG realIPAddress;
|
---|
109 | ULONG realNetworkMask;
|
---|
110 | Bstr realIPV6Address;
|
---|
111 | ULONG realIPV6PrefixLength;
|
---|
112 | BOOL dhcpEnabled;
|
---|
113 | Bstr hardwareAddress;
|
---|
114 | HostNetworkInterfaceMediumType_T mediumType;
|
---|
115 | HostNetworkInterfaceStatus_T status;
|
---|
116 | ULONG speedMbits;
|
---|
117 | } m;
|
---|
118 |
|
---|
119 | };
|
---|
120 |
|
---|
121 | typedef std::list<ComObjPtr<HostNetworkInterface> > HostNetworkInterfaceList;
|
---|
122 |
|
---|
123 | #endif // ____H_H_HOSTNETWORKINTERFACEIMPL
|
---|
124 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|