NdisTransferData function

Note   NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.

NdisTransferData forwards a request to copy data received on the underlying NIC into a protocol-supplied packet.

Syntax

VOID NdisTransferData(
  _Out_   PNDIS_STATUS Status,
  _In_    NDIS_HANDLE  NdisBindingHandle,
  _In_    NDIS_HANDLE  MacReceiveContext,
  _In_    UINT         ByteOffset,
  _In_    UINT         BytesToTransfer,
  _Inout_ PNDIS_PACKET Packet,
  _Out_   PUINT        BytesTransferred
);

Parameters

  • Status [out]
    Pointer to a caller-supplied variable that can be one of the following values on return from this function:

    • NDIS_STATUS_SUCCESS
      The requested data has been transferred into the packet at Packet.

    • NDIS_STATUS_PENDING
      The request is being handled asynchronously, and the caller's ProtocolTransferComplete function will be called when it is completed.

    • NDIS_STATUS_RESET_IN_PROGRESS
      The underlying driver is currently resetting its NIC or virtual NIC state. The caller's ProtocolStatus function was or will be called with NDIS_STATUS_RESET_START to indicate that a reset is in progress.

    • NDIS_STATUS_REQUEST_ABORTED
      The caller's binding is being closed.

    • NDIS_STATUS_FAILURE
      The given ByteOffset and/or the given BytesToTransfer is too large.

  • NdisBindingHandle [in]
    Specifies the handle returned by NdisOpenAdapter that identifies the target NIC or the virtual adapter of the next-lower driver to which the caller is bound.

  • MacReceiveContext [in]
    Specifies the underlying driver's handle that was passed as an input parameter to the caller's ProtocolReceive function. The protocol driver must consider this handle to be opaque.

  • ByteOffset [in]
    Specifies the offset from the start of the receive network packet at which to begin the transfer.

  • BytesToTransfer [in]
    Specifies the number of bytes to transfer. This value can be zero.

  • Packet [in, out]
    Pointer to the packet descriptor, provided by the caller, into which the underlying NIC driver is to copy the data.

  • BytesTransferred [out]
    Pointer to a caller-supplied variable in which this function returns the number of bytes actually transferred. The value is invalid if NdisTransferData returns NDIS_STATUS_PENDING at Status.

Return value

None

Remarks

Several protocols can be bound to a single underlying NIC, and each such protocol driver can receive an indication for the same packet. Such a packet is read-only to protocol drivers. Each such driver's ProtocolReceive function determines whether to make itself a copy of the indicated packet with NdisTransferData.

Before calling NdisTransferData, the protocol must allocate a packet descriptor and chain some number of buffer descriptors mapping protocol-allocated buffers into which the underlying driver will copy the data. The protocol also might set up the ProtocolReserved part of its packet descriptor before calling NdisTransferData.

A protocol driver should always allocate its packet descriptors from the packet pool that the driver set up during initialization.

The range requested in a call to NdisTransferData, specified by ByteOffset and BytesToTransfer, should be suitable to the PacketSize passed in to the caller's ProtocolReceive function. Callers of NdisTransferData usually pass a ByteOffset value calculated from the input parameters to ProtocolReceive as ( LookaheadBufferRange + 1). That is, the ProtocolReceive function already consumed the data in the lookahead buffer so it calls NdisTransferData to get the remaining data in the indicated receive packet.

Requirements

Target platform

Universal

Version

Not supported for NDIS 6.0 drivers in Windows Vista. Supported for NDIS 5.1 drivers in Windows Vista and Windows XP.

Header

Ndis.h (include Ndis.h)

Library

Ndis.lib

IRQL

<= DISPATCH_LEVEL

See also

NdisAllocatePacket

NdisMIndicateReceivePacket

NDIS_PACKET

ProtocolReceive

ProtocolReceivePacket

ProtocolTransferDataComplete

 

 

Send comments about this topic to Microsoft