| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } | 205 } |
| 206 | 206 |
| 207 QuicSequenceNumberLength next_sequence_number_length() const { | 207 QuicSequenceNumberLength next_sequence_number_length() const { |
| 208 return next_sequence_number_length_; | 208 return next_sequence_number_length_; |
| 209 } | 209 } |
| 210 | 210 |
| 211 void set_next_sequence_number_length(QuicSequenceNumberLength length) { | 211 void set_next_sequence_number_length(QuicSequenceNumberLength length) { |
| 212 next_sequence_number_length_ = length; | 212 next_sequence_number_length_ = length; |
| 213 } | 213 } |
| 214 | 214 |
| 215 size_t max_packet_length() const { | 215 QuicByteCount max_packet_length() const { |
| 216 return max_packet_length_; | 216 return max_packet_length_; |
| 217 } | 217 } |
| 218 | 218 |
| 219 void set_max_packet_length(size_t length) { | 219 void set_max_packet_length(QuicByteCount length) { |
| 220 // |max_packet_length_| should not be changed mid-packet or mid-FEC group. | 220 // |max_packet_length_| should not be changed mid-packet or mid-FEC group. |
| 221 DCHECK(fec_group_.get() == nullptr && queued_frames_.empty()); | 221 DCHECK(fec_group_.get() == nullptr && queued_frames_.empty()); |
| 222 max_packet_length_ = length; | 222 max_packet_length_ = length; |
| 223 } | 223 } |
| 224 | 224 |
| 225 // Returns current max number of packets covered by an FEC group. | 225 // Returns current max number of packets covered by an FEC group. |
| 226 size_t max_packets_per_fec_group() const { | 226 size_t max_packets_per_fec_group() const { |
| 227 return max_packets_per_fec_group_; | 227 return max_packets_per_fec_group_; |
| 228 } | 228 } |
| 229 | 229 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 scoped_ptr<QuicRandomBoolSource> random_bool_source_; | 265 scoped_ptr<QuicRandomBoolSource> random_bool_source_; |
| 266 QuicPacketSequenceNumber sequence_number_; | 266 QuicPacketSequenceNumber sequence_number_; |
| 267 // If true, any created packets will be FEC protected. | 267 // If true, any created packets will be FEC protected. |
| 268 bool should_fec_protect_; | 268 bool should_fec_protect_; |
| 269 QuicFecGroupNumber fec_group_number_; | 269 QuicFecGroupNumber fec_group_number_; |
| 270 scoped_ptr<QuicFecGroup> fec_group_; | 270 scoped_ptr<QuicFecGroup> fec_group_; |
| 271 // Controls whether protocol version should be included while serializing the | 271 // Controls whether protocol version should be included while serializing the |
| 272 // packet. | 272 // packet. |
| 273 bool send_version_in_packet_; | 273 bool send_version_in_packet_; |
| 274 // Maximum length including headers and encryption (UDP payload length.) | 274 // Maximum length including headers and encryption (UDP payload length.) |
| 275 size_t max_packet_length_; | 275 QuicByteCount max_packet_length_; |
| 276 // 0 indicates FEC is disabled. | 276 // 0 indicates FEC is disabled. |
| 277 size_t max_packets_per_fec_group_; | 277 size_t max_packets_per_fec_group_; |
| 278 // Length of connection_id to send over the wire. | 278 // Length of connection_id to send over the wire. |
| 279 QuicConnectionIdLength connection_id_length_; | 279 QuicConnectionIdLength connection_id_length_; |
| 280 // Staging variable to hold next packet sequence number length. When sequence | 280 // Staging variable to hold next packet sequence number length. When sequence |
| 281 // number length is to be changed, this variable holds the new length until | 281 // number length is to be changed, this variable holds the new length until |
| 282 // a packet or FEC group boundary, when the creator's sequence_number_length_ | 282 // a packet or FEC group boundary, when the creator's sequence_number_length_ |
| 283 // can be changed to this new value. | 283 // can be changed to this new value. |
| 284 QuicSequenceNumberLength next_sequence_number_length_; | 284 QuicSequenceNumberLength next_sequence_number_length_; |
| 285 // Sequence number length for the current packet and for the current FEC group | 285 // Sequence number length for the current packet and for the current FEC group |
| 286 // when FEC is enabled. Mutable so PacketSize() can adjust it when the packet | 286 // when FEC is enabled. Mutable so PacketSize() can adjust it when the packet |
| 287 // is empty. | 287 // is empty. |
| 288 mutable QuicSequenceNumberLength sequence_number_length_; | 288 mutable QuicSequenceNumberLength sequence_number_length_; |
| 289 // packet_size_ is mutable because it's just a cache of the current size. | 289 // packet_size_ is mutable because it's just a cache of the current size. |
| 290 // packet_size should never be read directly, use PacketSize() instead. | 290 // packet_size should never be read directly, use PacketSize() instead. |
| 291 mutable size_t packet_size_; | 291 mutable size_t packet_size_; |
| 292 QuicFrames queued_frames_; | 292 QuicFrames queued_frames_; |
| 293 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_; | 293 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_; |
| 294 | 294 |
| 295 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); | 295 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); |
| 296 }; | 296 }; |
| 297 | 297 |
| 298 } // namespace net | 298 } // namespace net |
| 299 | 299 |
| 300 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ | 300 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ |
| OLD | NEW |