lsquic_rechist.h revision 229fce07
1229fce07SDmitri Tikhonov/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */ 250aadb33SDmitri Tikhonov/* 350aadb33SDmitri Tikhonov * lsquic_rechist.h -- History of received packets. 450aadb33SDmitri Tikhonov * 550aadb33SDmitri Tikhonov * The purpose of received packet history is to generate ACK frames. 650aadb33SDmitri Tikhonov */ 750aadb33SDmitri Tikhonov 850aadb33SDmitri Tikhonov#ifndef LSQUIC_RECHIST_H 950aadb33SDmitri Tikhonov#define LSQUIC_RECHIST_H 1 1050aadb33SDmitri Tikhonov 1150aadb33SDmitri Tikhonov#include "lsquic_packints.h" 1250aadb33SDmitri Tikhonov 1350aadb33SDmitri Tikhonovstruct lsquic_rechist { 1450aadb33SDmitri Tikhonov struct packints rh_pints; 1550aadb33SDmitri Tikhonov lsquic_packno_t rh_cutoff; 1650aadb33SDmitri Tikhonov lsquic_time_t rh_largest_acked_received; 1750aadb33SDmitri Tikhonov lsquic_cid_t rh_cid; /* Used for logging */ 1850aadb33SDmitri Tikhonov /* Chromium limits the number of tracked packets (see 1950aadb33SDmitri Tikhonov * kMaxTrackedPackets). We could do this, too. 2050aadb33SDmitri Tikhonov */ 2150aadb33SDmitri Tikhonov unsigned rh_n_packets; 2250aadb33SDmitri Tikhonov enum { 2350aadb33SDmitri Tikhonov RH_CUTOFF_SET = (1 << 0), 2450aadb33SDmitri Tikhonov } rh_flags; 2550aadb33SDmitri Tikhonov}; 2650aadb33SDmitri Tikhonov 2750aadb33SDmitri Tikhonovtypedef struct lsquic_rechist lsquic_rechist_t; 2850aadb33SDmitri Tikhonov 2950aadb33SDmitri Tikhonovvoid 3050aadb33SDmitri Tikhonovlsquic_rechist_init (struct lsquic_rechist *, lsquic_cid_t); 3150aadb33SDmitri Tikhonov 3250aadb33SDmitri Tikhonovvoid 3350aadb33SDmitri Tikhonovlsquic_rechist_cleanup (struct lsquic_rechist *); 3450aadb33SDmitri Tikhonov 3550aadb33SDmitri Tikhonovenum received_st { 3650aadb33SDmitri Tikhonov REC_ST_OK, 3750aadb33SDmitri Tikhonov REC_ST_DUP, 3850aadb33SDmitri Tikhonov REC_ST_ERR, 3950aadb33SDmitri Tikhonov}; 4050aadb33SDmitri Tikhonov 4150aadb33SDmitri Tikhonovenum received_st 4250aadb33SDmitri Tikhonovlsquic_rechist_received (lsquic_rechist_t *, lsquic_packno_t, 4350aadb33SDmitri Tikhonov lsquic_time_t now); 4450aadb33SDmitri Tikhonov 4550aadb33SDmitri Tikhonovvoid 4650aadb33SDmitri Tikhonovlsquic_rechist_stop_wait (lsquic_rechist_t *, lsquic_packno_t); 4750aadb33SDmitri Tikhonov 4850aadb33SDmitri Tikhonov/* Returns number of bytes written on success, -1 on failure */ 4950aadb33SDmitri Tikhonovint 5050aadb33SDmitri Tikhonovlsquic_rechist_make_ackframe (lsquic_rechist_t *, 5150aadb33SDmitri Tikhonov void *outbuf, size_t outbuf_sz, int *has_missing, 5250aadb33SDmitri Tikhonov lsquic_time_t now); 5350aadb33SDmitri Tikhonov 5450aadb33SDmitri Tikhonovconst struct lsquic_packno_range * 5550aadb33SDmitri Tikhonovlsquic_rechist_first (lsquic_rechist_t *); 5650aadb33SDmitri Tikhonov 5750aadb33SDmitri Tikhonovconst struct lsquic_packno_range * 5850aadb33SDmitri Tikhonovlsquic_rechist_next (lsquic_rechist_t *); 5950aadb33SDmitri Tikhonov 6050aadb33SDmitri Tikhonovlsquic_packno_t 6150aadb33SDmitri Tikhonovlsquic_rechist_largest_packno (const lsquic_rechist_t *); 6250aadb33SDmitri Tikhonov 6350aadb33SDmitri Tikhonovlsquic_packno_t 6450aadb33SDmitri Tikhonovlsquic_rechist_cutoff (const lsquic_rechist_t *); 6550aadb33SDmitri Tikhonov 6650aadb33SDmitri Tikhonovlsquic_time_t 6750aadb33SDmitri Tikhonovlsquic_rechist_largest_recv (const lsquic_rechist_t *); 6850aadb33SDmitri Tikhonov 69c51ce338SDmitri Tikhonovsize_t 70c51ce338SDmitri Tikhonovlsquic_rechist_mem_used (const struct lsquic_rechist *); 71c51ce338SDmitri Tikhonov 7250aadb33SDmitri Tikhonov#endif 73