OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/tools/quic/stateless_rejector.h" | 5 #include "net/tools/quic/stateless_rejector.h" |
6 | 6 |
7 #include "net/quic/core/quic_crypto_server_stream.h" | 7 #include "net/quic/core/quic_crypto_server_stream.h" |
8 #include "net/quic/core/quic_flags.h" | 8 #include "net/quic/core/quic_flags.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
(...skipping 17 matching lines...) Expand all Loading... |
28 StatelessRejector* rejector_; | 28 StatelessRejector* rejector_; |
29 }; | 29 }; |
30 | 30 |
31 StatelessRejector::StatelessRejector( | 31 StatelessRejector::StatelessRejector( |
32 QuicVersion version, | 32 QuicVersion version, |
33 const QuicVersionVector& versions, | 33 const QuicVersionVector& versions, |
34 const QuicCryptoServerConfig* crypto_config, | 34 const QuicCryptoServerConfig* crypto_config, |
35 QuicCompressedCertsCache* compressed_certs_cache, | 35 QuicCompressedCertsCache* compressed_certs_cache, |
36 const QuicClock* clock, | 36 const QuicClock* clock, |
37 QuicRandom* random, | 37 QuicRandom* random, |
| 38 QuicByteCount chlo_packet_size, |
38 const IPEndPoint& client_address, | 39 const IPEndPoint& client_address, |
39 const IPEndPoint& server_address) | 40 const IPEndPoint& server_address) |
40 : state_(FAILED), | 41 : state_(FAILED), |
41 error_(QUIC_INTERNAL_ERROR), | 42 error_(QUIC_INTERNAL_ERROR), |
42 version_(version), | 43 version_(version), |
43 versions_(versions), | 44 versions_(versions), |
44 connection_id_(0), | 45 connection_id_(0), |
| 46 chlo_packet_size_(chlo_packet_size), |
45 client_address_(client_address), | 47 client_address_(client_address), |
46 server_address_(server_address), | 48 server_address_(server_address), |
47 clock_(clock), | 49 clock_(clock), |
48 random_(random), | 50 random_(random), |
49 crypto_config_(crypto_config), | 51 crypto_config_(crypto_config), |
50 compressed_certs_cache_(compressed_certs_cache), | 52 compressed_certs_cache_(compressed_certs_cache), |
51 chlo_(nullptr) {} | 53 chlo_(nullptr) {} |
52 | 54 |
53 StatelessRejector::~StatelessRejector() {} | 55 StatelessRejector::~StatelessRejector() {} |
54 | 56 |
(...skipping 24 matching lines...) Expand all Loading... |
79 void StatelessRejector::ProcessClientHello( | 81 void StatelessRejector::ProcessClientHello( |
80 const CryptoHandshakeMessage& client_hello, | 82 const CryptoHandshakeMessage& client_hello, |
81 const ValidateClientHelloResultCallback::Result& result) { | 83 const ValidateClientHelloResultCallback::Result& result) { |
82 QuicCryptoNegotiatedParameters params; | 84 QuicCryptoNegotiatedParameters params; |
83 DiversificationNonce diversification_nonce; | 85 DiversificationNonce diversification_nonce; |
84 QuicErrorCode error = crypto_config_->ProcessClientHello( | 86 QuicErrorCode error = crypto_config_->ProcessClientHello( |
85 result, | 87 result, |
86 /*reject_only=*/true, connection_id_, server_address_.address(), | 88 /*reject_only=*/true, connection_id_, server_address_.address(), |
87 client_address_, version_, versions_, | 89 client_address_, version_, versions_, |
88 /*use_stateless_rejects=*/true, server_designated_connection_id_, clock_, | 90 /*use_stateless_rejects=*/true, server_designated_connection_id_, clock_, |
89 random_, compressed_certs_cache_, ¶ms, &proof_, &reply_, | 91 random_, compressed_certs_cache_, ¶ms, &proof_, |
90 &diversification_nonce, &error_details_); | 92 QuicCryptoStream::CryptoMessageFramingOverhead(version_), |
| 93 chlo_packet_size_, &reply_, &diversification_nonce, &error_details_); |
91 if (error != QUIC_NO_ERROR) { | 94 if (error != QUIC_NO_ERROR) { |
92 error_ = error; | 95 error_ = error; |
93 return; | 96 return; |
94 } | 97 } |
95 | 98 |
96 if (reply_.tag() == kSREJ) { | 99 if (reply_.tag() == kSREJ) { |
97 state_ = REJECTED; | 100 state_ = REJECTED; |
98 return; | 101 return; |
99 } | 102 } |
100 | 103 |
101 state_ = ACCEPTED; | 104 state_ = ACCEPTED; |
102 } | 105 } |
103 | 106 |
104 } // namespace net | 107 } // namespace net |
OLD | NEW |