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