blob: 8fd99d3c1989b6994fe7fc278bdb552a169c319b [file] [log] [blame]
Frédéric Lécaillea7e7ce92020-11-23 14:14:04 +01001/*
2 * Congestion controller handling.
3 *
4 * This file contains definitions for QUIC congestion control.
5 *
Willy Tarreau3dfb7da2022-03-02 22:33:39 +01006 * Copyright 2019 HAProxy Technologies, Frederic Lecaille <flecaille@haproxy.com>
Frédéric Lécaillea7e7ce92020-11-23 14:14:04 +01007 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation, version 2.1
11 * exclusively.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
Amaury Denoyelle5c25dc52022-09-30 17:44:15 +020023#include <haproxy/quic_cc.h>
Frédéric Lécaillea7e7ce92020-11-23 14:14:04 +010024
Frédéric Lécaille1c9c2f62022-06-01 15:06:58 +020025struct quic_cc_algo *default_quic_cc_algo = &quic_cc_algo_cubic;
Frédéric Lécaillea7e7ce92020-11-23 14:14:04 +010026
27/*
28 * Initialize <cc> congestion control with <algo> as algorithm depending on <ipv4>
29 * a boolean which is true for an IPv4 path.
30 */
31void quic_cc_init(struct quic_cc *cc,
32 struct quic_cc_algo *algo, struct quic_conn *qc)
33{
34 cc->qc = qc;
35 cc->algo = algo;
36 if (cc->algo->init)
37 (cc->algo->init(cc));
38}
39
40/* Send <ev> event to <cc> congestion controller. */
41void quic_cc_event(struct quic_cc *cc, struct quic_cc_event *ev)
42{
43 cc->algo->event(cc, ev);
44}
45
46void quic_cc_state_trace(struct buffer *buf, const struct quic_cc *cc)
47{
48 cc->algo->state_trace(buf, cc);
49}