2
0

cc_dummy.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. #include "internal/quic_cc.h"
  10. typedef struct ossl_cc_dummy_st {
  11. char dummy;
  12. } OSSL_CC_DUMMY;
  13. static OSSL_CC_DATA *dummy_new(OSSL_PARAM *settings, OSSL_PARAM *options,
  14. OSSL_PARAM *changeables)
  15. {
  16. return OPENSSL_zalloc(sizeof(OSSL_CC_DUMMY));
  17. }
  18. static void dummy_free(OSSL_CC_DATA *cc)
  19. {
  20. OPENSSL_free(cc);
  21. }
  22. static void dummy_reset(OSSL_CC_DATA *cc, int flags)
  23. {
  24. }
  25. static int dummy_set_exemption(OSSL_CC_DATA *cc, int numpackets)
  26. {
  27. return 1;
  28. }
  29. static int dummy_get_exemption(OSSL_CC_DATA *cc)
  30. {
  31. return 0;
  32. }
  33. static int dummy_can_send(OSSL_CC_DATA *cc)
  34. {
  35. return 1;
  36. }
  37. static uint64_t dummy_get_send_allowance(OSSL_CC_DATA *cc,
  38. OSSL_TIME time_since_last_send,
  39. int time_valid)
  40. {
  41. return SIZE_MAX;
  42. }
  43. static uint64_t dummy_get_bytes_in_flight_max(OSSL_CC_DATA *cc)
  44. {
  45. return SIZE_MAX;
  46. }
  47. static int dummy_on_data_sent(OSSL_CC_DATA *cc,
  48. uint64_t num_retransmittable_bytes)
  49. {
  50. return 1;
  51. }
  52. static int dummy_on_data_invalidated(OSSL_CC_DATA *cc,
  53. uint64_t num_retransmittable_bytes)
  54. {
  55. return 1;
  56. }
  57. static int dummy_on_data_acked(OSSL_CC_DATA *cc, OSSL_TIME time_now,
  58. uint64_t last_pn_acked,
  59. uint64_t num_retransmittable_bytes)
  60. {
  61. return 1;
  62. }
  63. static void dummy_on_data_lost(OSSL_CC_DATA *cc,
  64. uint64_t largest_pn_lost,
  65. uint64_t largest_pn_sent,
  66. uint64_t num_retransmittable_bytes,
  67. int persistent_congestion)
  68. {
  69. }
  70. static int dummy_on_spurious_congestion_event(OSSL_CC_DATA *cc)
  71. {
  72. return 1;
  73. }
  74. const OSSL_CC_METHOD ossl_cc_dummy_method = {
  75. NULL,
  76. dummy_new,
  77. dummy_free,
  78. dummy_reset,
  79. dummy_set_exemption,
  80. dummy_get_exemption,
  81. dummy_can_send,
  82. dummy_get_send_allowance,
  83. dummy_get_bytes_in_flight_max,
  84. dummy_on_data_sent,
  85. dummy_on_data_invalidated,
  86. dummy_on_data_acked,
  87. dummy_on_data_lost,
  88. dummy_on_spurious_congestion_event,
  89. };