Bewerken

Delen via


NDIS_SWITCH_COPY_NET_BUFFER_LIST_INFO callback function (ndis.h)

The Hyper-V extensible switch extension calls the CopyNetBufferListInfo function to copy the out-of-band (OOB) forwarding context from a source packet's NET_BUFFER_LIST structure to a destination packet's NET_BUFFER_LIST structure. This context includes the extensible switch source port and network adapter information. The extensible switch destination port information can also be copied.

Syntax

NDIS_SWITCH_COPY_NET_BUFFER_LIST_INFO NdisSwitchCopyNetBufferListInfo;

NDIS_STATUS NdisSwitchCopyNetBufferListInfo(
  [in]      NDIS_SWITCH_CONTEXT NdisSwitchContext,
  [in, out] PNET_BUFFER_LIST DestNetBufferList,
  [in]      PNET_BUFFER_LIST SrcNetBufferList,
  [in]      UINT32 Flags
)
{...}

Parameters

[in] NdisSwitchContext

An NDIS_SWITCH_CONTEXT value that contains the handle of the extensible switch module to which the extension is attached. When the extension calls NdisFGetOptionalSwitchHandlers, this handle is returned through the NdisSwitchContext parameter.

[in, out] DestNetBufferList

A pointer to a NET_BUFFER_LIST structure for the destination packet to which the extensible switch forwarding context is copied.

[in] SrcNetBufferList

A pointer to a NET_BUFFER_LIST structure for the source packet from which the extensible switch forwarding context is copied.

[in] Flags

A UINT32 value. When the NDIS_SWITCH_COPY_NBL_INFO_FLAGS_PRESERVE_DESTINATIONS flag is specified, the function copies the extensible switch destination ports from the source packet to the destination packet.

The data that is contained within the source packet's NDIS_SWITCH_FORWARDING_DETAIL_NET_BUFFER_LIST_INFO union is always copied to the extensible switch forwarding context in the destination packet. This data includes the source port identifiers and index of the network adapter connection from which the packet originated. Depending on the number of extensible switch destination ports that are copied to the destination packet, the NumAvailableDestinations member of the NDIS_SWITCH_FORWARDING_DETAIL_NET_BUFFER_LIST_INFO union is updated in the destination packet.

For more information about the forwarding context, see Hyper-V Extensible Switch Forwarding Context.

Return value

If the call succeeds, the function returns NDIS_STATUS_SUCCESS. Otherwise, it returns an NDIS_STATUS_Xxx error code that is defined in Ndis.h.

Remarks

The extensible switch extension calls the CopyNetBufferListInfo function to copy the OOB data from a source packet to a destination packet. This data includes the following:

  • The data from the NetBufferListInfo array of the source packet's NET_BUFFER_LIST structure.
  • The NDIS_SWITCH_FORWARDING_DETAIL_NET_BUFFER_LIST_INFO data from the source packet's extensible switch forwarding context.
  • The data for the extensible switch destination ports from the source packet's extensible switch forwarding context.
    Note  This data is only copied if the NDIS_SWITCH_COPY_NBL_INFO_FLAGS_PRESERVE_DESTINATIONS flag is specified.
     
Before the extension calls CopyNetBufferListInfo, it must prepare the destination packet's NET_BUFFER_LIST structure by following these steps:
  1. The extension must first initialize a NET_BUFFER_LIST structure for the destination packet that is derived from the source packet's NET_BUFFER_LIST structure.

    For example, the extension can call NdisAllocateCloneNetBufferList to create a complete copy of the source packet. The extension can also call NdisAllocateFragmentNetBufferList to create a copy of only a fragment of the source packet. For more information, see Derived NET_BUFFER_LIST Structures.

  2. The extension must call the AllocateNetBufferListForwardingContext function to allocate the extensible switch forwarding context for the destination packet. This data is used to store the OOB extensible switch forwarding information, such as a packet's source and destination ports.
Note  If the extension is creating or cloning the source packet, the extension must have previously called the AllocateNetBufferListForwardingContext function for the packet. Source packets that the extension filters through the extensible switch driver stack already contain an allocated extensible switch forwarding context.
 

Requirements

Requirement Value
Minimum supported client Supported in NDIS 6.30 and later.
Target Platform Desktop
Header ndis.h (include Ndis.h)
IRQL <= DISPATCH_LEVEL

See also

AllocateNetBufferListForwardingContext

NDIS_SWITCH_FORWARDING_DETAIL_NET_BUFFER_LIST_INFO

NET_BUFFER_LIST

NdisAllocateCloneNetBufferList

NdisAllocateFragmentNetBufferList

NdisFGetOptionalSwitchHandlers