Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: net/tools/quic/test_tools/packet_reordering_writer.h

Issue 2236973002: Landing Recent QUIC changes until 4AM, Aug 7, 2016 UTC-4 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: flip quic_sequencer_buffer_retire_block_in_time to true Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/quic/stateless_rejector_test.cc ('k') | net/tools/quic/test_tools/packet_reordering_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/test_tools/packet_reordering_writer.h
diff --git a/net/tools/quic/test_tools/packet_reordering_writer.h b/net/tools/quic/test_tools/packet_reordering_writer.h
new file mode 100644
index 0000000000000000000000000000000000000000..d09aeb84a3a21cf39952c6313372af34f18fc142
--- /dev/null
+++ b/net/tools/quic/test_tools/packet_reordering_writer.h
@@ -0,0 +1,45 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_TOOLS_QUIC_TEST_TOOLS_PACKET_REORDERING_WRITER_H_
+#define NET_TOOLS_QUIC_TEST_TOOLS_PACKET_REORDERING_WRITER_H_
+
+#include "net/tools/quic/quic_packet_writer_wrapper.h"
+
+namespace net {
+
+namespace test {
+
+// This packet writer allows delaying writing the next packet after
+// SetDelay(num_packets_to_wait)
+// is called and buffer this packet and write it after it writes next
+// |num_packets_to_wait| packets. It doesn't support delaying a packet while
+// there is already a packet delayed.
+class PacketReorderingWriter : public QuicPacketWriterWrapper {
+ public:
+ PacketReorderingWriter();
+
+ ~PacketReorderingWriter() override;
+
+ WriteResult WritePacket(const char* buffer,
+ size_t buf_len,
+ const IPAddress& self_address,
+ const IPEndPoint& peer_address,
+ PerPacketOptions* options) override;
+
+ void SetDelay(size_t num_packets_to_wait);
+
+ private:
+ bool delay_next_ = false;
+ size_t num_packets_to_wait_ = 0;
+ std::string delayed_data_;
+ IPAddress delayed_self_address_;
+ IPEndPoint delayed_peer_address_;
+ std::unique_ptr<PerPacketOptions> delayed_options_;
+};
+
+} // namespace test
+} // namespace net
+
+#endif // NET_TOOLS_QUIC_TEST_TOOLS_PACKET_REORDERING_WRITER_H_
« no previous file with comments | « net/tools/quic/stateless_rejector_test.cc ('k') | net/tools/quic/test_tools/packet_reordering_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698