Share via


VpnChannel Class

Definition

Provides methods to create and destroy a VPN channel, and methods to perform buffer management. A VPN channel is the object in the system that links the network traffic data flow between the VPN plug-in's VPN server socket and the client machine network stack.

public ref class VpnChannel sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
class VpnChannel final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
public sealed class VpnChannel
Public NotInheritable Class VpnChannel
Inheritance
Object Platform::Object IInspectable VpnChannel
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)
App capabilities
networkingVpnProvider

Remarks

Version history

Windows version SDK version Value added
1803 17134 AddAndAssociateTransport
1803 17134 CurrentRequestTransportContext
1803 17134 GetSlotTypeForTransportContext
1803 17134 ReplaceAndAssociateTransport
1803 17134 StartReconnectingTransport
1803 17134 StartWithTrafficFilter(IEnumerable<HostName>,IEnumerable<HostName>,VpnInterfaceId,VpnRouteAssignment,VpnDomainNameAssignment,UInt32,UInt32,Boolean,IEnumerableIEnumerable<Object>,VpnTrafficFilterAssignment)

Properties

Configuration

Gets or sets a VpnChannelConfiguration object corresponding to the configuration of the VpnChannel and which dictates how to establish the communication with the VPN server.

CurrentRequestTransportContext

Gets the transport context object in use, for example the name of a host or server.

Id

Gets the unique instance ID of a VPN channel. This can be used to simplify demuxing operations between two VPN connection instances.

PlugInContext

Gets or sets a context object that VPN plug-ins can use to associate their internal state with a VpnChannel object for later use while the session is in progress.

SystemHealth

Gets the statement of health of the client machine.

Methods

ActivateForeground(String, ValueSet)

Activates the VPN app in the foreground. This is often used to let the user enter credentials. You can call ActivateForeground only from your implementation of IVpnPlugin.Connect. While the app is in the foreground, the regular Connect timeout is paused.

The ActivateForeground call will be cancelled if there's a long pause (about 10 minutes). If unable to launch, then the plugin should ideally support an authentication method that doesn't need user interface (UI).

Intended to support web-based authentication schemes such as Security Assertion Markup Language (SAML) and Azure Active Directory (AAD) authentication.

AddAndAssociateTransport(Object, Object)

Prepares, marks, and creates the transport for use by the VPN framework as a transport link communicating the VPN plug-in to the VPN server. This call must be performed before any other operations related to the VPN framework APIs.

AppendVpnReceivePacketBuffer(VpnPacketBuffer)

Appends a receive VpnPacketBuffer object to the channel.

AppendVpnSendPacketBuffer(VpnPacketBuffer)

Appends a send VpnPacketBuffer object to the channel.

AssociateTransport(Object, Object)

Prepares and marks the transport for use by the VPN framework as a transport link communicating the VPN plug-in to the VPN server. This call must be performed before any other operations related to the VPN framework APIs.

FlushVpnReceivePacketBuffers()

Flushes any appended receive packet buffers. See AppendVpnReceivePacketBuffer.

FlushVpnSendPacketBuffers()

Flushes any appended send packet buffers. See AppendVpnSendPacketBuffer.

GetSlotTypeForTransportContext(Object)

Retrieves the slot type (hardware or software) for the specified transport context object.

GetVpnReceivePacketBuffer()

Requests a VpnPacketBuffer object from the receive packet buffer pool to be used in the decapsulation or injection of a received packet from the VPN server into the local network stack

GetVpnSendPacketBuffer()

Retrieves a VpnPacketBuffer object from the send packet buffer pool to use in encapsulation and transmission of a data packet from the client network stack to the VPN server.

LogDiagnosticMessage(String)

Writes a diagnostic message to the system log.

ProcessEventAsync(Object, Object)

Processes any pending VpnChannel events.

ReplaceAndAssociateTransport(Object, Object)

Replaces an existing transport with a new one for use by the VPN framework as a transport link communicating the VPN plug-in to the VPN server.

RequestCredentials(VpnCredentialType, Boolean, Boolean, Certificate)

Request the VPN platform to collect credentials from the user. The plug-in can specify the type and form of credentials to collect. The result is an object containing the main credentials depending on the type and the secondary credentials for change and expiration cases.

