Udostępnij za pośrednictwem


VpnChannel.RequestVpnPacketBuffer(VpnDataPathType, VpnPacketBuffer) Method

Definition

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

public:
 virtual void RequestVpnPacketBuffer(VpnDataPathType type, [Out] VpnPacketBuffer ^ & vpnPacketBuffer) = RequestVpnPacketBuffer;
void RequestVpnPacketBuffer(VpnDataPathType const& type, [Out] VpnPacketBuffer const& & vpnPacketBuffer);
public void RequestVpnPacketBuffer(VpnDataPathType type, out VpnPacketBuffer vpnPacketBuffer);
Public Sub RequestVpnPacketBuffer (type As VpnDataPathType, ByRef vpnPacketBuffer As VpnPacketBuffer)

Parameters

type
VpnDataPathType

An enum value indicating which buffer pool to pick a buffer from. If the buffer requested for the packet to be sent to the VPN server, pick the Send enum type. If the buffer requested is for a received L3 decapsulated packet ready to be injected into the client network stack, pick the Receive enum type.

vpnPacketBuffer
VpnPacketBuffer

An IVpnPacketBuffer object returned from the specified buffer pool.

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.If there is no more memory available the method will return E_OUTOFMEMORY.

Any IVpnPacketBuffer object requested by the plugin must eventually be returned to the VPN platform (i.e. via IVpnPlugIn.Encapsulate or IVpnPlugin.Decapsulate). Otherwise the plugin may be unable to request new buffers until the outstanding buffers have been returned.

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.

Applies to

See also

  • <xref:Windows.Networking.Vpn.VpnChannel.GetVpnSendPacketBuffer+or+a+receive+path+buffer+via+M%3aWindows.Networking.Vpn.VpnChannel.GetVpnReceivePacketBuffer.>