@@ -48,8 +48,14 @@ pub const FRAME_TYPE_PATH_RESPONSE: FrameType = 0x1b;
48
48
pub const FRAME_TYPE_CONNECTION_CLOSE_TRANSPORT : FrameType = 0x1c ;
49
49
pub const FRAME_TYPE_CONNECTION_CLOSE_APPLICATION : FrameType = 0x1d ;
50
50
pub const FRAME_TYPE_HANDSHAKE_DONE : FrameType = 0x1e ;
51
- // draft-ietf-quic-ack-delay
51
+ /// > A data sender signals the conditions under which it wants to receive ACK
52
+ /// > frames using an ACK_FREQUENCY frame
53
+ ///
54
+ /// <https://www.ietf.org/archive/id/draft-ietf-quic-ack-frequency-10.html#section-4>
52
55
pub const FRAME_TYPE_ACK_FREQUENCY : FrameType = 0xaf ;
56
+ // TODO: Use
57
+ /// <https://www.ietf.org/archive/id/draft-ietf-quic-ack-frequency-10.html#section-4>
58
+ pub const FRAME_IMMEDIATE_ACK : FrameType = 0x1f ;
53
59
// draft-ietf-quic-datagram
54
60
pub const FRAME_TYPE_DATAGRAM : FrameType = 0x30 ;
55
61
pub const FRAME_TYPE_DATAGRAM_WITH_LEN : FrameType = 0x31 ;
@@ -189,18 +195,30 @@ pub enum Frame<'a> {
189
195
reason_phrase : String ,
190
196
} ,
191
197
HandshakeDone ,
198
+ /// > A data sender signals the conditions under which it wants to receive
199
+ /// > ACK frames using an ACK_FREQUENCY frame
200
+ ///
201
+ /// <https://www.ietf.org/archive/id/draft-ietf-quic-ack-frequency-10.html#section-4>
192
202
AckFrequency {
193
- /// The current ACK frequency sequence number.
203
+ /// > the sequence number assigned to the ACK_FREQUENCY frame by the
204
+ /// > sender so receivers ignore obsolete frames.
194
205
seqno : u64 ,
195
- /// The number of contiguous packets that can be received without
196
- /// acknowledging immediately .
197
- tolerance : u64 ,
198
- /// The time to delay after receiving the first packet that is
199
- /// not immediately acknowledged.
206
+ /// > the maximum number of ack-eliciting packets the recipient of this
207
+ /// > frame receives before sending an acknowledgment .
208
+ ack_eliciting_threshold : u64 ,
209
+ /// > the value to which the data sender requests the data receiver
210
+ /// > update its max_ack_delay
200
211
delay : u64 ,
201
- /// Ignore reordering when deciding to immediately acknowledge.
202
- ignore_order : bool ,
212
+ /// > the maximum packet reordering before eliciting an immediate ACK, as
213
+ /// > specified in Section 6.2. If no ACK_FREQUENCY frames have been
214
+ /// > received, the data receiver immediately acknowledges any subsequent
215
+ /// > packets that are received out-of-order, as specified in Section 13.2
216
+ /// > of [QUIC-TRANSPORT], corresponding to a default value of 1. A value
217
+ /// > of 0 indicates out-of-order packets do not elicit an immediate ACK.
218
+ reordering_threshold : u64 ,
203
219
} ,
220
+ /// <https://www.ietf.org/archive/id/draft-ietf-quic-ack-frequency-10.html#section-5>
221
+ ImmediateAck ,
204
222
Datagram {
205
223
data : & ' a [ u8 ] ,
206
224
fill : bool ,
@@ -255,6 +273,7 @@ impl<'a> Frame<'a> {
255
273
}
256
274
Self :: HandshakeDone => FRAME_TYPE_HANDSHAKE_DONE ,
257
275
Self :: AckFrequency { .. } => FRAME_TYPE_ACK_FREQUENCY ,
276
+ Self :: ImmediateAck { } => FRAME_IMMEDIATE_ACK ,
258
277
Self :: Datagram { fill, .. } => {
259
278
if * fill {
260
279
FRAME_TYPE_DATAGRAM
@@ -622,25 +641,24 @@ impl<'a> Frame<'a> {
622
641
} )
623
642
}
624
643
FRAME_TYPE_HANDSHAKE_DONE => Ok ( Self :: HandshakeDone ) ,
644
+ // <https://www.ietf.org/archive/id/draft-ietf-quic-ack-frequency-10.html#section-4>
625
645
FRAME_TYPE_ACK_FREQUENCY => {
626
646
let seqno = dv ( dec) ?;
627
647
let tolerance = dv ( dec) ?;
628
648
if tolerance == 0 {
629
649
return Err ( Error :: FrameEncodingError ) ;
630
650
}
631
651
let delay = dv ( dec) ?;
632
- let ignore_order = match d ( dec. decode_uint :: < u8 > ( ) ) ? {
633
- 0 => false ,
634
- 1 => true ,
635
- _ => return Err ( Error :: FrameEncodingError ) ,
636
- } ;
652
+ let reordering_threshold = dv ( dec) ?;
637
653
Ok ( Self :: AckFrequency {
638
654
seqno,
639
- tolerance,
655
+ ack_eliciting_threshold : tolerance,
640
656
delay,
641
- ignore_order ,
657
+ reordering_threshold ,
642
658
} )
643
659
}
660
+ // <https://www.ietf.org/archive/id/draft-ietf-quic-ack-frequency-10.html#section-5>
661
+ FRAME_IMMEDIATE_ACK => Ok ( Self :: ImmediateAck { } ) ,
644
662
FRAME_TYPE_DATAGRAM | FRAME_TYPE_DATAGRAM_WITH_LEN => {
645
663
let fill = ( t & DATAGRAM_FRAME_BIT_LEN ) == 0 ;
646
664
let data = if fill {
@@ -981,9 +999,9 @@ mod tests {
981
999
fn ack_frequency ( ) {
982
1000
let f = Frame :: AckFrequency {
983
1001
seqno : 10 ,
984
- tolerance : 5 ,
1002
+ ack_eliciting_threshold : 5 ,
985
1003
delay : 2000 ,
986
- ignore_order : true ,
1004
+ reordering_threshold : 1 ,
987
1005
} ;
988
1006
just_dec ( & f, "40af0a0547d001" ) ;
989
1007
}
0 commit comments