Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: net/quic/core/quic_crypto_server_stream.h

Issue 2322233004: Landing Recent QUIC changes until Sun Sep 4 03:41:00 (Closed)
Patch Set: Remove simulation files from the build. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ 5 #ifndef NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_
6 #define NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ 6 #define NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_
7 7
8 #include <cstdint> 8 #include <cstdint>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 16 matching lines...) Expand all
27 27
28 namespace test { 28 namespace test {
29 class CryptoTestUtils; 29 class CryptoTestUtils;
30 class QuicCryptoServerStreamPeer; 30 class QuicCryptoServerStreamPeer;
31 } // namespace test 31 } // namespace test
32 32
33 // TODO(alyssar) see what can be moved out of QuicCryptoServerStream with 33 // TODO(alyssar) see what can be moved out of QuicCryptoServerStream with
34 // various code and test refactoring. 34 // various code and test refactoring.
35 class NET_EXPORT_PRIVATE QuicCryptoServerStreamBase : public QuicCryptoStream { 35 class NET_EXPORT_PRIVATE QuicCryptoServerStreamBase : public QuicCryptoStream {
36 public: 36 public:
37 explicit QuicCryptoServerStreamBase(QuicServerSessionBase* session); 37 explicit QuicCryptoServerStreamBase(QuicSession* session);
38
38 ~QuicCryptoServerStreamBase() override {} 39 ~QuicCryptoServerStreamBase() override {}
39 40
40 // Cancel any outstanding callbacks, such as asynchronous validation of client 41 // Cancel any outstanding callbacks, such as asynchronous validation of client
41 // hello. 42 // hello.
42 virtual void CancelOutstandingCallbacks() = 0; 43 virtual void CancelOutstandingCallbacks() = 0;
43 44
44 // GetBase64SHA256ClientChannelID sets |*output| to the base64 encoded, 45 // GetBase64SHA256ClientChannelID sets |*output| to the base64 encoded,
45 // SHA-256 hash of the client's ChannelID key and returns true, if the client 46 // SHA-256 hash of the client's ChannelID key and returns true, if the client
46 // presented a ChannelID. Otherwise it returns false. 47 // presented a ChannelID. Otherwise it returns false.
47 virtual bool GetBase64SHA256ClientChannelID(std::string* output) const = 0; 48 virtual bool GetBase64SHA256ClientChannelID(std::string* output) const = 0;
(...skipping 21 matching lines...) Expand all
69 70
70 // Checks the options on the handshake-message to see whether the 71 // Checks the options on the handshake-message to see whether the
71 // peer supports stateless-rejects. 72 // peer supports stateless-rejects.
72 static bool DoesPeerSupportStatelessRejects( 73 static bool DoesPeerSupportStatelessRejects(
73 const CryptoHandshakeMessage& message); 74 const CryptoHandshakeMessage& message);
74 }; 75 };
75 76
76 class NET_EXPORT_PRIVATE QuicCryptoServerStream 77 class NET_EXPORT_PRIVATE QuicCryptoServerStream
77 : public QuicCryptoServerStreamBase { 78 : public QuicCryptoServerStreamBase {
78 public: 79 public:
80 class Helper {
81 public:
82 virtual ~Helper() {}
83
84 // Given the current connection_id, generates a new ConnectionId to
85 // be returned with a stateless reject.
86 virtual QuicConnectionId GenerateConnectionIdForReject(
87 QuicConnectionId connection_id) const = 0;
88
89 // Returns true if |message|, which was received on |self_address| is
90 // acceptable according to the visitor's policy. Otherwise, returns false
91 // and populates |error_details|.
92 virtual bool CanAcceptClientHello(const CryptoHandshakeMessage& message,
93 const IPEndPoint& self_address,
94 std::string* error_details) const = 0;
95 };
96
79 // |crypto_config| must outlive the stream. 97 // |crypto_config| must outlive the stream.
98 // |session| must outlive the stream.
99 // |helper| must outlive the stream.
80 QuicCryptoServerStream(const QuicCryptoServerConfig* crypto_config, 100 QuicCryptoServerStream(const QuicCryptoServerConfig* crypto_config,
81 QuicCompressedCertsCache* compressed_certs_cache, 101 QuicCompressedCertsCache* compressed_certs_cache,
82 bool use_stateless_rejects_if_peer_supported, 102 bool use_stateless_rejects_if_peer_supported,
83 QuicServerSessionBase* session); 103 QuicSession* session,
104 Helper* helper);
105
84 ~QuicCryptoServerStream() override; 106 ~QuicCryptoServerStream() override;
85 107
86 // From QuicCryptoServerStreamBase 108 // From QuicCryptoServerStreamBase
87 void CancelOutstandingCallbacks() override; 109 void CancelOutstandingCallbacks() override;
88 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override; 110 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override;
89 bool GetBase64SHA256ClientChannelID(std::string* output) const override; 111 bool GetBase64SHA256ClientChannelID(std::string* output) const override;
90 void SendServerConfigUpdate( 112 void SendServerConfigUpdate(
91 const CachedNetworkParameters* cached_network_params) override; 113 const CachedNetworkParameters* cached_network_params) override;
92 void OnServerHelloAcked() override; 114 void OnServerHelloAcked() override;
93 uint8_t NumHandshakeMessages() const override; 115 uint8_t NumHandshakeMessages() const override;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // Hash of the last received CHLO message which can be used for generating 208 // Hash of the last received CHLO message which can be used for generating
187 // server config update messages. 209 // server config update messages.
188 std::string chlo_hash_; 210 std::string chlo_hash_;
189 211
190 // Pointer to the active callback that will receive the result of 212 // Pointer to the active callback that will receive the result of
191 // the client hello validation request and forward it to 213 // the client hello validation request and forward it to
192 // FinishProcessingHandshakeMessage for processing. nullptr if no 214 // FinishProcessingHandshakeMessage for processing. nullptr if no
193 // handshake message is being validated. 215 // handshake message is being validated.
194 ValidateCallback* validate_client_hello_cb_; 216 ValidateCallback* validate_client_hello_cb_;
195 217
218 // Pointer to the helper for this crypto stream. Must outlive this stream.
219 Helper* helper_;
220
196 // Number of handshake messages received by this stream. 221 // Number of handshake messages received by this stream.
197 uint8_t num_handshake_messages_; 222 uint8_t num_handshake_messages_;
198 223
199 // Number of handshake messages received by this stream that contain 224 // Number of handshake messages received by this stream that contain
200 // server nonces (indicating that this is a non-zero-RTT handshake 225 // server nonces (indicating that this is a non-zero-RTT handshake
201 // attempt). 226 // attempt).
202 uint8_t num_handshake_messages_with_server_nonces_; 227 uint8_t num_handshake_messages_with_server_nonces_;
203 228
204 // Pointer to the active callback that will receive the result of 229 // Pointer to the active callback that will receive the result of
205 // BuildServerConfigUpdateMessage and forward it to 230 // BuildServerConfigUpdateMessage and forward it to
(...skipping 25 matching lines...) Expand all
231 256
232 // Size of the packet containing the most recently received CHLO. 257 // Size of the packet containing the most recently received CHLO.
233 QuicByteCount chlo_packet_size_; 258 QuicByteCount chlo_packet_size_;
234 259
235 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerStream); 260 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerStream);
236 }; 261 };
237 262
238 } // namespace net 263 } // namespace net
239 264
240 #endif // NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ 265 #endif // NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_
OLDNEW
« no previous file with comments | « net/quic/core/quic_crypto_client_stream_test.cc ('k') | net/quic/core/quic_crypto_server_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698