105 [[nodiscard]]
auto min_mtu() const noexcept ->
size_t
114 [[nodiscard]]
auto max_mtu() const noexcept ->
size_t
186 std::chrono::steady_clock::time_point now)
const noexcept -> bool;
192 [[nodiscard]]
auto probe_size() const noexcept -> std::optional<
size_t>;
199 void on_probe_sent(
size_t size, std::chrono::steady_clock::time_point sent_time);
242 -> std::optional<std::chrono::steady_clock::time_point>;
251 void on_timeout(std::chrono::steady_clock::time_point now);
Path MTU Discovery controller for QUIC (RFC 8899 DPLPMTUD)
void complete_search()
Transition to search_complete state.
std::chrono::steady_clock::time_point last_probe_time_
Time of last probe sent.
void on_packet_too_big(size_t reported_mtu)
Handle ICMP Packet Too Big message.
pmtud_controller()
Default constructor with default configuration.
pmtud_state state_
Current state.
size_t search_high_
Upper bound for binary search (target MTU)
auto is_enabled() const noexcept -> bool
Check if PMTUD is enabled.
void on_probe_sent(size_t size, std::chrono::steady_clock::time_point sent_time)
Record that a probe was sent.
void enable()
Enable PMTUD and start probing.
size_t search_low_
Lower bound for binary search (known good MTU)
auto is_search_complete() const noexcept -> bool
Check if MTU search is complete.
size_t probe_count_
Number of probes sent at current size.
static constexpr size_t kBlackHoleThreshold
Threshold for black hole detection.
auto next_timeout() const noexcept -> std::optional< std::chrono::steady_clock::time_point >
Get next timeout deadline for PMTUD.
bool probe_in_flight_
Whether a probe is currently in flight.
void on_probe_acked(size_t size)
Handle probe acknowledgment.
void on_probe_lost(size_t size)
Handle probe loss.
auto min_mtu() const noexcept -> size_t
Get minimum MTU.
void start_search()
Start probing from base MTU.
auto max_mtu() const noexcept -> size_t
Get maximum MTU being probed.
void reset()
Reset to initial state.
auto current_mtu() const noexcept -> size_t
Get current validated MTU.
size_t current_mtu_
Current validated MTU.
size_t consecutive_failures_
Number of consecutive probe failures (for black hole detection)
pmtud_config config_
Configuration.
std::chrono::steady_clock::time_point search_complete_time_
Time when search was completed (for re-validation)
auto should_probe(std::chrono::steady_clock::time_point now) const noexcept -> bool
Check if a probe should be sent.
auto state() const noexcept -> pmtud_state
Get current PMTUD state.
size_t probing_mtu_
Current probe size being tested.
void disable()
Disable PMTUD.
auto calculate_next_probe_size() const noexcept -> size_t
Calculate next probe size using binary search.
auto probe_size() const noexcept -> std::optional< size_t >
Get the size for next probe packet.
void on_timeout(std::chrono::steady_clock::time_point now)
Handle timeout event.
void handle_black_hole()
Handle black hole detection.
pmtud_state
States for DPLPMTUD state machine (RFC 8899 Section 5.2)
@ disabled
PMTUD is disabled.
@ search_complete
Maximum MTU found and validated.
@ base
Using BASE_PLPMTU (minimum MTU)
@ searching
Binary search for larger MTU.
@ error
Black hole detected, reset to base.
auto pmtud_state_to_string(pmtud_state state) noexcept -> const char *
Convert PMTUD state to string.
Configuration for PMTUD controller.
std::chrono::seconds probe_timeout
Timeout for probe packets before considering them lost.
std::chrono::milliseconds probe_interval
Interval between probe attempts during search.
size_t max_probes
Maximum number of probes before giving up at current size.
size_t probe_step
Step size for probing (binary search uses mid-point)
size_t max_probe_mtu
Maximum MTU to probe (typical Ethernet is 1500)
std::chrono::seconds confirmation_interval
Interval for re-validation after search is complete.
size_t min_mtu
Minimum MTU (RFC 9000 requires 1200 bytes for QUIC)