xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/quic/core/frames/quic_stop_sending_frame.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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 #include "quiche/quic/core/frames/quic_stop_sending_frame.h"
6 
7 #include "quiche/quic/core/quic_error_codes.h"
8 
9 namespace quic {
10 
QuicStopSendingFrame()11 QuicStopSendingFrame::QuicStopSendingFrame()
12     : QuicInlinedFrame(STOP_SENDING_FRAME) {}
13 
QuicStopSendingFrame(QuicControlFrameId control_frame_id,QuicStreamId stream_id,QuicRstStreamErrorCode error_code)14 QuicStopSendingFrame::QuicStopSendingFrame(QuicControlFrameId control_frame_id,
15                                            QuicStreamId stream_id,
16                                            QuicRstStreamErrorCode error_code)
17     : QuicStopSendingFrame(control_frame_id, stream_id,
18                            QuicResetStreamError::FromInternal(error_code)) {}
19 
QuicStopSendingFrame(QuicControlFrameId control_frame_id,QuicStreamId stream_id,QuicResetStreamError error)20 QuicStopSendingFrame::QuicStopSendingFrame(QuicControlFrameId control_frame_id,
21                                            QuicStreamId stream_id,
22                                            QuicResetStreamError error)
23     : QuicInlinedFrame(STOP_SENDING_FRAME),
24       control_frame_id(control_frame_id),
25       stream_id(stream_id),
26       error_code(error.internal_code()),
27       ietf_error_code(error.ietf_application_code()) {}
28 
operator <<(std::ostream & os,const QuicStopSendingFrame & frame)29 std::ostream& operator<<(std::ostream& os, const QuicStopSendingFrame& frame) {
30   os << "{ control_frame_id: " << frame.control_frame_id
31      << ", stream_id: " << frame.stream_id
32      << ", error_code: " << frame.error_code
33      << ", ietf_error_code: " << frame.ietf_error_code << " }\n";
34   return os;
35 }
36 
operator ==(const QuicStopSendingFrame & rhs) const37 bool QuicStopSendingFrame::operator==(const QuicStopSendingFrame& rhs) const {
38   return control_frame_id == rhs.control_frame_id &&
39          stream_id == rhs.stream_id && error_code == rhs.error_code &&
40          ietf_error_code == rhs.ietf_error_code;
41 }
42 
operator !=(const QuicStopSendingFrame & rhs) const43 bool QuicStopSendingFrame::operator!=(const QuicStopSendingFrame& rhs) const {
44   return !(*this == rhs);
45 }
46 
47 }  // namespace quic
48