Dela via


VpnChannel.Start Method

Definition

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.

public:
 virtual void Start(IVectorView<HostName ^> ^ assignedClientIPv4list, IVectorView<HostName ^> ^ assignedClientIPv6list, VpnInterfaceId ^ vpnInterfaceId, VpnRouteAssignment ^ routeScope, VpnNamespaceAssignment ^ namespaceScope, unsigned int mtuSize, unsigned int maxFrameSize, bool optimizeForLowCostNetwork, Platform::Object ^ mainOuterTunnelTransport, Platform::Object ^ optionalOuterTunnelTransport) = Start;
/// [Windows.Foundation.Metadata.Overload("Start")]
void Start(IVectorView<HostName> const& assignedClientIPv4list, IVectorView<HostName> const& assignedClientIPv6list, VpnInterfaceId const& vpnInterfaceId, VpnRouteAssignment const& routeScope, VpnNamespaceAssignment const& namespaceScope, uint32_t const& mtuSize, uint32_t const& maxFrameSize, bool const& optimizeForLowCostNetwork, IInspectable const& mainOuterTunnelTransport, IInspectable const& optionalOuterTunnelTransport);
[Windows.Foundation.Metadata.Overload("Start")]
public void Start(IReadOnlyList<HostName> assignedClientIPv4list, IReadOnlyList<HostName> assignedClientIPv6list, VpnInterfaceId vpnInterfaceId, VpnRouteAssignment routeScope, VpnNamespaceAssignment namespaceScope, uint mtuSize, uint maxFrameSize, bool optimizeForLowCostNetwork, object mainOuterTunnelTransport, object optionalOuterTunnelTransport);
function start(assignedClientIPv4list, assignedClientIPv6list, vpnInterfaceId, routeScope, namespaceScope, mtuSize, maxFrameSize, optimizeForLowCostNetwork, mainOuterTunnelTransport, optionalOuterTunnelTransport)
Public Sub Start (assignedClientIPv4list As IReadOnlyList(Of HostName), assignedClientIPv6list As IReadOnlyList(Of HostName), vpnInterfaceId As VpnInterfaceId, routeScope As VpnRouteAssignment, namespaceScope As VpnNamespaceAssignment, mtuSize As UInteger, maxFrameSize As UInteger, optimizeForLowCostNetwork As Boolean, mainOuterTunnelTransport As Object, optionalOuterTunnelTransport As Object)

Parameters

assignedClientIPv4list

IVectorView<HostName>

IReadOnlyList<HostName>

A pointer to an IVectorView< Windows.Networking.HostName *> vector specifying the IPv4 address assigned by the VPN server to the VPN client. The address should be set on the VPN L3 interface. If null, DHCPv4 is used.

assignedClientIPv6list

IVectorView<HostName>

IReadOnlyList<HostName>

A pointer to a Windows.Networking.HostName structure specifying the IPv6 address assigned by the VPN server to the VPN client, and which should be set on the VPN L3 interface. If null, DHCPv6 or RD is used.

vpnInterfaceId
VpnInterfaceId

A pointer to a VpnInterfaceId.

routeScope
VpnRouteAssignment

A pointer to Windows.Networking.VpnRouteAssignment class that represents the routes which should be associated / not associated with the VPN interface

namespaceScope
VpnNamespaceAssignment

A pointer to Windows.Networking.DomainNameAssignment class that represents the list of name prefixes that are associated to the VPN channel, including its DNS and proxy servers.

mtuSize
UInt32

unsigned int

uint32_t

A UINT16 value specifying the MTU size of the VPN L3 network interface. This is also the size of the IVpnPacketBuffers in the Receive pool. This value should be configured to be at most 1400.

maxFrameSize
UInt32

unsigned int

uint32_t

A UINT16 value specifying the max size of the frame defined by the VPN protocol encapsulation without counting the outerTunnelTransport. This is also the size of the IVpnPacketBuffers in the Send pool. This value should be configured as mtuSize + [size of encapsulation headers], and should be <=1500. If it would be greater than 1500 either mtuSize or encapsulation header size should be reduced as the platform limits the framesize to 1500.

optimizeForLowCostNetwork
Boolean

bool

A Boolean specifying whether the VPN framework should monitor and use low cost networks as they are available. If TRUE the VPN framework will invoke the connect() callback to the VPN plug-in to reconnect it whenever the old network was costed and a new low cost network becomes available.

mainOuterTunnelTransport
Object

Platform::Object

IInspectable

An IInspectable object for socket transport. This object can be a Windows.Networking.Sockets.DatagramSocket or a Windows.Networking.Sockets.StreamSocket. This socket controls the connection to the VPN server and will be used to send encapsulated IP packets and receive encapsulated data.

optionalOuterTunnelTransport
Object

Platform::Object

IInspectable

An optional IInspectable object for socket transport. This object can be a Windows.Networking.Sockets.DatagramSocket or a Windows.Networking.Sockets.StreamSocket. This socket controls the connection to the VPN server and will be used to send encapsulated IP packets and receive encapsulated data.

Attributes

Windows requirements

App capabilities
networkingVpnProvider

Remarks

If the function succeeds, the return value is S_OK, otherwise the function will return an error hresult value describing the specific failure. If the plug-in is not connected, the error will be E_ACCESSDENIED.

Note

Any call to this API outside of a connected VPN plug-in will fail, as activity and interactions between the VPN plug-in and the system are controlled by the VPN profile. There can only be one VPN profile per process because the VPN plug-in only has one VPN profile mapped to it, and if a caller were to create more than one profile object, they would all refer to the same settings.

On success the ownership of outertTunnelTransport is transferred by the VPN framework. Calling this method multiple times with the same parameters will have no effect. Calling this method multiple times with variations in parameter values will make sure the channel is updated with the latest values without any disruptions to other properties.

There can only be one VPN channel per process and hence a VPN plug-in can only have one VPN channel assigned to it. The mtuSize must always be smaller than the maxFrameSize.

Applies to