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

Side by Side Diff: net/quic/quic_packet_writer.h

Issue 1662433002: Per-packet options now passed through to QuicPacketWriter, instead of (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@113054959
Patch Set: Fix comments for Patch Set 1 Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « net/quic/quic_connection_test.cc ('k') | net/quic/quic_session_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include "net/base/ip_endpoint.h" 10 #include "net/base/ip_endpoint.h"
11 #include "net/quic/quic_protocol.h" 11 #include "net/quic/quic_protocol.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 struct WriteResult; 15 struct WriteResult;
16 16
17 class NET_EXPORT_PRIVATE PerPacketOptions {
18 public:
19 PerPacketOptions() = default;
20 virtual ~PerPacketOptions() {}
21
22 // Returns a heap-allocated copy of |this|.
23 virtual PerPacketOptions* Clone() const = 0;
24
25 private:
26 PerPacketOptions(PerPacketOptions&& other) = delete;
27 PerPacketOptions& operator=(PerPacketOptions&& other) = delete;
28
29 DISALLOW_COPY_AND_ASSIGN(PerPacketOptions);
30 };
31
17 // An interface between writers and the entity managing the 32 // An interface between writers and the entity managing the
18 // socket (in our case the QuicDispatcher). This allows the Dispatcher to 33 // socket (in our case the QuicDispatcher). This allows the Dispatcher to
19 // control writes, and manage any writers who end up write blocked. 34 // control writes, and manage any writers who end up write blocked.
20 class NET_EXPORT_PRIVATE QuicPacketWriter { 35 class NET_EXPORT_PRIVATE QuicPacketWriter {
21 public: 36 public:
22 virtual ~QuicPacketWriter() {} 37 virtual ~QuicPacketWriter() {}
23 38
24 // Sends the packet out to the peer. If the write succeeded, the result's 39 // Sends the packet out to the peer, with some optional per-packet options.
25 // status is WRITE_STATUS_OK and bytes_written is populated. If the write 40 // If the write succeeded, the result's status is WRITE_STATUS_OK and
26 // failed, the result's status is WRITE_STATUS_BLOCKED or WRITE_STATUS_ERROR 41 // bytes_written is populated. If the write failed, the result's status is
27 // and error_code is populated. 42 // WRITE_STATUS_BLOCKED or WRITE_STATUS_ERROR and error_code is populated.
43 // Options must be either null, or created for the particular QuicPacketWriter
44 // implementation. Options may be ignored, depending on the implementation.
28 virtual WriteResult WritePacket(const char* buffer, 45 virtual WriteResult WritePacket(const char* buffer,
29 size_t buf_len, 46 size_t buf_len,
30 const IPAddressNumber& self_address, 47 const IPAddressNumber& self_address,
31 const IPEndPoint& peer_address) = 0; 48 const IPEndPoint& peer_address,
49 PerPacketOptions* options) = 0;
32 50
33 // Returns true if the writer buffers and subsequently rewrites data 51 // Returns true if the writer buffers and subsequently rewrites data
34 // when an attempt to write results in the underlying socket becoming 52 // when an attempt to write results in the underlying socket becoming
35 // write blocked. 53 // write blocked.
36 virtual bool IsWriteBlockedDataBuffered() const = 0; 54 virtual bool IsWriteBlockedDataBuffered() const = 0;
37 55
38 // Returns true if the network socket is not writable. 56 // Returns true if the network socket is not writable.
39 virtual bool IsWriteBlocked() const = 0; 57 virtual bool IsWriteBlocked() const = 0;
40 58
41 // Records that the socket has become writable, for example when an EPOLLOUT 59 // Records that the socket has become writable, for example when an EPOLLOUT
42 // is received or an asynchronous write completes. 60 // is received or an asynchronous write completes.
43 virtual void SetWritable() = 0; 61 virtual void SetWritable() = 0;
44 62
45 // Returns the maximum size of the packet which can be written using this 63 // Returns the maximum size of the packet which can be written using this
46 // writer for the supplied peer address. This size may actually exceed the 64 // writer for the supplied peer address. This size may actually exceed the
47 // size of a valid QUIC packet. 65 // size of a valid QUIC packet.
48 virtual QuicByteCount GetMaxPacketSize( 66 virtual QuicByteCount GetMaxPacketSize(
49 const IPEndPoint& peer_address) const = 0; 67 const IPEndPoint& peer_address) const = 0;
50 }; 68 };
51 69
52 } // namespace net 70 } // namespace net
53 71
54 #endif // NET_QUIC_QUIC_PACKET_WRITER_H_ 72 #endif // NET_QUIC_QUIC_PACKET_WRITER_H_
OLDNEW
« no previous file with comments | « net/quic/quic_connection_test.cc ('k') | net/quic/quic_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698