xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/quic/core/frames/quic_window_update_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_WINDOW_UPDATE_FRAME_H_
6 #define QUICHE_QUIC_CORE_FRAMES_QUIC_WINDOW_UPDATE_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 // Flow control updates per-stream and at the connection level.
17 // Based on SPDY's WINDOW_UPDATE frame, but uses an absolute max data bytes
18 // rather than a window delta.
19 struct QUICHE_EXPORT QuicWindowUpdateFrame
20     : public QuicInlinedFrame<QuicWindowUpdateFrame> {
21   QuicWindowUpdateFrame();
22   QuicWindowUpdateFrame(QuicControlFrameId control_frame_id,
23                         QuicStreamId stream_id, QuicByteCount max_data);
24 
25   friend QUICHE_EXPORT std::ostream& operator<<(std::ostream& os,
26                                                 const QuicWindowUpdateFrame& w);
27 
28   bool operator==(const QuicWindowUpdateFrame& rhs) const;
29   bool operator!=(const QuicWindowUpdateFrame& rhs) const;
30 
31   QuicFrameType type;
32 
33   // A unique identifier of this control frame. 0 when this frame is received,
34   // and non-zero when sent.
35   QuicControlFrameId control_frame_id = kInvalidControlFrameId;
36 
37   // The stream this frame applies to.  0 is a special case meaning the overall
38   // connection rather than a specific stream.
39   QuicStreamId stream_id = 0;
40 
41   // Maximum data allowed in the stream or connection. The receiver of this
42   // frame must not send data which would exceedes this restriction.
43   QuicByteCount max_data = 0;
44 };
45 
46 }  // namespace quic
47 
48 #endif  // QUICHE_QUIC_CORE_FRAMES_QUIC_WINDOW_UPDATE_FRAME_H_
49