blob: 08f659c61252b0788207b81b0e09e47f9faa8969 [file] [log] [blame]
QUICHE teama6ef0a62019-03-07 20:34:33 -05001// 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 team5be974e2020-12-29 18:35:24 -05008#include "quic/core/quic_packet_writer_wrapper.h"
9#include "quic/core/quic_packets.h"
QUICHE teama6ef0a62019-03-07 20:34:33 -050010
11namespace quic {
12namespace 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.
16class 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_