// ring.h
typedef struct _NET_RING {
UINT16 OSReserved1;
UINT16 ElementStride;
UINT32 NumberOfElements;
UINT32 ElementIndexMask;
UINT32 EndIndex;
union {
UINT32 OSReserved0;
void *OSReserved2[4];
} DUMMYUNIONNAME;
UINT32 BeginIndex;
UINT32 NextIndex;
void *Scratch;
unsigned char Buffer[ANYSIZE_ARRAY];
} NET_RING;
View the official Windows Driver Kit DDI referenceNo description available.
Specifies a buffer comprised of one or more NET_PACKET or NET_FRAGMENT structures.
OSReserved1Reserved. Client drivers must not read or write to this value.
ElementStrideA read-only byte offset from the start of one element to the start of the next. Use ((BYTE*)p + ElementStride) to obtain the address of the next element.
NumberOfElementsA read-only value that indicates the number of packets in the ring buffer, which is always a power of two, and greater than one.
ElementIndexMaskA read-only UINT32 mask that can be used to efficiently clamp an index to [0, NumberOfElements). The client can use this value to calculate an index that wraps around the ring buffer. Use the identity (x % NumberofElements) == (x & ElementIndexMask).
EndIndexSpecifies the read-only index of the last element that is owned by the client driver in the inclusive range [0, NumberOfElements - 1].
DUMMYUNIONNAMEA union that contains the OSReserved0 and OSReserved2 members.
DUMMYUNIONNAME.OSReserved0Reserved. Client drivers must not read or write to this value.
DUMMYUNIONNAME.OSReserved2Reserved. Client drivers must not read or write to this value.
BeginIndexSpecifies the index of the first element owned by the client driver in the inclusive range [0, NumberOfElements - 1].
NextIndexSpecifies the index of the next element that needs processing. For optional use by the client driver.
ScratchA pointer to a buffer that the client driver may use for any purpose.
BufferA byte array that contains the elements in the net ring. Typically, a client driver calls NetRingGetPacketAtIndex or NetRingGetFragmentAtIndex to access the elements of the ring buffer.
The NET_RING structure is a generic ring buffer, optimized for efficient access from a single thread. A NET_RING contains NET_PACKET or NET_FRAGMENT elements.
For more info about packet and fragment ring buffers, see Packet descriptors and extensions.
For more info about using net rings, see Introduction to net rings.