OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Accumulates frames for the next packet until more frames no longer fit or | 5 // Accumulates frames for the next packet until more frames no longer fit or |
6 // it's time to create a packet from them. If multipath enabled, only creates | 6 // it's time to create a packet from them. If multipath enabled, only creates |
7 // packets on one path at the same time. Currently, next packet number is | 7 // packets on one path at the same time. Currently, next packet number is |
8 // tracked per-path. | 8 // tracked per-path. |
9 | 9 |
10 #ifndef NET_QUIC_CORE_QUIC_PACKET_CREATOR_H_ | 10 #ifndef NET_QUIC_CORE_QUIC_PACKET_CREATOR_H_ |
11 #define NET_QUIC_CORE_QUIC_PACKET_CREATOR_H_ | 11 #define NET_QUIC_CORE_QUIC_PACKET_CREATOR_H_ |
12 | 12 |
13 #include <stddef.h> | 13 #include <stddef.h> |
14 | 14 |
15 #include <memory> | 15 #include <memory> |
16 #include <string> | 16 #include <string> |
17 #include <unordered_map> | 17 #include <unordered_map> |
18 #include <utility> | 18 #include <utility> |
19 #include <vector> | 19 #include <vector> |
20 | 20 |
21 #include "base/macros.h" | 21 #include "base/macros.h" |
22 #include "base/strings/string_piece.h" | 22 #include "base/strings/string_piece.h" |
23 #include "net/base/net_export.h" | |
24 #include "net/quic/core/quic_connection_close_delegate_interface.h" | 23 #include "net/quic/core/quic_connection_close_delegate_interface.h" |
25 #include "net/quic/core/quic_framer.h" | 24 #include "net/quic/core/quic_framer.h" |
26 #include "net/quic/core/quic_iovector.h" | 25 #include "net/quic/core/quic_iovector.h" |
27 #include "net/quic/core/quic_packets.h" | 26 #include "net/quic/core/quic_packets.h" |
28 #include "net/quic/core/quic_pending_retransmission.h" | 27 #include "net/quic/core/quic_pending_retransmission.h" |
| 28 #include "net/quic/platform/api/quic_export.h" |
29 | 29 |
30 namespace net { | 30 namespace net { |
31 namespace test { | 31 namespace test { |
32 class QuicPacketCreatorPeer; | 32 class QuicPacketCreatorPeer; |
33 } | 33 } |
34 | 34 |
35 class NET_EXPORT_PRIVATE QuicPacketCreator { | 35 class QUIC_EXPORT_PRIVATE QuicPacketCreator { |
36 public: | 36 public: |
37 // A delegate interface for further processing serialized packet. | 37 // A delegate interface for further processing serialized packet. |
38 class NET_EXPORT_PRIVATE DelegateInterface | 38 class QUIC_EXPORT_PRIVATE DelegateInterface |
39 : public QuicConnectionCloseDelegateInterface { | 39 : public QuicConnectionCloseDelegateInterface { |
40 public: | 40 public: |
41 ~DelegateInterface() override {} | 41 ~DelegateInterface() override {} |
42 // Called when a packet is serialized. Delegate does not take the ownership | 42 // Called when a packet is serialized. Delegate does not take the ownership |
43 // of |serialized_packet|, but takes ownership of any frames it removes | 43 // of |serialized_packet|, but takes ownership of any frames it removes |
44 // from |packet.retransmittable_frames|. | 44 // from |packet.retransmittable_frames|. |
45 virtual void OnSerializedPacket(SerializedPacket* serialized_packet) = 0; | 45 virtual void OnSerializedPacket(SerializedPacket* serialized_packet) = 0; |
46 }; | 46 }; |
47 | 47 |
48 // Interface which gets callbacks from the QuicPacketCreator at interesting | 48 // Interface which gets callbacks from the QuicPacketCreator at interesting |
49 // points. Implementations must not mutate the state of the creator | 49 // points. Implementations must not mutate the state of the creator |
50 // as a result of these callbacks. | 50 // as a result of these callbacks. |
51 class NET_EXPORT_PRIVATE DebugDelegate { | 51 class QUIC_EXPORT_PRIVATE DebugDelegate { |
52 public: | 52 public: |
53 virtual ~DebugDelegate() {} | 53 virtual ~DebugDelegate() {} |
54 | 54 |
55 // Called when a frame has been added to the current packet. | 55 // Called when a frame has been added to the current packet. |
56 virtual void OnFrameAddedToPacket(const QuicFrame& frame) {} | 56 virtual void OnFrameAddedToPacket(const QuicFrame& frame) {} |
57 }; | 57 }; |
58 | 58 |
59 QuicPacketCreator(QuicConnectionId connection_id, | 59 QuicPacketCreator(QuicConnectionId connection_id, |
60 QuicFramer* framer, | 60 QuicFramer* framer, |
61 QuicBufferAllocator* buffer_allocator, | 61 QuicBufferAllocator* buffer_allocator, |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 311 |
312 // Map mapping path_id to last sent packet number on the path. | 312 // Map mapping path_id to last sent packet number on the path. |
313 std::unordered_map<QuicPathId, QuicPacketNumber> multipath_packet_number_; | 313 std::unordered_map<QuicPathId, QuicPacketNumber> multipath_packet_number_; |
314 | 314 |
315 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); | 315 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); |
316 }; | 316 }; |
317 | 317 |
318 } // namespace net | 318 } // namespace net |
319 | 319 |
320 #endif // NET_QUIC_CORE_QUIC_PACKET_CREATOR_H_ | 320 #endif // NET_QUIC_CORE_QUIC_PACKET_CREATOR_H_ |
OLD | NEW |