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

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

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

Powered by Google App Engine
This is Rietveld 408576698