]> git.ipfire.org Git - thirdparty/openssl.git/blob - ssl/quic/cc_dummy.c
195c4324bf964daf15e0bb98197afb6f3c05b0b7
[thirdparty/openssl.git] / ssl / quic / cc_dummy.c
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 #include "internal/quic_cc.h"
11
12 typedef struct ossl_cc_dummy_st {
13 char dummy;
14 } OSSL_CC_DUMMY;
15
16 static OSSL_CC_DATA *dummy_new(OSSL_PARAM *settings, OSSL_PARAM *options,
17 OSSL_PARAM *changeables)
18 {
19 return OPENSSL_zalloc(sizeof(OSSL_CC_DUMMY));
20 }
21
22 static void dummy_free(OSSL_CC_DATA *cc)
23 {
24 OPENSSL_free(cc);
25 }
26
27 static void dummy_reset(OSSL_CC_DATA *cc, int flags)
28 {
29
30 }
31
32 static int dummy_set_exemption(OSSL_CC_DATA *cc, int numpackets)
33 {
34 return 1;
35 }
36
37 static int dummy_get_exemption(OSSL_CC_DATA *cc)
38 {
39 return 0;
40 }
41
42 static int dummy_can_send(OSSL_CC_DATA *cc)
43 {
44 return 1;
45 }
46
47 static uint64_t dummy_get_send_allowance(OSSL_CC_DATA *cc,
48 OSSL_TIME time_since_last_send,
49 int time_valid)
50 {
51 return SIZE_MAX;
52 }
53
54 static uint64_t dummy_get_bytes_in_flight_max(OSSL_CC_DATA *cc)
55 {
56 return SIZE_MAX;
57 }
58
59 static OSSL_TIME dummy_get_next_credit_time(OSSL_CC_DATA *cc_data)
60 {
61 return ossl_time_infinite();
62 }
63
64 static int dummy_on_data_sent(OSSL_CC_DATA *cc,
65 uint64_t num_retransmittable_bytes)
66 {
67 return 1;
68 }
69
70 static int dummy_on_data_invalidated(OSSL_CC_DATA *cc,
71 uint64_t num_retransmittable_bytes)
72 {
73 return 1;
74 }
75
76 static int dummy_on_data_acked(OSSL_CC_DATA *cc, OSSL_TIME time_now,
77 uint64_t last_pn_acked,
78 uint64_t num_retransmittable_bytes)
79 {
80 return 1;
81 }
82
83 static void dummy_on_data_lost(OSSL_CC_DATA *cc,
84 uint64_t largest_pn_lost,
85 uint64_t largest_pn_sent,
86 uint64_t num_retransmittable_bytes,
87 int persistent_congestion)
88 {
89
90 }
91
92 static int dummy_on_spurious_congestion_event(OSSL_CC_DATA *cc)
93 {
94 return 1;
95 }
96
97 const OSSL_CC_METHOD ossl_cc_dummy_method = {
98 NULL,
99 dummy_new,
100 dummy_free,
101 dummy_reset,
102 dummy_set_exemption,
103 dummy_get_exemption,
104 dummy_can_send,
105 dummy_get_send_allowance,
106 dummy_get_bytes_in_flight_max,
107 dummy_get_next_credit_time,
108 dummy_on_data_sent,
109 dummy_on_data_invalidated,
110 dummy_on_data_acked,
111 dummy_on_data_lost,
112 dummy_on_spurious_congestion_event,
113 };