| 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/crypto/crypto_framer.h" | 5 #include "net/quic/crypto/crypto_framer.h" |
| 6 | 6 |
| 7 #include "net/quic/crypto/crypto_protocol.h" | 7 #include "net/quic/crypto/crypto_protocol.h" |
| 8 #include "net/quic/quic_data_reader.h" | 8 #include "net/quic/quic_data_reader.h" |
| 9 #include "net/quic/quic_data_writer.h" | 9 #include "net/quic/quic_data_writer.h" |
| 10 | 10 |
| 11 using base::StringPiece; | 11 using base::StringPiece; |
| 12 using std::make_pair; | 12 using std::make_pair; |
| 13 using std::pair; | 13 using std::pair; |
| 14 using std::vector; | 14 using std::vector; |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 const size_t kQuicTagSize = sizeof(uint32); | 20 const size_t kQuicTagSize = sizeof(uint32); |
| 21 const size_t kCryptoEndOffsetSize = sizeof(uint32); | 21 const size_t kCryptoEndOffsetSize = sizeof(uint32); |
| 22 const size_t kNumEntriesSize = sizeof(uint16); | 22 const size_t kNumEntriesSize = sizeof(uint16); |
| 23 | 23 |
| 24 // OneShotVisitor is a framer visitor that records a single handshake message. | 24 // OneShotVisitor is a framer visitor that records a single handshake message. |
| 25 class OneShotVisitor : public CryptoFramerVisitorInterface { | 25 class OneShotVisitor : public CryptoFramerVisitorInterface { |
| 26 public: | 26 public: |
| 27 OneShotVisitor() : error_(false) {} | 27 OneShotVisitor() : error_(false) {} |
| 28 | 28 |
| 29 virtual void OnError(CryptoFramer* framer) OVERRIDE { error_ = true; } | 29 virtual void OnError(CryptoFramer* framer) override { error_ = true; } |
| 30 | 30 |
| 31 virtual void OnHandshakeMessage( | 31 virtual void OnHandshakeMessage( |
| 32 const CryptoHandshakeMessage& message) OVERRIDE { | 32 const CryptoHandshakeMessage& message) override { |
| 33 out_.reset(new CryptoHandshakeMessage(message)); | 33 out_.reset(new CryptoHandshakeMessage(message)); |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool error() const { return error_; } | 36 bool error() const { return error_; } |
| 37 | 37 |
| 38 CryptoHandshakeMessage* release() { return out_.release(); } | 38 CryptoHandshakeMessage* release() { return out_.release(); } |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 scoped_ptr<CryptoHandshakeMessage> out_; | 41 scoped_ptr<CryptoHandshakeMessage> out_; |
| 42 bool error_; | 42 bool error_; |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 } | 281 } |
| 282 *end_offset += pad_length; | 282 *end_offset += pad_length; |
| 283 if (!writer->WriteUInt32(*end_offset)) { | 283 if (!writer->WriteUInt32(*end_offset)) { |
| 284 DCHECK(false) << "Failed to write end offset."; | 284 DCHECK(false) << "Failed to write end offset."; |
| 285 return false; | 285 return false; |
| 286 } | 286 } |
| 287 return true; | 287 return true; |
| 288 } | 288 } |
| 289 | 289 |
| 290 } // namespace net | 290 } // namespace net |
| OLD | NEW |