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 #include "net/quic/quic_packet_generator.h" | 5 #include "net/quic/quic_packet_generator.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/quic/quic_bug_tracker.h" | 8 #include "net/quic/quic_bug_tracker.h" |
9 #include "net/quic/quic_flags.h" | 9 #include "net/quic/quic_flags.h" |
10 #include "net/quic/quic_utils.h" | 10 #include "net/quic/quic_utils.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 return false; | 231 return false; |
232 } | 232 } |
233 queued_control_frames_.pop_back(); | 233 queued_control_frames_.pop_back(); |
234 return true; | 234 return true; |
235 } | 235 } |
236 | 236 |
237 void QuicPacketGenerator::StopSendingVersion() { | 237 void QuicPacketGenerator::StopSendingVersion() { |
238 packet_creator_.StopSendingVersion(); | 238 packet_creator_.StopSendingVersion(); |
239 } | 239 } |
240 | 240 |
| 241 void QuicPacketGenerator::SetDiversificationNonce( |
| 242 const DiversificationNonce nonce) { |
| 243 packet_creator_.SetDiversificationNonce(nonce); |
| 244 } |
| 245 |
241 QuicPacketNumber QuicPacketGenerator::packet_number() const { | 246 QuicPacketNumber QuicPacketGenerator::packet_number() const { |
242 return packet_creator_.packet_number(); | 247 return packet_creator_.packet_number(); |
243 } | 248 } |
244 | 249 |
245 QuicByteCount QuicPacketGenerator::GetCurrentMaxPacketLength() const { | 250 QuicByteCount QuicPacketGenerator::GetCurrentMaxPacketLength() const { |
246 return packet_creator_.max_packet_length(); | 251 return packet_creator_.max_packet_length(); |
247 } | 252 } |
248 | 253 |
249 void QuicPacketGenerator::SetMaxPacketLength(QuicByteCount length) { | 254 void QuicPacketGenerator::SetMaxPacketLength(QuicByteCount length) { |
250 DCHECK(packet_creator_.CanSetMaxPacketLength()); | 255 DCHECK(packet_creator_.CanSetMaxPacketLength()); |
(...skipping 15 matching lines...) Expand all Loading... |
266 void QuicPacketGenerator::UpdateSequenceNumberLength( | 271 void QuicPacketGenerator::UpdateSequenceNumberLength( |
267 QuicPacketNumber least_packet_awaited_by_peer, | 272 QuicPacketNumber least_packet_awaited_by_peer, |
268 QuicPacketCount max_packets_in_flight) { | 273 QuicPacketCount max_packets_in_flight) { |
269 return packet_creator_.UpdatePacketNumberLength(least_packet_awaited_by_peer, | 274 return packet_creator_.UpdatePacketNumberLength(least_packet_awaited_by_peer, |
270 max_packets_in_flight); | 275 max_packets_in_flight); |
271 } | 276 } |
272 | 277 |
273 void QuicPacketGenerator::SetConnectionIdLength(uint32_t length) { | 278 void QuicPacketGenerator::SetConnectionIdLength(uint32_t length) { |
274 if (length == 0) { | 279 if (length == 0) { |
275 packet_creator_.set_connection_id_length(PACKET_0BYTE_CONNECTION_ID); | 280 packet_creator_.set_connection_id_length(PACKET_0BYTE_CONNECTION_ID); |
276 } else if (length == 1) { | |
277 packet_creator_.set_connection_id_length(PACKET_1BYTE_CONNECTION_ID); | |
278 } else if (length <= 4) { | |
279 packet_creator_.set_connection_id_length(PACKET_4BYTE_CONNECTION_ID); | |
280 } else { | 281 } else { |
281 packet_creator_.set_connection_id_length(PACKET_8BYTE_CONNECTION_ID); | 282 packet_creator_.set_connection_id_length(PACKET_8BYTE_CONNECTION_ID); |
282 } | 283 } |
283 } | 284 } |
284 | 285 |
285 void QuicPacketGenerator::set_encryption_level(EncryptionLevel level) { | 286 void QuicPacketGenerator::set_encryption_level(EncryptionLevel level) { |
286 packet_creator_.set_encryption_level(level); | 287 packet_creator_.set_encryption_level(level); |
287 } | 288 } |
288 | 289 |
289 void QuicPacketGenerator::SetEncrypter(EncryptionLevel level, | 290 void QuicPacketGenerator::SetEncrypter(EncryptionLevel level, |
290 QuicEncrypter* encrypter) { | 291 QuicEncrypter* encrypter) { |
291 packet_creator_.SetEncrypter(level, encrypter); | 292 packet_creator_.SetEncrypter(level, encrypter); |
292 } | 293 } |
293 | 294 |
294 void QuicPacketGenerator::SetCurrentPath( | 295 void QuicPacketGenerator::SetCurrentPath( |
295 QuicPathId path_id, | 296 QuicPathId path_id, |
296 QuicPacketNumber least_packet_awaited_by_peer, | 297 QuicPacketNumber least_packet_awaited_by_peer, |
297 QuicPacketCount max_packets_in_flight) { | 298 QuicPacketCount max_packets_in_flight) { |
298 packet_creator_.SetCurrentPath(path_id, least_packet_awaited_by_peer, | 299 packet_creator_.SetCurrentPath(path_id, least_packet_awaited_by_peer, |
299 max_packets_in_flight); | 300 max_packets_in_flight); |
300 } | 301 } |
301 | 302 |
302 } // namespace net | 303 } // namespace net |
OLD | NEW |