QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 1 | // Copyright (c) 2012 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_TEST_TOOLS_SIMPLE_QUIC_FRAMER_H_ |
| 6 | #define QUICHE_QUIC_TEST_TOOLS_SIMPLE_QUIC_FRAMER_H_ |
| 7 | |
| 8 | #include <memory> |
| 9 | #include <vector> |
| 10 | |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 11 | #include "net/third_party/quiche/src/quic/core/quic_framer.h" |
| 12 | #include "net/third_party/quiche/src/quic/core/quic_packets.h" |
| 13 | |
| 14 | namespace quic { |
| 15 | |
| 16 | struct QuicAckFrame; |
| 17 | |
| 18 | namespace test { |
| 19 | |
| 20 | class SimpleFramerVisitor; |
| 21 | |
| 22 | // Peer to make public a number of otherwise private QuicFramer methods. |
| 23 | class SimpleQuicFramer { |
| 24 | public: |
| 25 | SimpleQuicFramer(); |
| 26 | explicit SimpleQuicFramer(const ParsedQuicVersionVector& supported_versions); |
| 27 | SimpleQuicFramer(const ParsedQuicVersionVector& supported_versions, |
| 28 | Perspective perspective); |
| 29 | SimpleQuicFramer(const SimpleQuicFramer&) = delete; |
| 30 | SimpleQuicFramer& operator=(const SimpleQuicFramer&) = delete; |
| 31 | ~SimpleQuicFramer(); |
| 32 | |
| 33 | bool ProcessPacket(const QuicEncryptedPacket& packet); |
| 34 | void Reset(); |
| 35 | |
| 36 | const QuicPacketHeader& header() const; |
| 37 | size_t num_frames() const; |
| 38 | const std::vector<QuicAckFrame>& ack_frames() const; |
| 39 | const std::vector<QuicConnectionCloseFrame>& connection_close_frames() const; |
| 40 | const std::vector<QuicStopWaitingFrame>& stop_waiting_frames() const; |
| 41 | const std::vector<QuicPathChallengeFrame>& path_challenge_frames() const; |
| 42 | const std::vector<QuicPathResponseFrame>& path_response_frames() const; |
| 43 | const std::vector<QuicPingFrame>& ping_frames() const; |
| 44 | const std::vector<QuicMessageFrame>& message_frames() const; |
| 45 | const std::vector<QuicWindowUpdateFrame>& window_update_frames() const; |
| 46 | const std::vector<QuicGoAwayFrame>& goaway_frames() const; |
| 47 | const std::vector<QuicRstStreamFrame>& rst_stream_frames() const; |
| 48 | const std::vector<std::unique_ptr<QuicStreamFrame>>& stream_frames() const; |
| 49 | const std::vector<std::unique_ptr<QuicCryptoFrame>>& crypto_frames() const; |
| 50 | const std::vector<QuicPaddingFrame>& padding_frames() const; |
| 51 | const QuicVersionNegotiationPacket* version_negotiation_packet() const; |
| 52 | EncryptionLevel last_decrypted_level() const; |
| 53 | |
| 54 | QuicFramer* framer(); |
| 55 | |
| 56 | void SetSupportedVersions(const ParsedQuicVersionVector& versions) { |
| 57 | framer_.SetSupportedVersions(versions); |
| 58 | } |
| 59 | |
| 60 | private: |
| 61 | QuicFramer framer_; |
| 62 | std::unique_ptr<SimpleFramerVisitor> visitor_; |
| 63 | }; |
| 64 | |
| 65 | } // namespace test |
| 66 | |
| 67 | } // namespace quic |
| 68 | |
| 69 | #endif // QUICHE_QUIC_TEST_TOOLS_SIMPLE_QUIC_FRAMER_H_ |