1 #ifndef BLANK_NET_CONGESTIONCONTROL_HPP_
2 #define BLANK_NET_CONGESTIONCONTROL_HPP_
10 class CongestionControl {
22 /// get recommended mode of operation
23 Mode GetMode() const noexcept { return mode; }
25 /// packet loss as factor
26 float PacketLoss() const noexcept { return packet_loss; }
27 /// smooth average round trip time in milliseconds
28 float RoundTripTime() const noexcept { return rtt; }
29 /// estimated kilobytes transferred per second
30 float Upstream() const noexcept { return tx_kbps; }
31 /// estimated kilobytes received per second
32 float Downstream() const noexcept { return rx_kbps; }
34 void PacketSent(std::uint16_t) noexcept;
35 void PacketLost(std::uint16_t) noexcept;
36 void PacketReceived(std::uint16_t) noexcept;
38 void PacketIn(const UDPpacket &) noexcept;
39 void PacketOut(const UDPpacket &) noexcept;
42 void UpdatePacketLoss() noexcept;
44 void UpdateRTT(std::uint16_t) noexcept;
45 bool SamplePacket(std::uint16_t) const noexcept;
47 void UpdateStats() noexcept;
49 void UpdateMode() noexcept;
50 void CheckUpgrade(Mode) noexcept;
51 void ChangeMode(Mode) noexcept;
52 void KeepMode() noexcept;
54 Mode Conditions() const noexcept;
57 const unsigned int packet_overhead;
58 const unsigned int sample_skip;
60 unsigned int packets_lost;
61 unsigned int packets_received;
65 std::size_t stamp_cursor;
66 std::uint16_t stamp_last;
82 Uint32 mode_keep_time;