NetRingGetRangeCount function (ring.h)

Calculates the number of elements contained in a range of the specified net ring buffer.

Syntax

UINT32 NetRingGetRangeCount(
  [in] NET_RING const *Ring,
  [in] UINT32         StartIndex,
  [in] UINT32         EndIndex
);

Parameters

[in] Ring

A pointer to a NET_RING.

[in] StartIndex

The inclusive start of the range to measure.

[in] EndIndex

The exclusive end of the range to measure.

Return value

The number of elements in the given range.

Remarks

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.

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.29
Header ring.h (include netadaptercx.h)
IRQL Any level as long as target memory is resident