次の方法で共有


NdisMEthIndicateReceive (Windows Embedded CE 6.0)

1/6/2010

This function notifies NDIS that an Ethernet packet, or some initial look-ahead portion of the packet, has arrived so that NDIS can forward the packet to bound protocols.

Syntax

VOID NdisMEthIndicateReceive(
  NDIS_HANDLE MiniportAdapterHandle,
  NDIS_HANDLE MiniportReceiveContext,
  PVOID HeaderBuffer,
  UINT HeaderBufferSize,
  PVOID LookaheadBuffer,
  UINT LookaheadBufferSize,
  UINT PacketSize
);

Parameters

  • MiniportReceiveContext
    [in] Context handle supplied by the caller. NDIS returns this handle as an input parameter to the MiniportTransferData function if it is called. The miniport can use the context area designated by this handle to determine which packet is being received on which NIC.
  • HeaderBuffer
    [in] Specifies the base virtual address of the buffered packet header.
  • HeaderBufferSize
    [in] Specifies the size, in bytes, of the packet header.
  • LookaheadBuffer
    [in] Specifies the base virtual address of a buffer containing the initial LookaheadBufferSize bytes of the data in the packet.
  • LookaheadBufferSize
    [in] Specifies the size, in bytes, of the look-ahead buffer. This value must be at least as large as the look-ahead size set when the MiniportSetInformation function was called with OID_GEN_CURRENT_LOOKAHEAD or as large as the packet, whichever is smaller. When the packet is smaller than the look-ahead size, the look-ahead buffer contains the entire frame.

    A miniport should set this parameter to something larger than the minimum required, if sufficient received data is available on its NIC.

  • PacketSize
    [in] Specifies the size, in bytes, of the received packet data. This value does not include the HeaderBufferSize.

    When this parameter is larger than the specified LookaheadBufferSize, a protocol driver call to the NdisTransferData function causes a subsequent call to the MiniportTransferData function, which transfers the remaining data in the packet.

Return Value

None.

Remarks

NdisMEthIndicateReceive must be called from the same thread that initialized the handle to your adapter. If it is called from a different thread, the NDIS driver will experience a thread deadlock.

When a miniport driver uses NdisMEthIndicateReceive, it must also call NdisMEthIndicateReceiveComplete. NdisMEthIndicateReceiveComplete eventually calls into the protocol stack and flushes the final packets.

A miniport calls this function if it designates its NIC as of type NdisMedium802_3 or NdisMediumDix in response to the OID_GEN_MEDIA_IN_USE query, unless the miniport indicates receives with the NdisMIndicateReceivePacket function.

When a miniport calls this function, NDIS passes a pointer to the header of the packet and a pointer to some or all of the data in the packet to the ProtocolReceive function of bound protocol drivers. Each protocol that receives the indication can do the following:

  • Inspect the header and data in the packet to decide whether the indication is of interest to the protocol's clients.
  • If it is, copy as much of the header or data as is visible into protocol-allocated memory with the NdisMoveMemory function.
  • Get the remaining data, if any, for the indication by allocating a packet descriptor with sufficient chained buffer descriptors and calling the NdisTransferData function. The call to NdisTransferData causes the NIC driver's MiniportTransferData function to copy the data into the protocol-supplied packet.

For any protocol driver that receives an indication through this function, the HeaderBuffer and LookaheadBuffer parameters are valid only during the current call to its ProtocolReceive function, and these buffers are read-only. A protocol driver cannot retain a pointer to the indicated packet with these associated buffers, nor can it retain any pointers to these buffers for later use. Any data that a protocol driver needs from such a packet must be copied and saved during the receive indication.

The data in the header is the same as that received on the NIC. A miniport need not remove any headers or trailers from the data that its NIC receives.

The transmitting driver adds padding to any packet that is too short for the requirements of the medium. The receiving miniport can include such padding in the data and length that it subsequently indicates. Each bound protocol is responsible for detecting any such padding and ignoring it.

Requirements

Header ndis.h
Library ndis.dll
Windows Embedded CE Windows CE .NET 4.0 and later

See Also

Reference

NDIS Library Functions
MiniportInitialize
MiniportTransferData
MiniportSetInformation
NdisMEthIndicateReceiveComplete
NdisMIndicateReceivePacket
NdisMoveMemory
NdisTransferData
OID_GEN_CURRENT_LOOKAHEAD
OID_GEN_MEDIA_IN_USE
ProtocolReceive