Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: net/quic/quic_packet_creator.cc

Issue 331573002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compiler error - use push_back to initialize vectors Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_packet_creator.h ('k') | net/quic/quic_packet_creator_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_creator.h" 5 #include "net/quic/quic_packet_creator.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "net/quic/crypto/quic_random.h" 9 #include "net/quic/crypto/quic_random.h"
10 #include "net/quic/quic_ack_notifier.h" 10 #include "net/quic/quic_ack_notifier.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // Stored random bits. 50 // Stored random bits.
51 uint64 bit_bucket_; 51 uint64 bit_bucket_;
52 // The next available bit has "1" in the mask. Zero means empty bucket. 52 // The next available bit has "1" in the mask. Zero means empty bucket.
53 uint64 bit_mask_; 53 uint64 bit_mask_;
54 54
55 DISALLOW_COPY_AND_ASSIGN(QuicRandomBoolSource); 55 DISALLOW_COPY_AND_ASSIGN(QuicRandomBoolSource);
56 }; 56 };
57 57
58 QuicPacketCreator::QuicPacketCreator(QuicConnectionId connection_id, 58 QuicPacketCreator::QuicPacketCreator(QuicConnectionId connection_id,
59 QuicFramer* framer, 59 QuicFramer* framer,
60 QuicRandom* random_generator, 60 QuicRandom* random_generator)
61 bool is_server)
62 : connection_id_(connection_id), 61 : connection_id_(connection_id),
63 encryption_level_(ENCRYPTION_NONE), 62 encryption_level_(ENCRYPTION_NONE),
64 framer_(framer), 63 framer_(framer),
65 random_bool_source_(new QuicRandomBoolSource(random_generator)), 64 random_bool_source_(new QuicRandomBoolSource(random_generator)),
66 sequence_number_(0), 65 sequence_number_(0),
67 should_fec_protect_(false), 66 should_fec_protect_(false),
68 fec_group_number_(0), 67 fec_group_number_(0),
69 is_server_(is_server), 68 send_version_in_packet_(!framer->is_server()),
70 send_version_in_packet_(!is_server),
71 max_packet_length_(kDefaultMaxPacketSize), 69 max_packet_length_(kDefaultMaxPacketSize),
72 max_packets_per_fec_group_(0), 70 max_packets_per_fec_group_(0),
73 connection_id_length_(PACKET_8BYTE_CONNECTION_ID), 71 connection_id_length_(PACKET_8BYTE_CONNECTION_ID),
74 next_sequence_number_length_(PACKET_1BYTE_SEQUENCE_NUMBER), 72 next_sequence_number_length_(PACKET_1BYTE_SEQUENCE_NUMBER),
75 sequence_number_length_(next_sequence_number_length_), 73 sequence_number_length_(next_sequence_number_length_),
76 packet_size_(0) { 74 packet_size_(0) {
77 framer_->set_fec_builder(this); 75 framer_->set_fec_builder(this);
78 } 76 }
79 77
80 QuicPacketCreator::~QuicPacketCreator() { 78 QuicPacketCreator::~QuicPacketCreator() {
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 407
410 SerializedPacket QuicPacketCreator::SerializeConnectionClose( 408 SerializedPacket QuicPacketCreator::SerializeConnectionClose(
411 QuicConnectionCloseFrame* close_frame) { 409 QuicConnectionCloseFrame* close_frame) {
412 QuicFrames frames; 410 QuicFrames frames;
413 frames.push_back(QuicFrame(close_frame)); 411 frames.push_back(QuicFrame(close_frame));
414 return SerializeAllFrames(frames); 412 return SerializeAllFrames(frames);
415 } 413 }
416 414
417 QuicEncryptedPacket* QuicPacketCreator::SerializeVersionNegotiationPacket( 415 QuicEncryptedPacket* QuicPacketCreator::SerializeVersionNegotiationPacket(
418 const QuicVersionVector& supported_versions) { 416 const QuicVersionVector& supported_versions) {
419 DCHECK(is_server_); 417 DCHECK(framer_->is_server());
420 QuicPacketPublicHeader header; 418 QuicPacketPublicHeader header;
421 header.connection_id = connection_id_; 419 header.connection_id = connection_id_;
422 header.reset_flag = false; 420 header.reset_flag = false;
423 header.version_flag = true; 421 header.version_flag = true;
424 header.versions = supported_versions; 422 header.versions = supported_versions;
425 QuicEncryptedPacket* encrypted = 423 QuicEncryptedPacket* encrypted =
426 framer_->BuildVersionNegotiationPacket(header, supported_versions); 424 framer_->BuildVersionNegotiationPacket(header, supported_versions);
427 DCHECK(encrypted); 425 DCHECK(encrypted);
428 DCHECK_GE(max_packet_length_, encrypted->length()); 426 DCHECK_GE(max_packet_length_, encrypted->length());
429 return encrypted; 427 return encrypted;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 if (!is_handshake) { 503 if (!is_handshake) {
506 return; 504 return;
507 } 505 }
508 506
509 QuicPaddingFrame padding; 507 QuicPaddingFrame padding;
510 bool success = AddFrame(QuicFrame(&padding), false); 508 bool success = AddFrame(QuicFrame(&padding), false);
511 DCHECK(success); 509 DCHECK(success);
512 } 510 }
513 511
514 } // namespace net 512 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_packet_creator.h ('k') | net/quic/quic_packet_creator_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698