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_QUIC_PACKET_CREATOR_H_ | 10 #ifndef NET_QUIC_QUIC_PACKET_CREATOR_H_ |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // Re-serializes frames with the original packet's packet number length. | 108 // Re-serializes frames with the original packet's packet number length. |
109 // Used for retransmitting packets to ensure they aren't too long. | 109 // Used for retransmitting packets to ensure they aren't too long. |
110 void ReserializeAllFrames(const PendingRetransmission& retransmission, | 110 void ReserializeAllFrames(const PendingRetransmission& retransmission, |
111 char* buffer, | 111 char* buffer, |
112 size_t buffer_len); | 112 size_t buffer_len); |
113 | 113 |
114 // Serializes all added frames into a single packet and invokes the delegate_ | 114 // Serializes all added frames into a single packet and invokes the delegate_ |
115 // to further process the SerializedPacket. | 115 // to further process the SerializedPacket. |
116 void Flush(); | 116 void Flush(); |
117 | 117 |
118 // Optimized method to create a QuicStreamFrame, serialize it, and encrypt it | 118 // Optimized method to create a QuicStreamFrame and serialize it. Adds the |
119 // into |encrypted_buffer|. Adds the QuicStreamFrame to the returned | 119 // QuicStreamFrame to the returned SerializedPacket. Sets |
120 // SerializedPacket. Sets |num_bytes_consumed| to the number of bytes | 120 // |num_bytes_consumed| to the number of bytes consumed to create the |
121 // consumed to create the QuicStreamFrame. | 121 // QuicStreamFrame. |
122 void CreateAndSerializeStreamFrame(QuicStreamId id, | 122 void CreateAndSerializeStreamFrame(QuicStreamId id, |
123 const QuicIOVector& iov, | 123 const QuicIOVector& iov, |
124 QuicStreamOffset iov_offset, | 124 QuicStreamOffset iov_offset, |
125 QuicStreamOffset stream_offset, | 125 QuicStreamOffset stream_offset, |
126 bool fin, | 126 bool fin, |
127 QuicAckListenerInterface* listener, | 127 QuicAckListenerInterface* listener, |
128 char* encrypted_buffer, | |
129 size_t encrypted_buffer_len, | |
130 size_t* num_bytes_consumed); | 128 size_t* num_bytes_consumed); |
131 | 129 |
132 // Returns true if there are frames pending to be serialized. | 130 // Returns true if there are frames pending to be serialized. |
133 bool HasPendingFrames() const; | 131 bool HasPendingFrames() const; |
134 | 132 |
135 // Returns true if there are retransmittable frames pending to be serialized. | 133 // Returns true if there are retransmittable frames pending to be serialized. |
136 bool HasPendingRetransmittableFrames() const; | 134 bool HasPendingRetransmittableFrames() const; |
137 | 135 |
138 // Returns the number of bytes which are available to be used by additional | 136 // Returns the number of bytes which are available to be used by additional |
139 // frames in the packet. Since stream frames are slightly smaller when they | 137 // frames in the packet. Since stream frames are slightly smaller when they |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 343 |
346 // Map mapping path_id to last sent packet number on the path. | 344 // Map mapping path_id to last sent packet number on the path. |
347 std::unordered_map<QuicPathId, QuicPacketNumber> multipath_packet_number_; | 345 std::unordered_map<QuicPathId, QuicPacketNumber> multipath_packet_number_; |
348 | 346 |
349 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); | 347 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); |
350 }; | 348 }; |
351 | 349 |
352 } // namespace net | 350 } // namespace net |
353 | 351 |
354 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ | 352 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ |
OLD | NEW |