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 |
| 7 #include <string> |
| 8 |
| 9 #include "base/string_piece.h" |
| 10 #include "net/quic/crypto/crypto_handshake.h" |
| 11 #include "net/quic/quic_connection.h" |
6 #include "net/quic/quic_session.h" | 12 #include "net/quic/quic_session.h" |
7 | 13 |
| 14 using std::string; |
8 using base::StringPiece; | 15 using base::StringPiece; |
9 | 16 |
10 namespace net { | 17 namespace net { |
11 | 18 |
12 QuicCryptoStream::QuicCryptoStream(QuicSession* session) | 19 QuicCryptoStream::QuicCryptoStream(QuicSession* session) |
13 : ReliableQuicStream(kCryptoStreamId, session), | 20 : ReliableQuicStream(kCryptoStreamId, session), |
14 handshake_complete_(false) { | 21 handshake_complete_(false) { |
15 crypto_framer_.set_visitor(this); | 22 crypto_framer_.set_visitor(this); |
16 } | 23 } |
17 | 24 |
(...skipping 24 matching lines...) Expand all Loading... |
42 session()->connection()->SendConnectionCloseWithDetails(error, details); | 49 session()->connection()->SendConnectionCloseWithDetails(error, details); |
43 } | 50 } |
44 | 51 |
45 void QuicCryptoStream::SetHandshakeComplete(QuicErrorCode error) { | 52 void QuicCryptoStream::SetHandshakeComplete(QuicErrorCode error) { |
46 handshake_complete_ = true; | 53 handshake_complete_ = true; |
47 session()->OnCryptoHandshakeComplete(error); | 54 session()->OnCryptoHandshakeComplete(error); |
48 } | 55 } |
49 | 56 |
50 void QuicCryptoStream::SendHandshakeMessage( | 57 void QuicCryptoStream::SendHandshakeMessage( |
51 const CryptoHandshakeMessage& message) { | 58 const CryptoHandshakeMessage& message) { |
52 scoped_ptr<QuicData> data(crypto_framer_.ConstructHandshakeMessage(message)); | 59 const QuicData& data = message.GetSerialized(); |
53 // TODO(wtc): check the return value. | 60 // TODO(wtc): check the return value. |
54 WriteData(string(data->data(), data->length()), false); | 61 WriteData(string(data.data(), data.length()), false); |
55 } | 62 } |
56 | 63 |
57 QuicNegotiatedParameters::QuicNegotiatedParameters() | 64 QuicNegotiatedParameters::QuicNegotiatedParameters() |
58 : idle_connection_state_lifetime(QuicTime::Delta::Zero()), | 65 : idle_connection_state_lifetime(QuicTime::Delta::Zero()), |
59 keepalive_timeout(QuicTime::Delta::Zero()) { | 66 keepalive_timeout(QuicTime::Delta::Zero()) { |
60 } | 67 } |
61 | 68 |
62 QuicConfig::QuicConfig() | 69 QuicConfig::QuicConfig() |
63 : idle_connection_state_lifetime(QuicTime::Delta::Zero()), | 70 : idle_connection_state_lifetime(QuicTime::Delta::Zero()), |
64 keepalive_timeout(QuicTime::Delta::Zero()) { | 71 keepalive_timeout(QuicTime::Delta::Zero()) { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 if (error_details) { | 146 if (error_details) { |
140 *error_details = "Bad KATO"; | 147 *error_details = "Bad KATO"; |
141 } | 148 } |
142 return error; | 149 return error; |
143 } | 150 } |
144 | 151 |
145 return QUIC_NO_ERROR; | 152 return QUIC_NO_ERROR; |
146 } | 153 } |
147 | 154 |
148 } // namespace net | 155 } // namespace net |
OLD | NEW |