| 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. Also provides packet creation of | 6 // it's time to create a packet from them. Also provides packet creation of |
| 7 // FEC packets based on previously created packets. | 7 // FEC packets based on previously created packets. |
| 8 | 8 |
| 9 #ifndef NET_QUIC_QUIC_PACKET_CREATOR_H_ | 9 #ifndef NET_QUIC_QUIC_PACKET_CREATOR_H_ |
| 10 #define NET_QUIC_QUIC_PACKET_CREATOR_H_ | 10 #define NET_QUIC_QUIC_PACKET_CREATOR_H_ |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 size_t max_packets_per_fec_group() const { | 219 size_t max_packets_per_fec_group() const { |
| 220 return max_packets_per_fec_group_; | 220 return max_packets_per_fec_group_; |
| 221 } | 221 } |
| 222 | 222 |
| 223 // Sets creator's max number of packets covered by an FEC group. | 223 // Sets creator's max number of packets covered by an FEC group. |
| 224 // Note: While there are no constraints on |max_packets_per_fec_group|, | 224 // Note: While there are no constraints on |max_packets_per_fec_group|, |
| 225 // this setter enforces a min value of kLowestMaxPacketsPerFecGroup. | 225 // this setter enforces a min value of kLowestMaxPacketsPerFecGroup. |
| 226 // To turn off FEC protection, use StopFecProtectingPackets(). | 226 // To turn off FEC protection, use StopFecProtectingPackets(). |
| 227 void set_max_packets_per_fec_group(size_t max_packets_per_fec_group); | 227 void set_max_packets_per_fec_group(size_t max_packets_per_fec_group); |
| 228 | 228 |
| 229 // Returns the currently open FEC group's number. If there isn't an open FEC | 229 // Returns the currently open FEC group's number. Returns 0 when FEC is |
| 230 // group, returns the last closed FEC group number. Returns 0 when FEC is | 230 // disabled or no FEC group is open. |
| 231 // disabled or no FEC group has been created yet. | 231 QuicFecGroupNumber fec_group_number(); |
| 232 QuicFecGroupNumber fec_group_number() { return fec_group_number_; } | |
| 233 | 232 |
| 234 private: | 233 private: |
| 235 friend class test::QuicPacketCreatorPeer; | 234 friend class test::QuicPacketCreatorPeer; |
| 236 | 235 |
| 237 static bool ShouldRetransmit(const QuicFrame& frame); | 236 static bool ShouldRetransmit(const QuicFrame& frame); |
| 238 | 237 |
| 239 // Copies |length| bytes from iov starting at offset |iov_offset| into buffer. | 238 // Copies |length| bytes from iov starting at offset |iov_offset| into buffer. |
| 240 // |iov| must be at least iov_offset+length total length and buffer must be | 239 // |iov| must be at least iov_offset+length total length and buffer must be |
| 241 // at least |length| long. | 240 // at least |length| long. |
| 242 static void CopyToBuffer(QuicIOVector iov, | 241 static void CopyToBuffer(QuicIOVector iov, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 269 // padding frame. | 268 // padding frame. |
| 270 void MaybeAddPadding(); | 269 void MaybeAddPadding(); |
| 271 | 270 |
| 272 QuicConnectionId connection_id_; | 271 QuicConnectionId connection_id_; |
| 273 EncryptionLevel encryption_level_; | 272 EncryptionLevel encryption_level_; |
| 274 QuicFramer* framer_; | 273 QuicFramer* framer_; |
| 275 scoped_ptr<QuicRandomBoolSource> random_bool_source_; | 274 scoped_ptr<QuicRandomBoolSource> random_bool_source_; |
| 276 QuicPacketNumber packet_number_; | 275 QuicPacketNumber packet_number_; |
| 277 // If true, any created packets will be FEC protected. | 276 // If true, any created packets will be FEC protected. |
| 278 bool should_fec_protect_; | 277 bool should_fec_protect_; |
| 279 QuicFecGroupNumber fec_group_number_; | |
| 280 scoped_ptr<QuicFecGroup> fec_group_; | 278 scoped_ptr<QuicFecGroup> fec_group_; |
| 281 // Controls whether protocol version should be included while serializing the | 279 // Controls whether protocol version should be included while serializing the |
| 282 // packet. | 280 // packet. |
| 283 bool send_version_in_packet_; | 281 bool send_version_in_packet_; |
| 284 // Maximum length including headers and encryption (UDP payload length.) | 282 // Maximum length including headers and encryption (UDP payload length.) |
| 285 QuicByteCount max_packet_length_; | 283 QuicByteCount max_packet_length_; |
| 286 // 0 indicates FEC is disabled. | 284 // 0 indicates FEC is disabled. |
| 287 size_t max_packets_per_fec_group_; | 285 size_t max_packets_per_fec_group_; |
| 288 // Length of connection_id to send over the wire. | 286 // Length of connection_id to send over the wire. |
| 289 QuicConnectionIdLength connection_id_length_; | 287 QuicConnectionIdLength connection_id_length_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 304 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_; | 302 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_; |
| 305 // If true, the packet will be padded up to |max_packet_length_|. | 303 // If true, the packet will be padded up to |max_packet_length_|. |
| 306 bool needs_padding_; | 304 bool needs_padding_; |
| 307 | 305 |
| 308 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); | 306 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); |
| 309 }; | 307 }; |
| 310 | 308 |
| 311 } // namespace net | 309 } // namespace net |
| 312 | 310 |
| 313 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ | 311 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ |
| OLD | NEW |