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_handshake.h" | 7 #include "net/quic/crypto/crypto_handshake.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 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 const size_t kCryptoTagSize = sizeof(uint32); | 17 const size_t kCryptoTagSize = sizeof(uint32); |
18 const size_t kNumEntriesSize = sizeof(uint16); | 18 const size_t kNumEntriesSize = sizeof(uint16); |
19 const size_t kValueLenSize = sizeof(uint16); | 19 const size_t kValueLenSize = sizeof(uint16); |
20 | 20 |
21 // OneShotVisitor is a framer visitor that records a single handshake message. | 21 // OneShotVisitor is a framer visitor that records a single handshake message. |
22 class OneShotVisitor : public CryptoFramerVisitorInterface { | 22 class OneShotVisitor : public CryptoFramerVisitorInterface { |
23 public: | 23 public: |
24 explicit OneShotVisitor(CryptoHandshakeMessage* out) | 24 explicit OneShotVisitor(CryptoHandshakeMessage* out) |
25 : out_(out), | 25 : out_(out), |
26 error_(false) { | 26 error_(false) { |
27 } | 27 } |
28 | 28 |
29 void OnError(CryptoFramer* framer) { | 29 virtual void OnError(CryptoFramer* framer) OVERRIDE { |
30 error_ = true; | 30 error_ = true; |
31 } | 31 } |
32 | 32 |
33 void OnHandshakeMessage(const CryptoHandshakeMessage& message) { | 33 virtual void OnHandshakeMessage( |
| 34 const CryptoHandshakeMessage& message) OVERRIDE { |
34 *out_ = message; | 35 *out_ = message; |
35 } | 36 } |
36 | 37 |
37 bool error() const { | 38 bool error() const { |
38 return error_; | 39 return error_; |
39 } | 40 } |
40 | 41 |
41 private: | 42 private: |
42 CryptoHandshakeMessage* const out_; | 43 CryptoHandshakeMessage* const out_; |
43 bool error_; | 44 bool error_; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 225 |
225 void CryptoFramer::Clear() { | 226 void CryptoFramer::Clear() { |
226 tag_value_map_.clear(); | 227 tag_value_map_.clear(); |
227 tag_length_map_.clear(); | 228 tag_length_map_.clear(); |
228 tags_.clear(); | 229 tags_.clear(); |
229 error_ = QUIC_NO_ERROR; | 230 error_ = QUIC_NO_ERROR; |
230 state_ = STATE_READING_TAG; | 231 state_ = STATE_READING_TAG; |
231 } | 232 } |
232 | 233 |
233 } // namespace net | 234 } // namespace net |
OLD | NEW |