QUIC: Enable building with QUIC support disabled
[openssl.git] / include / internal / quic_statm.h
1 /*
2  * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License 2.0 (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9
10 #ifndef OSSL_QUIC_STATS_H
11 # define OSSL_QUIC_STATS_H
12
13 # include <openssl/ssl.h>
14 # include "internal/time.h"
15
16 # ifndef OPENSSL_NO_QUIC
17
18 typedef struct ossl_statm_st {
19     OSSL_TIME smoothed_rtt, latest_rtt, min_rtt, rtt_variance, max_ack_delay;
20     char      have_first_sample;
21 } OSSL_STATM;
22
23 typedef struct ossl_rtt_info_st {
24     /* As defined in RFC 9002. */
25     OSSL_TIME smoothed_rtt, latest_rtt, rtt_variance, min_rtt, max_ack_delay;
26 } OSSL_RTT_INFO;
27
28 int ossl_statm_init(OSSL_STATM *statm);
29
30 void ossl_statm_destroy(OSSL_STATM *statm);
31
32 void ossl_statm_get_rtt_info(OSSL_STATM *statm, OSSL_RTT_INFO *rtt_info);
33
34 void ossl_statm_update_rtt(OSSL_STATM *statm,
35                            OSSL_TIME ack_delay,
36                            OSSL_TIME override_latest_rtt);
37
38 void ossl_statm_set_max_ack_delay(OSSL_STATM *statm, OSSL_TIME max_ack_delay);
39
40 # endif
41
42 #endif