Поделиться через


NET_BUFFER (Compact 2013)

3/26/2014

This structure specifies data that is transmitted or received over the network.

Syntax

typedef struct _NET_BUFFER {
  NET_BUFFER_HEADER  NetBufferHeader;
  USHORT  ChecksumBias;
  USHORT  Reserved;
  NDIS_HANDLE  NdisPoolHandle;
  DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT)PVOID  NdisReserved[2];
  DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT)PVOID  ProtocolReserved[6];
  DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT)PVOID  MiniportReserved[4];
  NDIS_PHYSICAL_ADDRESS  DataPhysicalAddress;    // was NdisReserved1;
} NET_BUFFER, *PNET_BUFFER;

Members

  • ChecksumBias
    The number of bytes to skip over from the beginning of the data buffer when computing a checksum. This member is used by the TCP/IP protocol.
  • Reserved
    Reserved.
  • NdisPoolHandle
    A pool handle that identifies the NET_BUFFER pool from which the NET_BUFFER structure was allocated.
  • NdisReserved
    Reserved for NDIS.
  • ProtocolReserved
    Reserved for use by protocol drivers. Protocol drivers and NDIS intermediate drivers can use this area for their own purposes. Intermediate drivers can use this member only if it is not already being used.
  • MiniportReserved
    Reserved for use by miniport drivers. Miniport drivers and NDIS intermediate drivers can use this area for their own purposes.
  • NdisReserved1
    Reserved for NDIS.

    Note

    The name of this member is NdisReserved1 for NDIS 6.0 drivers and is DataPhysicalAddress for NDIS 6.1 drivers.

  • DataPhysicalAddress
    The physical address of the data part of an frame. This member should be to zero if the driver that allocated NET_BUFFER does not specify the address. This member is valid only if the NDIS_NBL_FLAGS_SPLIT_AT_UPPER_LAYER_PROTOCOL_HEADER or NDIS_NBL_FLAGS_SPLIT_AT_UPPER_LAYER_PROTOCOL_PAYLOAD flag is set in the NblFlags member of the NET_BUFFER_LIST structure that is associated with the NET_BUFFER.

    Note

    A miniport driver can set the DataPhysicalAddress member of the NET_BUFFER structure, even if the structure is not associated with a split frame. In this case, DataPhysicalAddress contains the physical address of the header MDL.

Remarks

NDIS drivers can call the following functions to allocate and initialize a NET_BUFFER structure:

NDIS drivers can call the NdisAllocateNetBufferListPool function and then set the fAllocateNetBuffer member of the NET_BUFFER_LIST_POOL_PARAMETERS structure to TRUE when allocating a NET_BUFFER_LIST structure pool. In this case, a NET_BUFFER structure is preallocated with each NET_BUFFER_LIST structure that the driver allocates from the pool.

Chained to each NET_BUFFER structure are one or more buffer descriptors that map buffers that contain network packet data. These buffer descriptors are specified as an MDL chain in the NetBufferHeader member. Such network packet data either was received or will be transmitted.

To access additional dataspace in the MDL chain, NDIS drivers can call the following functions:

NDIS drivers typically use the MiniportReserved or ProtocolReserved members of the NET_BUFFER structure to maintain NET_BUFFER structure context information.

Note   Only one driver can use MiniportReserved or ProtocolReserved members. Therefore, if another driver has used either of these members, an intermediate driver cannot use them.

To access members of the NET_BUFFER structure, use the following macros and functions:

NET_BUFFER_NEXT_NB

NET_BUFFER_FIRST_MDL

NET_BUFFER_DATA_OFFSET

NET_BUFFER_DATA_LENGTH

NET_BUFFER_PROTOCOL_RESERVED

NET_BUFFER_MINIPORT_RESERVED

NET_BUFFER_CHECKSUM_BIAS

NET_BUFFER_CURRENT_MDL

NET_BUFFER_CURRENT_MDL_OFFSET

NdisGetPoolFromNetBuffer

Requirements

Header

ndis.h

See Also

Reference

NDIS NET_BUFFER Structures
NdisAllocateNetBuffer
NdisAllocateNetBufferAndNetBufferList
NdisAllocateNetBufferListPool
NdisGetPoolFromNetBuffer
NdisMSendNetBufferListsComplete
NdisRetreatNetBufferDataStart
NdisRetreatNetBufferListDataStart
NET_BUFFER_CHECKSUM_BIAS
NET_BUFFER_CURRENT_MDL
NET_BUFFER_CURRENT_MDL_OFFSET
NET_BUFFER_DATA_LENGTH
NET_BUFFER_DATA_OFFSET
NET_BUFFER_FIRST_MDL
NET_BUFFER_HEADER
NET_BUFFER_LIST
NET_BUFFER_MINIPORT_RESERVED
NET_BUFFER_NEXT_NB
NET_BUFFER_PROTOCOL_RESERVED