OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016 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 NET_QUIC_QUARTC_QUARTC_PACKET_WRITER_H_ |
| 6 #define NET_QUIC_QUARTC_QUARTC_PACKET_WRITER_H_ |
| 7 |
| 8 #include "net/quic/core/quic_packet_writer.h" |
| 9 #include "net/quic/quartc/quartc_session_interface.h" |
| 10 |
| 11 namespace net { |
| 12 |
| 13 // Implements a QuicPacketWriter using a |
| 14 // QuartcSessionInterface::PacketTransport, which allows a QuicConnection to |
| 15 // use(for example), a WebRTC IceTransport. |
| 16 class NET_EXPORT_PRIVATE QuartcPacketWriter : public QuicPacketWriter { |
| 17 public: |
| 18 QuartcPacketWriter(QuartcSessionInterface::PacketTransport* packet_transport, |
| 19 QuicByteCount max_packet_size); |
| 20 ~QuartcPacketWriter() override {} |
| 21 |
| 22 // The QuicConnection calls WritePacket and the QuicPacketWriter writes them |
| 23 // to the QuartcSessionInterface::PacketTransport. |
| 24 WriteResult WritePacket(const char* buffer, |
| 25 size_t buf_len, |
| 26 const IPAddress& self_address, |
| 27 const IPEndPoint& peer_address, |
| 28 PerPacketOptions* options) override; |
| 29 |
| 30 // This is always set to false so that QuicConnection buffers unsent packets. |
| 31 bool IsWriteBlockedDataBuffered() const override; |
| 32 |
| 33 // Whether the underneath |transport_| is blocked. If this returns true, |
| 34 // outgoing QUIC packets are queued by QuicConnection until |
| 35 // Transport::Observer::OnCanWrite() is called. |
| 36 bool IsWriteBlocked() const override; |
| 37 |
| 38 // Maximum size of the QUIC packet which can be written. Users such as WebRTC |
| 39 // can set the value through the QuartcFactoryConfig without updating the QUIC |
| 40 // code. |
| 41 QuicByteCount GetMaxPacketSize(const IPEndPoint& peer_address) const override; |
| 42 |
| 43 // This method is not used because the network layer in WebRTC will determine |
| 44 // the writing states. |
| 45 void SetWritable() override; |
| 46 |
| 47 private: |
| 48 // QuartcPacketWriter will not own the transport. |
| 49 QuartcSessionInterface::PacketTransport* packet_transport_; |
| 50 // The maximum size of the packet can be written by this writer. |
| 51 QuicByteCount max_packet_size_; |
| 52 }; |
| 53 |
| 54 } // namespace net |
| 55 |
| 56 #endif // NET_QUIC_QUARTC_QUARTC_PACKET_WRITER_H_ |
OLD | NEW |