QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 1 | // Copyright (c) 2015 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_LIMITED_MTU_TEST_WRITER_H_ |
| 6 | #define QUICHE_QUIC_TEST_TOOLS_LIMITED_MTU_TEST_WRITER_H_ |
| 7 | |
QUICHE team | 5be974e | 2020-12-29 18:35:24 -0500 | [diff] [blame] | 8 | #include "quic/core/quic_packet_writer_wrapper.h" |
| 9 | #include "quic/core/quic_packets.h" |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 10 | |
| 11 | namespace quic { |
| 12 | namespace test { |
| 13 | |
| 14 | // Simulates a connection over a link with fixed MTU. Drops packets which |
| 15 | // exceed the MTU and passes the rest of them as-is. |
| 16 | class LimitedMtuTestWriter : public QuicPacketWriterWrapper { |
| 17 | public: |
| 18 | explicit LimitedMtuTestWriter(QuicByteCount mtu); |
| 19 | LimitedMtuTestWriter(const LimitedMtuTestWriter&) = delete; |
| 20 | LimitedMtuTestWriter& operator=(const LimitedMtuTestWriter&) = delete; |
| 21 | ~LimitedMtuTestWriter() override; |
| 22 | |
| 23 | // Inherited from QuicPacketWriterWrapper. |
| 24 | WriteResult WritePacket(const char* buffer, |
| 25 | size_t buf_len, |
| 26 | const QuicIpAddress& self_address, |
| 27 | const QuicSocketAddress& peer_address, |
| 28 | PerPacketOptions* options) override; |
| 29 | |
| 30 | private: |
| 31 | QuicByteCount mtu_; |
| 32 | }; |
| 33 | |
| 34 | } // namespace test |
| 35 | } // namespace quic |
| 36 | |
| 37 | #endif // QUICHE_QUIC_TEST_TOOLS_LIMITED_MTU_TEST_WRITER_H_ |