VirtualBox

source: vbox/trunk/include/VBox/VBoxNetCfg-win.h@ 96461

Last change on this file since 96461 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.1 KB
Line 
1/* $Id: VBoxNetCfg-win.h 96407 2022-08-22 17:43:14Z vboxsync $ */
2/** @file
3 * Network Configuration API for Windows platforms.
4 */
5
6/*
7 * Copyright (C) 2011-2022 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * The contents of this file may alternatively be used under the terms
26 * of the Common Development and Distribution License Version 1.0
27 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28 * in the VirtualBox distribution, in which case the provisions of the
29 * CDDL are applicable instead of those of the GPL.
30 *
31 * You may elect to license modified versions of this file under the
32 * terms and conditions of either the GPL or the CDDL or both.
33 *
34 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35 */
36
37#ifndef VBOX_INCLUDED_VBoxNetCfg_win_h
38#define VBOX_INCLUDED_VBoxNetCfg_win_h
39#ifndef RT_WITHOUT_PRAGMA_ONCE
40# pragma once
41#endif
42
43/*
44 * Defining VBOXNETCFG_DELAYEDRENAME postpones renaming of host-only adapter
45 * connection during adapter creation after it has been assigned with an
46 * IP address. This hopefully prevents collisions that may happen when we
47 * attempt to rename a connection too early, while its configuration is
48 * still being 'committed' by the network setup engine.
49 */
50#define VBOXNETCFG_DELAYEDRENAME
51
52#include <iprt/win/winsock2.h>
53#include <iprt/win/windows.h>
54#include <Netcfgn.h>
55#include <iprt/win/Setupapi.h>
56#include <VBox/cdefs.h>
57#include <iprt/types.h>
58
59/** @defgroup grp_vboxnetcfgwin The Windows Network Configration Library
60 * @{ */
61
62/** @def VBOXNETCFGWIN_DECL
63 * The usual declaration wrapper.
64 */
65#if 0
66/* enable this in case we include this in a dll*/
67# ifdef IN_VBOXDDU
68# define VBOXNETCFGWIN_DECL(a_Type) DECLEXPORT(a_Type)
69# else
70# define VBOXNETCFGWIN_DECL(a_Type) DECLIMPORT(a_Type)
71# endif
72#else
73/*enable this in case we include this in a static lib*/
74# define VBOXNETCFGWIN_DECL(a_Type) a_Type VBOXCALL
75#endif
76
77RT_C_DECLS_BEGIN
78
79VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinQueryINetCfg(OUT INetCfg **ppNetCfg,
80 IN BOOL fGetWriteLock,
81 IN LPCWSTR pszwClientDescription,
82 IN DWORD cmsTimeout,
83 OUT LPWSTR *ppszwClientDescription);
84VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinReleaseINetCfg(IN INetCfg *pNetCfg, IN BOOL fHasWriteLock);
85VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGetComponentByGuid(IN INetCfg *pNc, IN const GUID *pguidClass,
86 IN const GUID * pComponentGuid, OUT INetCfgComponent **ppncc);
87
88VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetFltInstall(IN INetCfg *pNc, IN LPCWSTR const * apInfFullPaths, IN UINT cInfFullPaths);
89VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetFltUninstall(IN INetCfg *pNc);
90VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetLwfInstall(IN INetCfg *pNc, IN LPCWSTR const pInfFullPath);
91VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetLwfUninstall(IN INetCfg *pNc);
92
93VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetAdpUninstall(IN INetCfg *pNc, IN LPCWSTR pwszId);
94VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetAdpInstall(IN INetCfg *pNc,IN LPCWSTR const pInfFullPath);
95
96#ifndef VBOXNETCFG_DELAYEDRENAME
97VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinCreateHostOnlyNetworkInterface(IN LPCWSTR pInfPath, IN bool bIsInfPathFile, IN BSTR bstrDesiredName,
98 OUT GUID *pGuid, OUT BSTR *lppszName,
99 OUT BSTR *pErrMsg);
100#else /* VBOXNETCFG_DELAYEDRENAME */
101VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinCreateHostOnlyNetworkInterface(IN LPCWSTR pInfPath, IN bool bIsInfPathFile, IN BSTR bstrDesiredName,
102 OUT GUID *pGuid, OUT BSTR *lppszId,
103 OUT BSTR *pErrMsg);
104VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinRenameHostOnlyConnection(IN const GUID *pGuid, IN LPCWSTR pszId, OUT BSTR *pDevName);
105#endif /* VBOXNETCFG_DELAYEDRENAME */
106VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinUpdateHostOnlyNetworkInterface(LPCWSTR pcsxwInf, BOOL *pbRebootRequired, LPCWSTR pcsxwId);
107VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinRemoveHostOnlyNetworkInterface(IN const GUID *pGUID, OUT BSTR *pErrMsg);
108VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinRemoveAllNetDevicesOfId(IN LPCWSTR lpszPnPId);
109
110typedef enum
111{
112 VBOXNECTFGWINPROPCHANGE_TYPE_UNDEFINED = 0,
113 VBOXNECTFGWINPROPCHANGE_TYPE_DISABLE,
114 VBOXNECTFGWINPROPCHANGE_TYPE_ENABLE
115} VBOXNECTFGWINPROPCHANGE_TYPE;
116
117VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinPropChangeAllNetDevicesOfId(IN LPCWSTR lpszPnPId, VBOXNECTFGWINPROPCHANGE_TYPE enmPcType);
118
119VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGenHostOnlyNetworkNetworkIp(OUT PULONG pNetIp, OUT PULONG pNetMask);
120
121typedef struct ADAPTER_SETTINGS
122{
123 ULONG ip;
124 ULONG mask;
125 BOOL bDhcp;
126} ADAPTER_SETTINGS, *PADAPTER_SETTINGS; /**< I'm not prefixed */
127
128VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinEnableStaticIpConfig(IN const GUID *pGuid, IN ULONG ip, IN ULONG mask);
129VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGetAdapterSettings(IN const GUID * pGuid, OUT PADAPTER_SETTINGS pSettings);
130VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinEnableDynamicIpConfig(IN const GUID *pGuid);
131VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinDhcpRediscover(IN const GUID *pGuid);
132
133
134typedef DECLCALLBACKTYPE(void, FNVBOXNETCFGLOGGER,(const char *pszString));
135typedef FNVBOXNETCFGLOGGER *PFNVBOXNETCFGLOGGER;
136VBOXNETCFGWIN_DECL(void) VBoxNetCfgWinSetLogging(IN PFNVBOXNETCFGLOGGER pfnLogger);
137
138RT_C_DECLS_END
139
140/** @} */
141
142#endif /* !VBOX_INCLUDED_VBoxNetCfg_win_h */
143
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