NET_BUFFER structure

The NET_BUFFER 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;
  PVOID                 NdisReserved[2];
  PVOID                 ProtocolReserved[6];
  PVOID                 MiniportReserved[4];
  NDIS_PHYSICAL_ADDRESS DataPhysicalAddress;
#if (NDIS_SUPPORT_NDIS620)
  union {
    PNET_BUFFER_SHARED_MEMORY SharedMemoryInfo;
    PSCATTER_GATHER_LIST      ScatterGatherList;
  };
#endif 
} NET_BUFFER, *PNET_BUFFER;

Members

NetBufferHeader

A NET_BUFFER_HEADER structure.

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 for future use.

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 in use.

MiniportReserved

Reserved for use by miniport drivers. Miniport drivers and NDIS intermediate drivers can use this area for their own purposes.

DataPhysicalAddress

Note  The name of this member is NdisReserved1 for NDIS 6.0 drivers and is DataPhysicalAddress for NDIS 6.1 and later drivers. For NDIS 6.0 drivers, this member is reserved for NDIS.

The physical address of the data portion of a 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.

SharedMemoryInfo

A pointer to an NET_BUFFER_SHARED_MEMORY structure.

ScatterGatherList

The SCATTER_GATHER_LIST structure describes a scatter/gather list for DMA.

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 data space 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

For more information on how to use net buffers, see NET_BUFFER Architecture.

Requirements

Version

Supported in NDIS 6.0 and later.

Header

Ndis.h (include Ndis.h)

See also

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_LIST_POOL_PARAMETERS
NET_BUFFER_MINIPORT_RESERVED
NET_BUFFER_NEXT_NB
NET_BUFFER_PROTOCOL_RESERVED
SCATTER_GATHER_LIST

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft