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/quic_crypto_stream.h" | 5 #include "net/quic/quic_crypto_stream.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
10 #include "net/quic/crypto/crypto_handshake.h" | 10 #include "net/quic/crypto/crypto_handshake.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 void QuicCryptoStream::OnError(CryptoFramer* framer) { | 26 void QuicCryptoStream::OnError(CryptoFramer* framer) { |
27 DLOG(WARNING) << "Error processing crypto data: " | 27 DLOG(WARNING) << "Error processing crypto data: " |
28 << QuicUtils::ErrorToString(framer->error()); | 28 << QuicUtils::ErrorToString(framer->error()); |
29 } | 29 } |
30 | 30 |
31 void QuicCryptoStream::OnHandshakeMessage( | 31 void QuicCryptoStream::OnHandshakeMessage( |
32 const CryptoHandshakeMessage& message) { | 32 const CryptoHandshakeMessage& message) { |
33 session()->OnCryptoHandshakeMessageReceived(message); | 33 session()->OnCryptoHandshakeMessageReceived(message); |
34 } | 34 } |
35 | 35 |
36 uint32 QuicCryptoStream::ProcessData(const char* data, | 36 uint32 QuicCryptoStream::ProcessRawData(const char* data, |
37 uint32 data_len) { | 37 uint32 data_len) { |
38 // Do not process handshake messages after the handshake is confirmed. | 38 // Do not process handshake messages after the handshake is confirmed. |
39 if (handshake_confirmed()) { | 39 if (handshake_confirmed()) { |
40 CloseConnection(QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE); | 40 CloseConnection(QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE); |
41 return 0; | 41 return 0; |
42 } | 42 } |
43 if (!crypto_framer_.ProcessInput(StringPiece(data, data_len))) { | 43 if (!crypto_framer_.ProcessInput(StringPiece(data, data_len))) { |
44 CloseConnection(crypto_framer_.error()); | 44 CloseConnection(crypto_framer_.error()); |
45 return 0; | 45 return 0; |
46 } | 46 } |
47 return data_len; | 47 return data_len; |
48 } | 48 } |
49 | 49 |
| 50 QuicPriority QuicCryptoStream::EffectivePriority() const { |
| 51 return 0; |
| 52 } |
| 53 |
50 void QuicCryptoStream::SendHandshakeMessage( | 54 void QuicCryptoStream::SendHandshakeMessage( |
51 const CryptoHandshakeMessage& message) { | 55 const CryptoHandshakeMessage& message) { |
52 session()->OnCryptoHandshakeMessageSent(message); | 56 session()->OnCryptoHandshakeMessageSent(message); |
53 const QuicData& data = message.GetSerialized(); | 57 const QuicData& data = message.GetSerialized(); |
54 // To make reasoning about crypto frames easier, we don't combine them with | 58 // To make reasoning about crypto frames easier, we don't combine them with |
55 // any other frames in a single packet. | 59 // any other frames in a single packet. |
56 session()->connection()->Flush(); | 60 session()->connection()->Flush(); |
57 // TODO(wtc): check the return value. | 61 // TODO(wtc): check the return value. |
58 WriteOrBufferData(string(data.data(), data.length()), false); | 62 WriteOrBufferData(string(data.data(), data.length()), false); |
59 session()->connection()->Flush(); | 63 session()->connection()->Flush(); |
60 } | 64 } |
61 | 65 |
62 const QuicCryptoNegotiatedParameters& | 66 const QuicCryptoNegotiatedParameters& |
63 QuicCryptoStream::crypto_negotiated_params() const { | 67 QuicCryptoStream::crypto_negotiated_params() const { |
64 return crypto_negotiated_params_; | 68 return crypto_negotiated_params_; |
65 } | 69 } |
66 | 70 |
67 } // namespace net | 71 } // namespace net |
OLD | NEW |