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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 debug_delegate_ = debug_delegate; | 207 debug_delegate_ = debug_delegate; |
208 } | 208 } |
209 | 209 |
210 private: | 210 private: |
211 friend class test::QuicPacketCreatorPeer; | 211 friend class test::QuicPacketCreatorPeer; |
212 | 212 |
213 static bool ShouldRetransmit(const QuicFrame& frame); | 213 static bool ShouldRetransmit(const QuicFrame& frame); |
214 | 214 |
215 // Converts a raw payload to a frame which fits into the current open | 215 // Converts a raw payload to a frame which fits into the current open |
216 // packet. The payload begins at |iov_offset| into the |iov|. | 216 // packet. The payload begins at |iov_offset| into the |iov|. |
217 // Returns the number of bytes consumed from data. | |
218 // If data is empty and fin is true, the expected behavior is to consume the | 217 // If data is empty and fin is true, the expected behavior is to consume the |
219 // fin but return 0. If any data is consumed, it will be copied into a | 218 // fin but return 0. If any data is consumed, it will be copied into a |
220 // new buffer that |frame| will point to and own. | 219 // new buffer that |frame| will point to and own. |
221 size_t CreateStreamFrame(QuicStreamId id, | 220 void CreateStreamFrame(QuicStreamId id, |
222 QuicIOVector iov, | 221 QuicIOVector iov, |
223 size_t iov_offset, | 222 size_t iov_offset, |
224 QuicStreamOffset offset, | 223 QuicStreamOffset offset, |
225 bool fin, | 224 bool fin, |
226 QuicFrame* frame); | 225 QuicFrame* frame); |
227 | 226 |
228 // Copies |length| bytes from iov starting at offset |iov_offset| into buffer. | 227 // Copies |length| bytes from iov starting at offset |iov_offset| into buffer. |
229 // |iov| must be at least iov_offset+length total length and buffer must be | 228 // |iov| must be at least iov_offset+length total length and buffer must be |
230 // at least |length| long. | 229 // at least |length| long. |
231 static void CopyToBuffer(QuicIOVector iov, | 230 static void CopyToBuffer(QuicIOVector iov, |
232 size_t iov_offset, | 231 size_t iov_offset, |
233 size_t length, | 232 size_t length, |
234 char* buffer); | 233 char* buffer); |
235 | 234 |
236 // Updates packet number length on packet boundary. | 235 // Updates packet number length on packet boundary. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 | 298 |
300 // Map mapping path_id to last sent packet number on the path. | 299 // Map mapping path_id to last sent packet number on the path. |
301 std::unordered_map<QuicPathId, QuicPacketNumber> multipath_packet_number_; | 300 std::unordered_map<QuicPathId, QuicPacketNumber> multipath_packet_number_; |
302 | 301 |
303 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); | 302 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); |
304 }; | 303 }; |
305 | 304 |
306 } // namespace net | 305 } // namespace net |
307 | 306 |
308 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ | 307 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ |
OLD | NEW |