xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/quic/core/frames/quic_blocked_frame.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef QUICHE_QUIC_CORE_FRAMES_QUIC_BLOCKED_FRAME_H_
6 #define QUICHE_QUIC_CORE_FRAMES_QUIC_BLOCKED_FRAME_H_
7 
8 #include <ostream>
9 
10 #include "quiche/quic/core/frames/quic_inlined_frame.h"
11 #include "quiche/quic/core/quic_constants.h"
12 #include "quiche/quic/core/quic_types.h"
13 
14 namespace quic {
15 
16 // The BLOCKED frame is used to indicate to the remote endpoint that this
17 // endpoint believes itself to be flow-control blocked but otherwise ready to
18 // send data. The BLOCKED frame is purely advisory and optional.
19 // Based on SPDY's BLOCKED frame (undocumented as of 2014-01-28).
20 struct QUICHE_EXPORT QuicBlockedFrame
21     : public QuicInlinedFrame<QuicBlockedFrame> {
22   QuicBlockedFrame();
23   QuicBlockedFrame(QuicControlFrameId control_frame_id, QuicStreamId stream_id,
24                    QuicStreamOffset offset);
25 
26   friend QUICHE_EXPORT std::ostream& operator<<(std::ostream& os,
27                                                 const QuicBlockedFrame& b);
28 
29   bool operator==(const QuicBlockedFrame& rhs) const;
30   bool operator!=(const QuicBlockedFrame& rhs) const;
31 
32   QuicFrameType type;
33 
34   // A unique identifier of this control frame. 0 when this frame is received,
35   // and non-zero when sent.
36   QuicControlFrameId control_frame_id = kInvalidControlFrameId;
37 
38   // 0 is a special case meaning the connection is blocked, rather than a
39   // stream.  So stream_id 0 corresponds to a BLOCKED frame and non-0
40   // corresponds to a STREAM_BLOCKED.
41   // TODO(fkastenholz): This should be converted to use
42   // QuicUtils::GetInvalidStreamId to get the correct invalid stream id value
43   // and not rely on 0.
44   QuicStreamId stream_id = 0;
45 
46   // For Google QUIC, the offset is ignored.
47   QuicStreamOffset offset = 0;
48 };
49 
50 }  // namespace quic
51 
52 #endif  // QUICHE_QUIC_CORE_FRAMES_QUIC_BLOCKED_FRAME_H_
53