lsquic_cong_ctl.h revision cca25415
1/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */ 2/* 3 * lsquic_cong_ctl.h -- congestion control interface 4 */ 5 6#ifndef LSQUIC_CONG_CTL_H 7#define LSQUIC_CONG_CTL_H 8 9 10struct lsquic_conn_public; 11struct lsquic_packet_out; 12enum quic_ft_bit; 13 14 15/* All the methods don't quite match up between Cubic and BBR. Thus, some of 16 * the methods are optional; they are marked as such in the comments below. 17 * Reconciling Cubic and BBR to have similar interface is left as an exercise 18 * for the future. 19 */ 20struct cong_ctl_if 21{ 22 void 23 (*cci_init) (void *cong_ctl, const struct lsquic_conn_public *, 24 enum quic_ft_bit); 25 26 void 27 (*cci_ack) (void *cong_ctl, struct lsquic_packet_out *, unsigned packet_sz, 28 lsquic_time_t now, int app_limited); 29 30 void 31 (*cci_loss) (void *cong_ctl); 32 33 /* Optional method */ 34 void 35 (*cci_begin_ack) (void *cong_ctl, lsquic_time_t ack_time, 36 uint64_t in_flight); 37 38 /* Optional method */ 39 void 40 (*cci_end_ack) (void *cong_ctl, uint64_t in_flight); 41 42 /* Optional method */ 43 void 44 (*cci_sent) (void *cong_ctl, struct lsquic_packet_out *, 45 uint64_t in_flight, int app_limited); 46 47 /* Optional method */ 48 void 49 (*cci_lost) (void *cong_ctl, struct lsquic_packet_out *, 50 unsigned packet_sz); 51 52 void 53 (*cci_timeout) (void *cong_ctl); 54 55 void 56 (*cci_was_quiet) (void *cong_ctl, lsquic_time_t now, uint64_t in_flight); 57 58 uint64_t 59 (*cci_get_cwnd) (void *cong_ctl); 60 61 uint64_t 62 (*cci_pacing_rate) (void *cong_ctl, int in_recovery); 63 64 void 65 (*cci_cleanup) (void *cong_ctl); 66}; 67 68#endif 69