+#define TCP_BTS_INVALID_INDEX ((u32)~0)
+
+typedef enum tcp_bts_flags_
+{
+ TCP_BTS_IS_RXT = 1,
+ TCP_BTS_IS_APP_LIMITED = 1 << 1,
+ TCP_BTS_IS_SACKED = 1 << 2,
+ TCP_BTS_IS_RXT_LOST = 1 << 3,
+} __clib_packed tcp_bts_flags_t;
+
+typedef struct tcp_bt_sample_
+{
+ u32 next; /**< Next sample index in list */
+ u32 prev; /**< Previous sample index in list */
+ u32 min_seq; /**< Min seq number in sample */
+ u32 max_seq; /**< Max seq number. Set for rxt samples */
+ u64 delivered; /**< Total delivered bytes for sample */
+ f64 delivered_time; /**< Delivered time when sample taken */
+ f64 tx_time; /**< Transmit time for the burst */
+ f64 first_tx_time; /**< Connection first tx time at tx */
+ tcp_bts_flags_t flags; /**< Sample flag */
+} tcp_bt_sample_t;
+
+typedef struct tcp_rate_sample_
+{
+ u64 prior_delivered; /**< Delivered of sample used for rate, i.e.,
+ total bytes delivered at prior_time */
+ f64 prior_time; /**< Delivered time of sample used for rate */
+ f64 interval_time; /**< Time to ack the bytes delivered */
+ f64 rtt_time; /**< RTT for sample */
+ u32 delivered; /**< Bytes delivered in interval_time */
+ u32 acked_and_sacked; /**< Bytes acked + sacked now */
+ u32 lost; /**< Bytes lost now */
+ tcp_bts_flags_t flags; /**< Rate sample flags from bt sample */
+} tcp_rate_sample_t;
+
+typedef struct tcp_byte_tracker_
+{
+ tcp_bt_sample_t *samples; /**< Pool of samples */
+ rb_tree_t sample_lookup; /**< Rbtree for sample lookup by min_seq */
+ u32 head; /**< Head of samples linked list */
+ u32 tail; /**< Tail of samples linked list */
+ u32 last_ooo; /**< Cached last ooo sample */
+} tcp_byte_tracker_t;
+