• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2018 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_STOP_SENDING_FRAME_H_
6 #define QUICHE_QUIC_CORE_FRAMES_QUIC_STOP_SENDING_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_error_codes.h"
13 #include "quiche/quic/core/quic_types.h"
14 
15 namespace quic {
16 
17 struct QUIC_EXPORT_PRIVATE QuicStopSendingFrame
18     : public QuicInlinedFrame<QuicStopSendingFrame> {
19   QuicStopSendingFrame();
20   QuicStopSendingFrame(QuicControlFrameId control_frame_id,
21                        QuicStreamId stream_id,
22                        QuicRstStreamErrorCode error_code);
23   QuicStopSendingFrame(QuicControlFrameId control_frame_id,
24                        QuicStreamId stream_id, QuicResetStreamError error);
25 
26   friend QUIC_EXPORT_PRIVATE std::ostream& operator<<(
27       std::ostream& os, const QuicStopSendingFrame& frame);
28 
29   QuicFrameType type;
30 
31   // A unique identifier of this control frame. 0 when this frame is received,
32   // and non-zero when sent.
33   QuicControlFrameId control_frame_id = kInvalidControlFrameId;
34   QuicStreamId stream_id = 0;
35 
36   // For an outgoing frame, the error code generated by the application that
37   // determines |ietf_error_code| to be sent on the wire; for an incoming frame,
38   // the error code inferred from |ietf_error_code| received on the wire.
39   QuicRstStreamErrorCode error_code = QUIC_STREAM_NO_ERROR;
40 
41   // On-the-wire application error code of the frame.
42   uint64_t ietf_error_code = 0;
43 
44   // Returns a tuple of both |error_code| and |ietf_error_code|.
errorQuicStopSendingFrame45   QuicResetStreamError error() const {
46     return QuicResetStreamError(error_code, ietf_error_code);
47   }
48 };
49 
50 }  // namespace quic
51 
52 #endif  // QUICHE_QUIC_CORE_FRAMES_QUIC_STOP_SENDING_FRAME_H_
53