Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / net / tools / quic / quic_per_connection_packet_writer.h
bloba442a9aa43a9502d7ab453a7142ccdf28d826425
1 // Copyright 2014 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.
5 #ifndef NET_TOOLS_QUIC_QUIC_PER_CONNECTION_PACKET_WRITER_H_
6 #define NET_TOOLS_QUIC_QUIC_PER_CONNECTION_PACKET_WRITER_H_
8 #include "net/quic/quic_connection.h"
9 #include "net/quic/quic_packet_writer.h"
11 namespace net {
13 namespace tools {
15 // A connection-specific packet writer that wraps a shared writer and keeps a
16 // reference to the connection.
17 class QuicPerConnectionPacketWriter : public QuicPacketWriter {
18 public:
19 // Does not take ownership of |shared_writer| or |connection|.
20 QuicPerConnectionPacketWriter(QuicPacketWriter* shared_writer,
21 QuicConnection* connection);
22 virtual ~QuicPerConnectionPacketWriter();
24 QuicPacketWriter* shared_writer() const { return shared_writer_; }
25 QuicConnection* connection() const { return connection_; }
27 // Default implementation of the QuicPacketWriter interface: Passes everything
28 // to |shared_writer_|.
29 virtual WriteResult WritePacket(const char* buffer,
30 size_t buf_len,
31 const IPAddressNumber& self_address,
32 const IPEndPoint& peer_address) OVERRIDE;
33 virtual bool IsWriteBlockedDataBuffered() const OVERRIDE;
34 virtual bool IsWriteBlocked() const OVERRIDE;
35 virtual void SetWritable() OVERRIDE;
37 private:
38 QuicPacketWriter* shared_writer_; // Not owned.
39 QuicConnection* connection_; // Not owned.
41 DISALLOW_COPY_AND_ASSIGN(QuicPerConnectionPacketWriter);
44 } // namespace tools
46 } // namespace net
48 #endif // NET_TOOLS_QUIC_QUIC_PER_CONNECTION_PACKET_WRITER_H_