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_CORE_QUIC_PACKET_WRITER_H_ | 5 #ifndef NET_QUIC_CORE_QUIC_PACKET_WRITER_H_ |
6 #define NET_QUIC_CORE_QUIC_PACKET_WRITER_H_ | 6 #define NET_QUIC_CORE_QUIC_PACKET_WRITER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "net/base/net_export.h" | |
11 #include "net/quic/core/quic_packets.h" | 10 #include "net/quic/core/quic_packets.h" |
| 11 #include "net/quic/platform/api/quic_export.h" |
12 #include "net/quic/platform/api/quic_socket_address.h" | 12 #include "net/quic/platform/api/quic_socket_address.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 struct WriteResult; | 16 struct WriteResult; |
17 | 17 |
18 class NET_EXPORT_PRIVATE PerPacketOptions { | 18 class QUIC_EXPORT_PRIVATE PerPacketOptions { |
19 public: | 19 public: |
20 PerPacketOptions() = default; | 20 PerPacketOptions() = default; |
21 virtual ~PerPacketOptions() {} | 21 virtual ~PerPacketOptions() {} |
22 | 22 |
23 // Returns a heap-allocated copy of |this|. | 23 // Returns a heap-allocated copy of |this|. |
24 virtual PerPacketOptions* Clone() const = 0; | 24 virtual PerPacketOptions* Clone() const = 0; |
25 | 25 |
26 private: | 26 private: |
27 PerPacketOptions(PerPacketOptions&& other) = delete; | 27 PerPacketOptions(PerPacketOptions&& other) = delete; |
28 PerPacketOptions& operator=(PerPacketOptions&& other) = delete; | 28 PerPacketOptions& operator=(PerPacketOptions&& other) = delete; |
29 | 29 |
30 DISALLOW_COPY_AND_ASSIGN(PerPacketOptions); | 30 DISALLOW_COPY_AND_ASSIGN(PerPacketOptions); |
31 }; | 31 }; |
32 | 32 |
33 // An interface between writers and the entity managing the | 33 // An interface between writers and the entity managing the |
34 // socket (in our case the QuicDispatcher). This allows the Dispatcher to | 34 // socket (in our case the QuicDispatcher). This allows the Dispatcher to |
35 // control writes, and manage any writers who end up write blocked. | 35 // control writes, and manage any writers who end up write blocked. |
36 class NET_EXPORT_PRIVATE QuicPacketWriter { | 36 class QUIC_EXPORT_PRIVATE QuicPacketWriter { |
37 public: | 37 public: |
38 virtual ~QuicPacketWriter() {} | 38 virtual ~QuicPacketWriter() {} |
39 | 39 |
40 // Sends the packet out to the peer, with some optional per-packet options. | 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 | 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 | 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. | 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 | 44 // Options must be either null, or created for the particular QuicPacketWriter |
45 // implementation. Options may be ignored, depending on the implementation. | 45 // implementation. Options may be ignored, depending on the implementation. |
46 virtual WriteResult WritePacket(const char* buffer, | 46 virtual WriteResult WritePacket(const char* buffer, |
(...skipping 17 matching lines...) Expand all Loading... |
64 // Returns the maximum size of the packet which can be written using this | 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 | 65 // writer for the supplied peer address. This size may actually exceed the |
66 // size of a valid QUIC packet. | 66 // size of a valid QUIC packet. |
67 virtual QuicByteCount GetMaxPacketSize( | 67 virtual QuicByteCount GetMaxPacketSize( |
68 const QuicSocketAddress& peer_address) const = 0; | 68 const QuicSocketAddress& peer_address) const = 0; |
69 }; | 69 }; |
70 | 70 |
71 } // namespace net | 71 } // namespace net |
72 | 72 |
73 #endif // NET_QUIC_CORE_QUIC_PACKET_WRITER_H_ | 73 #endif // NET_QUIC_CORE_QUIC_PACKET_WRITER_H_ |
OLD | NEW |