diff options
Diffstat (limited to 'ssl/quic/cc_dummy.c')
-rw-r--r-- | ssl/quic/cc_dummy.c | 100 |
1 files changed, 57 insertions, 43 deletions
diff --git a/ssl/quic/cc_dummy.c b/ssl/quic/cc_dummy.c index 195c4324bf..af0d548379 100644 --- a/ssl/quic/cc_dummy.c +++ b/ssl/quic/cc_dummy.c @@ -8,15 +8,22 @@ */ #include "internal/quic_cc.h" +#include "internal/quic_types.h" typedef struct ossl_cc_dummy_st { - char dummy; + size_t max_dgram_len; } OSSL_CC_DUMMY; -static OSSL_CC_DATA *dummy_new(OSSL_PARAM *settings, OSSL_PARAM *options, - OSSL_PARAM *changeables) +static OSSL_CC_DATA *dummy_new(OSSL_TIME (*now_cb)(void *arg), + void *now_cb_arg) { - return OPENSSL_zalloc(sizeof(OSSL_CC_DUMMY)); + OSSL_CC_DUMMY *d = OPENSSL_zalloc(sizeof(*d)); + + if (d == NULL) + return NULL; + + d->max_dgram_len = QUIC_MIN_INITIAL_DGRAM_LEN; + return (OSSL_CC_DATA *)d; } static void dummy_free(OSSL_CC_DATA *cc) @@ -24,90 +31,97 @@ static void dummy_free(OSSL_CC_DATA *cc) OPENSSL_free(cc); } -static void dummy_reset(OSSL_CC_DATA *cc, int flags) +static void dummy_reset(OSSL_CC_DATA *cc) { } -static int dummy_set_exemption(OSSL_CC_DATA *cc, int numpackets) +static int dummy_set_option_uint(OSSL_CC_DATA *cc, + uint32_t option_id, + uint64_t value) { - return 1; -} + OSSL_CC_DUMMY *d = (OSSL_CC_DUMMY *)cc; -static int dummy_get_exemption(OSSL_CC_DATA *cc) -{ - return 0; -} + switch (option_id) { + case OSSL_CC_OPTION_MAX_DGRAM_PAYLOAD_LEN: + if (value > SIZE_MAX) + return 0; -static int dummy_can_send(OSSL_CC_DATA *cc) -{ - return 1; + d->max_dgram_len = (size_t)value; + return 1; + + default: + return 0; + } } -static uint64_t dummy_get_send_allowance(OSSL_CC_DATA *cc, - OSSL_TIME time_since_last_send, - int time_valid) +static int dummy_get_option_uint(OSSL_CC_DATA *cc, + uint32_t option_id, + uint64_t *value) { - return SIZE_MAX; + OSSL_CC_DUMMY *d = (OSSL_CC_DUMMY *)cc; + + switch (option_id) { + case OSSL_CC_OPTION_MAX_DGRAM_PAYLOAD_LEN: + *value = (uint64_t)d->max_dgram_len; + return 1; + + default: + return 0; + } } -static uint64_t dummy_get_bytes_in_flight_max(OSSL_CC_DATA *cc) +static uint64_t dummy_get_tx_allowance(OSSL_CC_DATA *cc) { return SIZE_MAX; } -static OSSL_TIME dummy_get_next_credit_time(OSSL_CC_DATA *cc_data) +static OSSL_TIME dummy_get_wakeup_deadline(OSSL_CC_DATA *cc) { return ossl_time_infinite(); } static int dummy_on_data_sent(OSSL_CC_DATA *cc, - uint64_t num_retransmittable_bytes) + uint64_t num_bytes) { return 1; } -static int dummy_on_data_invalidated(OSSL_CC_DATA *cc, - uint64_t num_retransmittable_bytes) +static int dummy_on_data_acked(OSSL_CC_DATA *cc, + const OSSL_CC_ACK_INFO *info) { return 1; } -static int dummy_on_data_acked(OSSL_CC_DATA *cc, OSSL_TIME time_now, - uint64_t last_pn_acked, - uint64_t num_retransmittable_bytes) +static int dummy_on_data_lost(OSSL_CC_DATA *cc, + const OSSL_CC_LOSS_INFO *info) { return 1; } -static void dummy_on_data_lost(OSSL_CC_DATA *cc, - uint64_t largest_pn_lost, - uint64_t largest_pn_sent, - uint64_t num_retransmittable_bytes, - int persistent_congestion) +static int dummy_on_data_lost_finished(OSSL_CC_DATA *cc, + uint32_t flags) { - + return 1; } -static int dummy_on_spurious_congestion_event(OSSL_CC_DATA *cc) +static int dummy_on_data_invalidated(OSSL_CC_DATA *cc, + uint64_t num_bytes) { return 1; } const OSSL_CC_METHOD ossl_cc_dummy_method = { - NULL, dummy_new, dummy_free, dummy_reset, - dummy_set_exemption, - dummy_get_exemption, - dummy_can_send, - dummy_get_send_allowance, - dummy_get_bytes_in_flight_max, - dummy_get_next_credit_time, + dummy_set_option_uint, + dummy_get_option_uint, + dummy_get_tx_allowance, + dummy_get_wakeup_deadline, dummy_on_data_sent, - dummy_on_data_invalidated, dummy_on_data_acked, dummy_on_data_lost, - dummy_on_spurious_congestion_event, + dummy_on_data_lost_finished, + dummy_on_data_invalidated, }; |