| 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/core/quic_packet_creator.h" | 5 #include "net/quic/core/quic_packet_creator.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 #include <cstdint> | 8 #include <cstdint> | 
| 9 | 9 | 
| 10 #include "base/macros.h" | 10 #include "base/macros.h" | 
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 613 } | 613 } | 
| 614 | 614 | 
| 615 bool QuicPacketCreator::IncludeNonceInPublicHeader() { | 615 bool QuicPacketCreator::IncludeNonceInPublicHeader() { | 
| 616   return have_diversification_nonce_ && | 616   return have_diversification_nonce_ && | 
| 617          packet_.encryption_level == ENCRYPTION_INITIAL; | 617          packet_.encryption_level == ENCRYPTION_INITIAL; | 
| 618 } | 618 } | 
| 619 | 619 | 
| 620 void QuicPacketCreator::AddPendingPadding(QuicByteCount size) { | 620 void QuicPacketCreator::AddPendingPadding(QuicByteCount size) { | 
| 621   pending_padding_bytes_ += size; | 621   pending_padding_bytes_ += size; | 
| 622 } | 622 } | 
|  | 623 #undef ENDPOINT | 
| 623 | 624 | 
| 624 bool QuicPacketCreator::StreamFrameStartsWithChlo( | 625 bool QuicPacketCreator::StreamFrameStartsWithChlo( | 
| 625     QuicIOVector iov, | 626     QuicIOVector iov, | 
| 626     size_t iov_offset, | 627     size_t iov_offset, | 
| 627     const QuicStreamFrame& frame) const { | 628     const QuicStreamFrame& frame) const { | 
| 628   if (!framer_->HasDataProducer()) { | 629   if (!framer_->HasDataProducer()) { | 
| 629     return frame.stream_id == kCryptoStreamId && | 630     return frame.stream_id == kCryptoStreamId && | 
| 630            frame.data_length >= sizeof(kCHLO) && | 631            frame.data_length >= sizeof(kCHLO) && | 
| 631            strncmp(frame.data_buffer, reinterpret_cast<const char*>(&kCHLO), | 632            strncmp(frame.data_buffer, reinterpret_cast<const char*>(&kCHLO), | 
| 632                    sizeof(kCHLO)) == 0; | 633                    sizeof(kCHLO)) == 0; | 
| 633   } | 634   } | 
| 634 | 635 | 
| 635   if (framer_->perspective() == Perspective::IS_SERVER || | 636   if (framer_->perspective() == Perspective::IS_SERVER || | 
| 636       frame.stream_id != kCryptoStreamId || frame.data_length < sizeof(kCHLO)) { | 637       frame.stream_id != kCryptoStreamId || frame.data_length < sizeof(kCHLO)) { | 
| 637     return false; | 638     return false; | 
| 638   } | 639   } | 
| 639   return framer_->StartsWithChlo(frame.stream_id, frame.offset); | 640   return framer_->StartsWithChlo(frame.stream_id, frame.offset); | 
| 640 } | 641 } | 
| 641 | 642 | 
| 642 }  // namespace net | 643 }  // namespace net | 
| OLD | NEW | 
|---|