wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
ackpolicy.h
1#ifndef RECOVERY_ACKPOLICY_H
2#define RECOVERY_ACKPOLICY_H
3
5
6/* RFC 9000 13.2.1 / 13.2.2: an endpoint sends an ACK on receiving an
7 * ack-eliciting packet, within its advertised max_ack_delay. As a recommended
8 * policy it acknowledges immediately after receiving two ack-eliciting packets
9 * without yet acking; otherwise it may delay until max_ack_delay elapses since
10 * the oldest unacked ack-eliciting packet. Time is abstracted as a monotonic
11 * tick count; max_ack_delay is expressed in the same unit. */
12
14typedef struct {
17} ackpolicy;
18
19void ackpolicy_init(ackpolicy* p);
20
21/* Record receipt of an ack-eliciting packet at the given tick. */
22void ackpolicy_on_eliciting(ackpolicy* p, u64 tick);
23
24/* Whether an ACK should be sent now: true once two or more ack-eliciting
25 * packets are pending, or once max_ack_delay has elapsed since the oldest. */
26int ackpolicy_should_ack(const ackpolicy* p, u64 now, u64 max_ack_delay);
27
28/* Clear pending state after an ACK has been sent. */
29void ackpolicy_on_ack_sent(ackpolicy* p);
30
31#endif
Delayed-ACK timer state for one packet number space.
Definition ackpolicy.h:14
u64 pending
unacked ack-eliciting packets received
Definition ackpolicy.h:15
u64 since_tick
tick of the oldest currently-pending packet
Definition ackpolicy.h:16
Linux direct syscalls.
unsigned long u64
unsigned 64-bit integer
Definition types.h:13