| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } | 184 } |
| 185 | 185 |
| 186 void set_connection_id_length(QuicConnectionIdLength length) { | 186 void set_connection_id_length(QuicConnectionIdLength length) { |
| 187 connection_id_length_ = length; | 187 connection_id_length_ = length; |
| 188 } | 188 } |
| 189 | 189 |
| 190 QuicByteCount max_packet_length() const { | 190 QuicByteCount max_packet_length() const { |
| 191 return max_packet_length_; | 191 return max_packet_length_; |
| 192 } | 192 } |
| 193 | 193 |
| 194 void set_max_packet_length(QuicByteCount length) { | 194 // Sets the encrypter to use for the encryption level and updates the max |
| 195 // |max_packet_length_| should not be changed mid-packet or mid-FEC group. | 195 // plaintext size. |
| 196 DCHECK(fec_group_.get() == nullptr && queued_frames_.empty()); | 196 void SetEncrypter(EncryptionLevel level, QuicEncrypter* encrypter); |
| 197 max_packet_length_ = length; | 197 |
| 198 } | 198 // Sets the maximum packet length. |
| 199 void SetMaxPacketLength(QuicByteCount length); |
| 199 | 200 |
| 200 // Returns current max number of packets covered by an FEC group. | 201 // Returns current max number of packets covered by an FEC group. |
| 201 size_t max_packets_per_fec_group() const { | 202 size_t max_packets_per_fec_group() const { |
| 202 return max_packets_per_fec_group_; | 203 return max_packets_per_fec_group_; |
| 203 } | 204 } |
| 204 | 205 |
| 205 // Sets creator's max number of packets covered by an FEC group. | 206 // Sets creator's max number of packets covered by an FEC group. |
| 206 // Note: While there are no constraints on |max_packets_per_fec_group|, | 207 // Note: While there are no constraints on |max_packets_per_fec_group|, |
| 207 // this setter enforces a min value of kLowestMaxPacketsPerFecGroup. | 208 // this setter enforces a min value of kLowestMaxPacketsPerFecGroup. |
| 208 // To turn off FEC protection, use StopFecProtectingPackets(). | 209 // To turn off FEC protection, use StopFecProtectingPackets(). |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // a packet or FEC group boundary, when the creator's sequence_number_length_ | 259 // a packet or FEC group boundary, when the creator's sequence_number_length_ |
| 259 // can be changed to this new value. | 260 // can be changed to this new value. |
| 260 QuicSequenceNumberLength next_sequence_number_length_; | 261 QuicSequenceNumberLength next_sequence_number_length_; |
| 261 // Sequence number length for the current packet and for the current FEC group | 262 // Sequence number length for the current packet and for the current FEC group |
| 262 // when FEC is enabled. Mutable so PacketSize() can adjust it when the packet | 263 // when FEC is enabled. Mutable so PacketSize() can adjust it when the packet |
| 263 // is empty. | 264 // is empty. |
| 264 mutable QuicSequenceNumberLength sequence_number_length_; | 265 mutable QuicSequenceNumberLength sequence_number_length_; |
| 265 // packet_size_ is mutable because it's just a cache of the current size. | 266 // packet_size_ is mutable because it's just a cache of the current size. |
| 266 // packet_size should never be read directly, use PacketSize() instead. | 267 // packet_size should never be read directly, use PacketSize() instead. |
| 267 mutable size_t packet_size_; | 268 mutable size_t packet_size_; |
| 269 mutable size_t max_plaintext_size_; |
| 268 QuicFrames queued_frames_; | 270 QuicFrames queued_frames_; |
| 269 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_; | 271 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_; |
| 270 | 272 |
| 271 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); | 273 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); |
| 272 }; | 274 }; |
| 273 | 275 |
| 274 } // namespace net | 276 } // namespace net |
| 275 | 277 |
| 276 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ | 278 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ |
| OLD | NEW |