|
Network System 0.1.1
High-performance modular networking library for scalable client-server applications
|
ECN (Explicit Congestion Notification) tracker (RFC 9000 Section 13.4, RFC 9002 Section 7.1) More...
#include <ecn_tracker.h>
Classes | |
| struct | validation_state |
| Internal ECN validation state. More... | |
Public Member Functions | |
| ecn_tracker () | |
| Default constructor. | |
| auto | process_ecn_counts (const ecn_counts &counts, uint64_t packets_acked, std::chrono::steady_clock::time_point sent_time) -> ecn_result |
| Process received ECN counts from an ACK_ECN frame. | |
| auto | is_ecn_capable () const noexcept -> bool |
| Check if ECN is validated for use. | |
| auto | is_testing () const noexcept -> bool |
| Check if ECN is currently in testing phase. | |
| auto | has_failed () const noexcept -> bool |
| Check if ECN has failed validation. | |
| auto | get_ecn_marking () const noexcept -> ecn_marking |
| Get ECN marking to use for outgoing packets. | |
| auto | on_packets_sent (uint64_t packet_count) noexcept -> void |
| Record packets sent with ECN marking. | |
| auto | last_congestion_sent_time () const noexcept -> std::chrono::steady_clock::time_point |
| Get the sent time when the last ECN-CE congestion was detected. | |
| auto | current_counts () const noexcept -> const ecn_counts & |
| Get current ECN counts. | |
| auto | reset () noexcept -> void |
| Reset ECN tracker to initial state. | |
| auto | disable () noexcept -> void |
| Disable ECN tracking. | |
Private Member Functions | |
| auto | validate_ecn (const ecn_counts &counts, uint64_t packets_acked) -> bool |
| Validate ECN capability based on received counts. | |
Private Attributes | |
| validation_state | state_ |
| ECN validation state. | |
ECN (Explicit Congestion Notification) tracker (RFC 9000 Section 13.4, RFC 9002 Section 7.1)
Tracks ECN feedback from ACK_ECN frames and validates ECN capability. ECN-CE marks indicate congestion without packet loss, providing more responsive congestion detection than loss-based methods.
Definition at line 51 of file ecn_tracker.h.
| kcenon::network::protocols::quic::ecn_tracker::ecn_tracker | ( | ) |
Default constructor.
Starts in ECN testing mode. ECN capability will be validated when the first ACK with ECN counts is received.
Definition at line 25 of file ecn_tracker.cpp.
References kcenon::network::protocols::quic::ecn_tracker::validation_state::capable, kcenon::network::protocols::quic::ecn_tracker::validation_state::failed, state_, and kcenon::network::protocols::quic::ecn_tracker::validation_state::testing.
|
inlinenodiscardnoexcept |
Get current ECN counts.
Definition at line 158 of file ecn_tracker.h.
References kcenon::network::protocols::quic::ecn_tracker::validation_state::counts, and state_.
|
noexcept |
Disable ECN tracking.
Called when ECN should be permanently disabled for this connection. After calling this, get_ecn_marking() will return not_ect.
Definition at line 133 of file ecn_tracker.cpp.
References kcenon::network::protocols::quic::ecn_tracker::validation_state::capable, kcenon::network::protocols::quic::ecn_tracker::validation_state::failed, state_, and kcenon::network::protocols::quic::ecn_tracker::validation_state::testing.
|
inlinenodiscardnoexcept |
Get ECN marking to use for outgoing packets.
Returns ECT(0) when ECN is capable or testing, returns Not-ECT when ECN has failed.
RFC 9000 Section 13.4.1: ECN-capable QUIC endpoints SHOULD use ECT(0) codepoint.
Definition at line 124 of file ecn_tracker.h.
References kcenon::network::protocols::quic::ect0, kcenon::network::protocols::quic::ecn_tracker::validation_state::failed, kcenon::network::protocols::quic::not_ect, and state_.
|
inlinenodiscardnoexcept |
Check if ECN has failed validation.
Definition at line 109 of file ecn_tracker.h.
References kcenon::network::protocols::quic::ecn_tracker::validation_state::failed, and state_.
|
inlinenodiscardnoexcept |
Check if ECN is validated for use.
ECN is considered capable when:
Definition at line 91 of file ecn_tracker.h.
References kcenon::network::protocols::quic::ecn_tracker::validation_state::capable, state_, and kcenon::network::protocols::quic::ecn_tracker::validation_state::testing.
|
inlinenodiscardnoexcept |
Check if ECN is currently in testing phase.
Definition at line 100 of file ecn_tracker.h.
References state_, and kcenon::network::protocols::quic::ecn_tracker::validation_state::testing.
|
inlinenodiscardnoexcept |
Get the sent time when the last ECN-CE congestion was detected.
Used by the congestion controller to determine if we're in recovery.
Definition at line 148 of file ecn_tracker.h.
References kcenon::network::protocols::quic::ecn_tracker::validation_state::last_congestion_sent_time, and state_.
|
noexcept |
Record packets sent with ECN marking.
| packet_count | Number of packets sent with ECN marking |
Used for ECN validation to track how many ECN-marked packets have been sent.
Definition at line 119 of file ecn_tracker.cpp.
|
nodiscard |
Process received ECN counts from an ACK_ECN frame.
| counts | ECN counts from the ACK frame |
| packets_acked | Number of packets acknowledged in this ACK |
| sent_time | Sent time of the oldest acknowledged packet (for recovery tracking) |
This method should be called for every ACK_ECN frame received. It compares the new counts against previously recorded counts to detect ECN-CE increases (congestion signals).
RFC 9000 Section 13.4.2.1: Processing ECN Information
Definition at line 34 of file ecn_tracker.cpp.
References kcenon::network::protocols::quic::congestion_signal, kcenon::network::protocols::quic::ecn_failure, and kcenon::network::protocols::quic::none.
|
noexcept |
Reset ECN tracker to initial state.
Resets all state including ECN counts and validation status. ECN testing will restart.
Definition at line 127 of file ecn_tracker.cpp.
References state_, and kcenon::network::protocols::quic::ecn_tracker::validation_state::testing.
|
nodiscardprivate |
Validate ECN capability based on received counts.
| counts | Received ECN counts |
| packets_acked | Number of packets acknowledged |
RFC 9000 Section 13.4.2.1:
Definition at line 94 of file ecn_tracker.cpp.
|
private |
ECN validation state.
Definition at line 223 of file ecn_tracker.h.
Referenced by current_counts(), disable(), ecn_tracker(), get_ecn_marking(), has_failed(), is_ecn_capable(), is_testing(), last_congestion_sent_time(), and reset().