OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_QUIC_QUIC_PACKET_WRITER_H_ | 5 #ifndef NET_QUIC_QUIC_PACKET_WRITER_H_ |
6 #define NET_QUIC_QUIC_PACKET_WRITER_H_ | 6 #define NET_QUIC_QUIC_PACKET_WRITER_H_ |
7 | 7 |
8 #include "net/base/ip_endpoint.h" | 8 #include "net/base/ip_endpoint.h" |
9 #include "net/quic/quic_protocol.h" | 9 #include "net/quic/quic_protocol.h" |
10 | 10 |
11 namespace net { | 11 namespace net { |
12 | 12 |
13 struct WriteResult; | 13 struct WriteResult; |
14 | 14 |
15 // An interface between writers and the entity managing the | 15 // An interface between writers and the entity managing the |
16 // socket (in our case the QuicDispatcher). This allows the Dispatcher to | 16 // socket (in our case the QuicDispatcher). This allows the Dispatcher to |
17 // control writes, and manage any writers who end up write blocked. | 17 // control writes, and manage any writers who end up write blocked. |
18 class NET_EXPORT_PRIVATE QuicPacketWriter { | 18 class NET_EXPORT_PRIVATE QuicPacketWriter { |
19 public: | 19 public: |
20 virtual ~QuicPacketWriter() {} | 20 virtual ~QuicPacketWriter() {} |
21 | 21 |
22 // Sends the packet out to the peer. If the write succeeded, the result's | 22 // Sends the packet out to the peer. If the write succeeded, the result's |
23 // status is WRITE_STATUS_OK and bytes_written is populated. If the write | 23 // status is WRITE_STATUS_OK and bytes_written is populated. If the write |
24 // failed, the result's status is WRITE_STATUS_BLOCKED or WRITE_STATUS_ERROR | 24 // failed, the result's status is WRITE_STATUS_BLOCKED or WRITE_STATUS_ERROR |
25 // and error_code is populated. | 25 // and error_code is populated. |
26 virtual WriteResult WritePacket( | 26 virtual WriteResult WritePacket( |
27 const char* buffer, size_t buf_len, | 27 const char* buffer, |
28 size_t buf_len, | |
28 const IPAddressNumber& self_address, | 29 const IPAddressNumber& self_address, |
29 const IPEndPoint& peer_address) = 0; | 30 const IPEndPoint& peer_address, |
31 base::Callback<void(WriteResult wr)> callback) = 0; | |
Ryan Hamilton
2014/06/18 23:59:51
This is chrome specific, and probably shouldn't go
dmz
2014/06/19 17:46:24
Done.
| |
30 | 32 |
31 // Returns true if the writer buffers and subsequently rewrites data | 33 // Returns true if the writer buffers and subsequently rewrites data |
32 // when an attempt to write results in the underlying socket becoming | 34 // when an attempt to write results in the underlying socket becoming |
33 // write blocked. | 35 // write blocked. |
34 virtual bool IsWriteBlockedDataBuffered() const = 0; | 36 virtual bool IsWriteBlockedDataBuffered() const = 0; |
35 | 37 |
36 // Returns true if the network socket is not writable. | 38 // Returns true if the network socket is not writable. |
37 virtual bool IsWriteBlocked() const = 0; | 39 virtual bool IsWriteBlocked() const = 0; |
38 | 40 |
39 // Records that the socket has become writable, for example when an EPOLLOUT | 41 // Records that the socket has become writable, for example when an EPOLLOUT |
40 // is received or an asynchronous write completes. | 42 // is received or an asynchronous write completes. |
41 virtual void SetWritable() = 0; | 43 virtual void SetWritable() = 0; |
42 }; | 44 }; |
43 | 45 |
44 } // namespace net | 46 } // namespace net |
45 | 47 |
46 #endif // NET_QUIC_QUIC_PACKET_WRITER_H_ | 48 #endif // NET_QUIC_QUIC_PACKET_WRITER_H_ |
OLD | NEW |