openssl/ssl/quic/cc_dummy.c
Hugo Landau fa4e92a70a QUIC ACK Manager, Statistics Manager and Congestion Control API
This is the initial implementation of the ACK Manager for OpenSSL's QUIC
support, with supporting design documentation and tests.

Because the ACK Manager also depends on the Statistics Manager, it is
also implemented here. The Statistics Manager is quite simple, so this
does not amount to a large amount of extra code.

Because the ACK Manager depends on a congestion controller, it adds a
no-op congestion controller, which uses the previously workshopped
congestion control API.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18676)
2022-08-24 14:05:46 +01:00

107 lines
2.4 KiB
C

/*
* Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#include "internal/quic_cc.h"
typedef struct ossl_cc_dummy_st {
char dummy;
} OSSL_CC_DUMMY;
static OSSL_CC_DATA *dummy_new(OSSL_PARAM *settings, OSSL_PARAM *options,
OSSL_PARAM *changeables)
{
return OPENSSL_zalloc(sizeof(OSSL_CC_DUMMY));
}
static void dummy_free(OSSL_CC_DATA *cc)
{
OPENSSL_free(cc);
}
static void dummy_reset(OSSL_CC_DATA *cc, int flags)
{
}
static int dummy_set_exemption(OSSL_CC_DATA *cc, int numpackets)
{
return 1;
}
static int dummy_get_exemption(OSSL_CC_DATA *cc)
{
return 0;
}
static int dummy_can_send(OSSL_CC_DATA *cc)
{
return 1;
}
static size_t dummy_get_send_allowance(OSSL_CC_DATA *cc,
OSSL_TIME time_since_last_send,
int time_valid)
{
return SIZE_MAX;
}
static size_t dummy_get_bytes_in_flight_max(OSSL_CC_DATA *cc)
{
return SIZE_MAX;
}
static int dummy_on_data_sent(OSSL_CC_DATA *cc, size_t num_retransmittable_bytes)
{
return 1;
}
static int dummy_on_data_invalidated(OSSL_CC_DATA *cc,
size_t num_retransmittable_bytes)
{
return 1;
}
static int dummy_on_data_acked(OSSL_CC_DATA *cc, OSSL_TIME time_now,
uint64_t last_pn_acked,
size_t num_retransmittable_bytes)
{
return 1;
}
static void dummy_on_data_lost(OSSL_CC_DATA *cc,
uint64_t largest_pn_lost,
uint64_t largest_pn_sent,
size_t num_retransmittable_bytes,
int persistent_congestion)
{
}
static int dummy_on_spurious_congestion_event(OSSL_CC_DATA *cc)
{
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_on_data_sent,
dummy_on_data_invalidated,
dummy_on_data_acked,
dummy_on_data_lost,
dummy_on_spurious_congestion_event,
};