blob: 1b909cea4b19bbe6934bd447ee6b86840a4c23ed [file] [log] [blame]
QUICHE teama6ef0a62019-03-07 20:34:33 -05001// 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
15namespace quic {
16
17struct QUIC_EXPORT_PRIVATE QuicConnectionCloseFrame {
18 QuicConnectionCloseFrame();
vasilvvc48c8712019-03-11 13:38:16 -070019 QuicConnectionCloseFrame(QuicErrorCode error_code, std::string error_details);
QUICHE teama6ef0a62019-03-07 20:34:33 -050020 QuicConnectionCloseFrame(QuicIetfTransportErrorCodes ietf_error_code,
vasilvvc48c8712019-03-11 13:38:16 -070021 std::string error_details,
QUICHE teama6ef0a62019-03-07 20:34:33 -050022 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 };
vasilvvc48c8712019-03-11 13:38:16 -070036 std::string error_details;
QUICHE teama6ef0a62019-03-07 20:34:33 -050037
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_