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

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

Issue 14083012: QUIC: retransmit packets with the correct encryption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved HandshakeMode enum to MockCryptoClientStream Created 7 years, 7 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
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_protocol.h" 5 #include "net/quic/quic_protocol.h"
6 #include "base/stl_util.h" 6 #include "base/stl_util.h"
7 7
8 using base::StringPiece; 8 using base::StringPiece;
9 using std::map; 9 using std::map;
10 using std::numeric_limits; 10 using std::numeric_limits;
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 return StringPiece(data(), GetStartOfEncryptedData(includes_version_)); 267 return StringPiece(data(), GetStartOfEncryptedData(includes_version_));
268 } 268 }
269 269
270 StringPiece QuicPacket::Plaintext() const { 270 StringPiece QuicPacket::Plaintext() const {
271 const size_t start_of_encrypted_data = 271 const size_t start_of_encrypted_data =
272 GetStartOfEncryptedData(includes_version_); 272 GetStartOfEncryptedData(includes_version_);
273 return StringPiece(data() + start_of_encrypted_data, 273 return StringPiece(data() + start_of_encrypted_data,
274 length() - start_of_encrypted_data); 274 length() - start_of_encrypted_data);
275 } 275 }
276 276
277 RetransmittableFrames::RetransmittableFrames() {} 277 RetransmittableFrames::RetransmittableFrames()
278 : encryption_level_(NUM_ENCRYPTION_LEVELS) {
279 }
278 280
279 RetransmittableFrames::~RetransmittableFrames() { 281 RetransmittableFrames::~RetransmittableFrames() {
280 for (QuicFrames::iterator it = frames_.begin(); it != frames_.end(); ++it) { 282 for (QuicFrames::iterator it = frames_.begin(); it != frames_.end(); ++it) {
281 switch (it->type) { 283 switch (it->type) {
282 case PADDING_FRAME: 284 case PADDING_FRAME:
283 delete it->padding_frame; 285 delete it->padding_frame;
284 break; 286 break;
285 case STREAM_FRAME: 287 case STREAM_FRAME:
286 delete it->stream_frame; 288 delete it->stream_frame;
287 break; 289 break;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 return frames_.back(); 321 return frames_.back();
320 } 322 }
321 323
322 const QuicFrame& RetransmittableFrames::AddNonStreamFrame( 324 const QuicFrame& RetransmittableFrames::AddNonStreamFrame(
323 const QuicFrame& frame) { 325 const QuicFrame& frame) {
324 DCHECK_NE(frame.type, STREAM_FRAME); 326 DCHECK_NE(frame.type, STREAM_FRAME);
325 frames_.push_back(frame); 327 frames_.push_back(frame);
326 return frames_.back(); 328 return frames_.back();
327 } 329 }
328 330
331 void RetransmittableFrames::set_encryption_level(EncryptionLevel level) {
332 encryption_level_ = level;
333 }
334
329 ostream& operator<<(ostream& os, const QuicEncryptedPacket& s) { 335 ostream& operator<<(ostream& os, const QuicEncryptedPacket& s) {
330 os << s.length() << "-byte data"; 336 os << s.length() << "-byte data";
331 return os; 337 return os;
332 } 338 }
333 339
334 ostream& operator<<(ostream& os, const QuicConsumedData& s) { 340 ostream& operator<<(ostream& os, const QuicConsumedData& s) {
335 os << "bytes_consumed: " << s.bytes_consumed 341 os << "bytes_consumed: " << s.bytes_consumed
336 << " fin_consumed: " << s.fin_consumed; 342 << " fin_consumed: " << s.fin_consumed;
337 return os; 343 return os;
338 } 344 }
339 345
340 } // namespace net 346 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698