VirtualBox

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

Last change on this file since 77921 was 77804, checked in by vboxsync, 6 years ago

NetAdp/Win: (bugref:9409) Store host-only adapter configuration in extra data. Create missing adapters when listing/creating/removing adapters.

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