QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 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_CONNECTION_CLOSE_FRAME_H_ |
| 6 | #define QUICHE_QUIC_CORE_FRAMES_QUIC_CONNECTION_CLOSE_FRAME_H_ |
| 7 | |
| 8 | #include <ostream> |
| 9 | |
| 10 | #include "net/third_party/quiche/src/quic/core/quic_error_codes.h" |
| 11 | #include "net/third_party/quiche/src/quic/core/quic_types.h" |
| 12 | #include "net/third_party/quiche/src/quic/platform/api/quic_export.h" |
| 13 | #include "net/third_party/quiche/src/quic/platform/api/quic_string.h" |
| 14 | |
| 15 | namespace quic { |
| 16 | |
| 17 | struct QUIC_EXPORT_PRIVATE QuicConnectionCloseFrame { |
| 18 | QuicConnectionCloseFrame(); |
vasilvv | c48c871 | 2019-03-11 13:38:16 -0700 | [diff] [blame] | 19 | QuicConnectionCloseFrame(QuicErrorCode error_code, std::string error_details); |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 20 | QuicConnectionCloseFrame(QuicIetfTransportErrorCodes ietf_error_code, |
vasilvv | c48c871 | 2019-03-11 13:38:16 -0700 | [diff] [blame] | 21 | std::string error_details, |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 22 | uint64_t frame_type); |
| 23 | |
| 24 | friend QUIC_EXPORT_PRIVATE std::ostream& operator<<( |
| 25 | std::ostream& os, |
| 26 | const QuicConnectionCloseFrame& c); |
| 27 | |
| 28 | // Set error_code or ietf_error_code based on the transport version |
| 29 | // currently in use. |
| 30 | union { |
| 31 | // IETF QUIC has a different set of error codes. Include both |
| 32 | // code-sets. |
| 33 | QuicErrorCode error_code; |
| 34 | QuicIetfTransportErrorCodes ietf_error_code; |
| 35 | }; |
vasilvv | c48c871 | 2019-03-11 13:38:16 -0700 | [diff] [blame] | 36 | std::string error_details; |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 37 | |
| 38 | // Contains the type of frame that triggered the connection close. Made a |
| 39 | // uint64, as opposed to the QuicIetfFrameType, to support possible |
| 40 | // extensions as well as reporting invalid frame types received from the peer. |
| 41 | uint64_t frame_type; |
| 42 | }; |
| 43 | |
| 44 | } // namespace quic |
| 45 | |
| 46 | #endif // QUICHE_QUIC_CORE_FRAMES_QUIC_CONNECTION_CLOSE_FRAME_H_ |