次の方法で共有


FwpsInjectForwardAsync0 (Compact 2013)

3/26/2014

This function injects packet data into the forwarding data path.

Syntax

NTSTATUS NTAPI
  FwpsInjectForwardAsync0(
    IN HANDLE  injectionHandle,
    IN OPTIONAL HANDLE  injectionContext,
    IN UINT32  flags,
    IN ADDRESS_FAMILY  addressFamily,
    IN COMPARTMENT_ID  compartmentId,
    IN IF_INDEX  interfaceIndex,
    IN OUT NET_BUFFER_LIST  *netBufferList
    IN FWPS_INJECT_COMPLETE0  completionFn,
    IN OPTIONAL HANDLE  completionContext
    );

Parameters

  • injectionContext
    An optional handle to the injection context. If it is specified, it can be obtained by calling the FwpsQueryPacketInjectionState0 function when the packet injection state FWPS_PACKET_INJECTION_STATE is FWPS_PACKET_INJECTED_BY_SELF or FWPS_PACKET_PREVIOUSLY_INJECTED_BY_SELF
  • flags
    Reserved. Callout drivers must set this parameter to zero
  • addressFamily
    The address family for which the handle is being created. This can be one of the following address families:

    • AF_INET: The IPv4 address family
    • AF_INET6: The IPv6 address family
  • compartmentId
    The identifier of the routing compartment into which the packet data is injected, specified as a COMPARTMENT_ID type. This identifier is provided to a callout through the compartmentId member of the FWPS_INCOMING_METADATA_VALUES0 structure that is passed to the callout's classifyFn callout function. If the compartmentId member is available to callouts, FWPS_METADATA_FIELD_COMPARTMENT_ID is set in the currentMetadataValues member. Otherwise, set this parameter to UNSPECIFIED_COMPARTMENT_ID
  • interfaceIndex
    The index of the interface on which the packet data is to be sent. If the packet is to be injected into the same interface as the original packet, a callout driver should use the value of the interface index as one of the incoming data values to its classifyFn function
  • completionFn
    A pointer to a completionFn callout function that is provided by the callout driver. The filter engine calls this function after the packet data, described by the netBufferList parameter, has been injected into the network stack.
  • completionContext
    A pointer to a callout driver-provided context that is passed to the callout function pointed to by the completionFn parameter. This parameter is optional and can be NULL

Return Value

The FwpsInjectForwardAsync0 function returns one of the following NTSTATUS codes:

Value

Description

STATUS_SUCCESS

The packet data injection was initiated successfully. The filter engine will call the completion function after the filter engine has completed injecting the packet data into the network stack. If a subsequent error occurs, the Status member of the completed NET_BUFFER_LIST structure will indicate the reason for failure.

STATUS_FWP_TCPIP_NOT_READY

The TCP/IP network stack is not ready to accept injection of packet data.

STATUS_FWP_INJECT_HANDLE_CLOSING

The injection handle is being closed.

Other status codes

An error occurred.

Remarks

A callout driver calls the FwpsInjectForwardAsync0 function to insert packet data or a packet fragment into the forwarding data path.

This function can execute asynchronously. Callout drivers usually insert data into the network stack when modifying packet data. A packet or packet fragment injected with this function is not indicated to any WFP layer for filtering.

If the return value is not STATUS_SUCCESS, the completion function is not called. In this case, the NET_BUFFER_LIST pointed to by netBufferList must be freed by a call to FwpsFreeNetBufferList0 or FwpsFreeCloneNetBufferList0.

IP packets or fragments can be cloned, modified, and injected back into the network stack. However, a fragment group must be reassembled by the callout driver as a single NET_BUFFER_LIST before it can be reinjected.

Requirements

Header

fwpsk.h

See Also

Reference

Functions Called by Callout Drivers
FWPS_INCOMING_METADATA_VALUES0
classifyFn
NET_BUFFER_LIST
FwpsAllocateCloneNetBufferList0
FwpsAllocateNetBufferAndNetBufferList0
completionFn
FwpsInjectionHandleCreate0
FwpsInjectionHandleDestroy0
WFP Callout Driver Functions