xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/quic/core/frames/quic_goaway_frame.cc (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 #include "quiche/quic/core/frames/quic_goaway_frame.h"
6 
7 #include <string>
8 
9 namespace quic {
10 
QuicGoAwayFrame(QuicControlFrameId control_frame_id,QuicErrorCode error_code,QuicStreamId last_good_stream_id,const std::string & reason)11 QuicGoAwayFrame::QuicGoAwayFrame(QuicControlFrameId control_frame_id,
12                                  QuicErrorCode error_code,
13                                  QuicStreamId last_good_stream_id,
14                                  const std::string& reason)
15     : control_frame_id(control_frame_id),
16       error_code(error_code),
17       last_good_stream_id(last_good_stream_id),
18       reason_phrase(reason) {}
19 
operator <<(std::ostream & os,const QuicGoAwayFrame & goaway_frame)20 std::ostream& operator<<(std::ostream& os,
21                          const QuicGoAwayFrame& goaway_frame) {
22   os << "{ control_frame_id: " << goaway_frame.control_frame_id
23      << ", error_code: " << goaway_frame.error_code
24      << ", last_good_stream_id: " << goaway_frame.last_good_stream_id
25      << ", reason_phrase: '" << goaway_frame.reason_phrase << "' }\n";
26   return os;
27 }
28 
operator ==(const QuicGoAwayFrame & rhs) const29 bool QuicGoAwayFrame::operator==(const QuicGoAwayFrame& rhs) const {
30   return control_frame_id == rhs.control_frame_id &&
31          error_code == rhs.error_code &&
32          last_good_stream_id == rhs.last_good_stream_id &&
33          reason_phrase == rhs.reason_phrase;
34 }
35 
operator !=(const QuicGoAwayFrame & rhs) const36 bool QuicGoAwayFrame::operator!=(const QuicGoAwayFrame& rhs) const {
37   return !(*this == rhs);
38 }
39 
40 }  // namespace quic
41