// ring.h
UINT32 NetRingGetRangeCount(
[in] NET_RING const *Ring,
[in] UINT32 StartIndex,
[in] UINT32 EndIndex
);
View the official Windows Driver Kit DDI referenceNo description available.
Calculates the number of elements contained in a range of the specified net ring buffer.
Ring [in]A pointer to a NET_RING.
StartIndex [in]The inclusive start of the range to measure.
EndIndex [in]The exclusive end of the range to measure.
The number of elements in the given range.
For example, consider a net ring containing a total of 8 elements. Index values for the elements are 0 through 7. The number of elements in the range [1, 4) is 3. This is because the EndIndex value is not included, so the range includes elements at index values 1, 2, and 3.
Similarly, the range [4, 1) includes elements at index values 4, 5, 6, 7, and 0 (looping back to the beginning of the ring), for a total of 5 elements.
Finally, note that an empty range like [2, 2) returns zero elements.