lsquic_cong_ctl.h revision 06b2a236
1/* Copyright (c) 2017 - 2021 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_reinit) (void *cong_ctl);
28
29    void
30    (*cci_ack) (void *cong_ctl, struct lsquic_packet_out *, unsigned packet_sz,
31                lsquic_time_t now, int app_limited);
32
33    void
34    (*cci_loss) (void *cong_ctl);
35
36    /* Optional method */
37    void
38    (*cci_begin_ack) (void *cong_ctl, lsquic_time_t ack_time,
39                                                        uint64_t in_flight);
40
41    /* Optional method */
42    void
43    (*cci_end_ack) (void *cong_ctl, uint64_t in_flight);
44
45    /* Optional method */
46    void
47    (*cci_sent) (void *cong_ctl, struct lsquic_packet_out *,
48                                        uint64_t in_flight, int app_limited);
49
50    /* Optional method */
51    void
52    (*cci_lost) (void *cong_ctl, struct lsquic_packet_out *,
53                                                        unsigned packet_sz);
54
55    void
56    (*cci_timeout) (void *cong_ctl);
57
58    void
59    (*cci_was_quiet) (void *cong_ctl, lsquic_time_t now, uint64_t in_flight);
60
61    uint64_t
62    (*cci_get_cwnd) (void *cong_ctl);
63
64    uint64_t
65    (*cci_pacing_rate) (void *cong_ctl, int in_recovery);
66
67    void
68    (*cci_cleanup) (void *cong_ctl);
69};
70
71#endif
72