RequestCredentialsAsync(VpnCredentialType, UInt32, Certificate)

VPN platform to collect credentials from the user. If user interaction is required to obtain a credential or consent, the platform provides the necessary user interaction. A VPN plug-in must request credentials before using any type of credential, even if the intent is not to invoke user interaction for it.

RequestCredentialsAsync(VpnCredentialType, UInt32)

Requests the VPN platform to collect credentials from the user. The plug-in can specify the type and form of credentials to collect. The result is an object containing the main credentials depending on the type, and the secondary credentials for change and expiration cases.

RequestCredentialsAsync(VpnCredentialType)

Requests the VPN platform to collect credentials of a given credential type from the user.

RequestCustomPrompt(IVectorView<IVpnCustomPrompt>)

Not supported.

RequestCustomPromptAsync(IVectorView<IVpnCustomPromptElement>)

Requests information from the user by presenting a prompt. Allows the use of prompt elements that can be mixed to construct a full prompt to the user. Input provided by the user is returned to the caller in the objects specified.

RequestVpnPacketBuffer(VpnDataPathType, VpnPacketBuffer)

Requests an IVpnPacketBuffer from the specified pool. There is one IVpnPacketBuffer pool for the send path and another IVpnPacketBuffer pool for the receive path.

SetAllowedSslTlsVersions(Object, Boolean)

Not supported.

SetErrorMessage(String)

Not supported.

Start(IVectorView<HostName>, IVectorView<HostName>, VpnInterfaceId, VpnRouteAssignment, VpnNamespaceAssignment, UInt32, UInt32, Boolean, Object, Object)

Creates the VPN channel to be used by the VPN plug-in. It also creates an L3 network interface for applications in the client machine to be able to see the corporate network.

StartExistingTransports(IVectorView<HostName>, IVectorView<HostName>, VpnInterfaceId, VpnRouteAssignment, VpnDomainNameAssignment, UInt32, UInt32, Boolean)

Creates the VPN channel to be used by the VPN plug-in. It also creates an L3 network interface for applications in the client machine to be able to see the corporate network.

StartReconnectingTransport(Object, Object)

Reconnect the socket transport. Transport and transport context are the only parameters that can be changed on a socket transport reconnection.

Important

This API is not implemented, and we recommend that you do not call it.

StartWithMainTransport(IVectorView<HostName>, IVectorView<HostName>, VpnInterfaceId, VpnRouteAssignment, VpnDomainNameAssignment, UInt32, UInt32, Boolean, Object)

Creates the VPN channel to be used by the VPN plug-in. It also creates an L3 network interface for applications in the client machine to be able to see the corporate network.

StartWithTrafficFilter(IIterable<HostName>, IIterable<HostName>, VpnInterfaceId, VpnRouteAssignment, VpnDomainNameAssignment, UInt32, UInt32, Boolean, IIterable<Object>, VpnTrafficFilterAssignment)

Creates the VPN channel for an arbitrary numbers of transports to be used by the VPN plug-in. It also creates an L3 network interface for applications in the client machine to be able to see the corporate network. It allows the specification of traffic filters to use in per-app VPN scenarios.

StartWithTrafficFilter(IVectorView<HostName>, IVectorView<HostName>, VpnInterfaceId, VpnRouteAssignment, VpnDomainNameAssignment, UInt32, UInt32, Boolean, Object, Object, VpnTrafficFilterAssignment)

Creates the VPN channel to be used by the VPN plug-in. It also creates an L3 network interface for applications in the client machine to be able to see the corporate network. It allows the specification of traffic filters to use in per-app VPN scenarios.

Stop()

Destroys a previously established VPN channel object. Disassociates and closes the outerTunnelTransport connection to the VPN server.

TerminateConnection(String)

Allows a VPN plugin to indicate an error message and terminate the connection attempt performed inside the IVpnPlugin.Connect method. Should not be called on reconnect cases.

Events

ActivityChange

Not supported.

ActivityStateChange

Event raised when the channel's activity state has changed. Used by VPN plug-ins to determine whether the channel is active with traffic or idle.

Applies to