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

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

Issue 1138443003: Land Recent QUIC Changes until 05/13/2015 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compile error fixes Created 5 years, 7 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
« no previous file with comments | « net/quic/quic_crypto_client_stream_test.cc ('k') | net/quic/quic_crypto_server_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 8 #include <string>
9 9
10 #include "net/quic/crypto/crypto_handshake.h" 10 #include "net/quic/crypto/crypto_handshake.h"
11 #include "net/quic/crypto/quic_crypto_server_config.h" 11 #include "net/quic/crypto/quic_crypto_server_config.h"
12 #include "net/quic/proto/source_address_token.pb.h" 12 #include "net/quic/proto/source_address_token.pb.h"
13 #include "net/quic/quic_config.h" 13 #include "net/quic/quic_config.h"
14 #include "net/quic/quic_crypto_stream.h" 14 #include "net/quic/quic_crypto_stream.h"
15 15
16 namespace net { 16 namespace net {
17 17
18 class CachedNetworkParameters; 18 class CachedNetworkParameters;
19 class CryptoHandshakeMessage; 19 class CryptoHandshakeMessage;
20 class QuicCryptoServerConfig; 20 class QuicCryptoServerConfig;
21 class QuicCryptoServerStream; 21 class QuicCryptoServerStream;
22 class QuicSession; 22 class QuicSession;
23 23
24 namespace test { 24 namespace test {
25 class CryptoTestUtils; 25 class CryptoTestUtils;
26 class QuicCryptoServerStreamPeer;
26 } // namespace test 27 } // namespace test
27 28
28 // Receives a notification when the server hello (SHLO) has been ACKed by the 29 // Receives a notification when the server hello (SHLO) has been ACKed by the
29 // peer. At this point we disable HANDSHAKE_MODE in the sent packet manager. 30 // peer. At this point we disable HANDSHAKE_MODE in the sent packet manager.
30 class NET_EXPORT_PRIVATE ServerHelloNotifier : public 31 class NET_EXPORT_PRIVATE ServerHelloNotifier : public
31 QuicAckNotifier::DelegateInterface { 32 QuicAckNotifier::DelegateInterface {
32 public: 33 public:
33 explicit ServerHelloNotifier(QuicCryptoServerStream* stream) 34 explicit ServerHelloNotifier(QuicCryptoServerStream* stream)
34 : server_stream_(stream) {} 35 : server_stream_(stream) {}
35 36
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 78
78 // Called by the ServerHello AckNotifier once the SHLO has been ACKed by the 79 // Called by the ServerHello AckNotifier once the SHLO has been ACKed by the
79 // client. 80 // client.
80 void OnServerHelloAcked(); 81 void OnServerHelloAcked();
81 82
82 void set_previous_cached_network_params( 83 void set_previous_cached_network_params(
83 CachedNetworkParameters cached_network_params); 84 CachedNetworkParameters cached_network_params);
84 85
85 const CachedNetworkParameters* previous_cached_network_params() const; 86 const CachedNetworkParameters* previous_cached_network_params() const;
86 87
88 bool use_stateless_rejects_if_peer_supported() const {
89 return use_stateless_rejects_if_peer_supported_;
90 }
91
92 // Used by the quic dispatcher to indicate that this crypto server
93 // stream should use stateless rejects, so long as stateless rejects
94 // are supported by the client.
95 void set_use_stateless_rejects_if_peer_supported(
96 bool use_stateless_rejects_if_peer_supported) {
97 use_stateless_rejects_if_peer_supported_ =
98 use_stateless_rejects_if_peer_supported;
99 }
100
101 bool peer_supports_stateless_rejects() const {
102 return peer_supports_stateless_rejects_;
103 }
104
105 void set_peer_supports_stateless_rejects(
106 bool peer_supports_stateless_rejects) {
107 peer_supports_stateless_rejects_ = peer_supports_stateless_rejects;
108 }
109
87 protected: 110 protected:
88 virtual QuicErrorCode ProcessClientHello( 111 virtual QuicErrorCode ProcessClientHello(
89 const CryptoHandshakeMessage& message, 112 const CryptoHandshakeMessage& message,
90 const ValidateClientHelloResultCallback::Result& result, 113 const ValidateClientHelloResultCallback::Result& result,
91 CryptoHandshakeMessage* reply, 114 CryptoHandshakeMessage* reply,
92 std::string* error_details); 115 std::string* error_details);
93 116
94 // Hook that allows the server to set QuicConfig defaults just 117 // Hook that allows the server to set QuicConfig defaults just
95 // before going through the parameter negotiation step. 118 // before going through the parameter negotiation step.
96 virtual void OverrideQuicConfigDefaults(QuicConfig* config); 119 virtual void OverrideQuicConfigDefaults(QuicConfig* config);
97 120
121 // Given the current connection_id, generates a new ConnectionId to
122 // be returned with a stateless reject.
123 virtual QuicConnectionId GenerateConnectionIdForReject(
124 QuicConnectionId connection_id);
125
98 private: 126 private:
99 friend class test::CryptoTestUtils; 127 friend class test::CryptoTestUtils;
128 friend class test::QuicCryptoServerStreamPeer;
100 129
101 class ValidateCallback : public ValidateClientHelloResultCallback { 130 class ValidateCallback : public ValidateClientHelloResultCallback {
102 public: 131 public:
103 explicit ValidateCallback(QuicCryptoServerStream* parent); 132 explicit ValidateCallback(QuicCryptoServerStream* parent);
104 // To allow the parent to detach itself from the callback before deletion. 133 // To allow the parent to detach itself from the callback before deletion.
105 void Cancel(); 134 void Cancel();
106 135
107 // From ValidateClientHelloResultCallback 136 // From ValidateClientHelloResultCallback
108 void RunImpl(const CryptoHandshakeMessage& client_hello, 137 void RunImpl(const CryptoHandshakeMessage& client_hello,
109 const Result& result) override; 138 const Result& result) override;
110 139
111 private: 140 private:
112 QuicCryptoServerStream* parent_; 141 QuicCryptoServerStream* parent_;
113 142
114 DISALLOW_COPY_AND_ASSIGN(ValidateCallback); 143 DISALLOW_COPY_AND_ASSIGN(ValidateCallback);
115 }; 144 };
116 145
117 // Invoked by ValidateCallback::RunImpl once initial validation of 146 // Invoked by ValidateCallback::RunImpl once initial validation of
118 // the client hello is complete. Finishes processing of the client 147 // the client hello is complete. Finishes processing of the client
119 // hello message and handles handshake success/failure. 148 // hello message and handles handshake success/failure.
120 void FinishProcessingHandshakeMessage( 149 void FinishProcessingHandshakeMessage(
121 const CryptoHandshakeMessage& message, 150 const CryptoHandshakeMessage& message,
122 const ValidateClientHelloResultCallback::Result& result); 151 const ValidateClientHelloResultCallback::Result& result);
123 152
153 // Checks the options on the handshake-message to see whether the
154 // peer supports stateless-rejects.
155 static bool DoesPeerSupportStatelessRejects(
156 const CryptoHandshakeMessage& message);
157
124 // crypto_config_ contains crypto parameters for the handshake. 158 // crypto_config_ contains crypto parameters for the handshake.
125 const QuicCryptoServerConfig* crypto_config_; 159 const QuicCryptoServerConfig* crypto_config_;
126 160
127 // Pointer to the active callback that will receive the result of 161 // Pointer to the active callback that will receive the result of
128 // the client hello validation request and forward it to 162 // the client hello validation request and forward it to
129 // FinishProcessingHandshakeMessage for processing. nullptr if no 163 // FinishProcessingHandshakeMessage for processing. nullptr if no
130 // handshake message is being validated. 164 // handshake message is being validated.
131 ValidateCallback* validate_client_hello_cb_; 165 ValidateCallback* validate_client_hello_cb_;
132 166
133 // Number of handshake messages received by this stream. 167 // Number of handshake messages received by this stream.
134 uint8 num_handshake_messages_; 168 uint8 num_handshake_messages_;
135 169
136 // Number of server config update (SCUP) messages sent by this stream. 170 // Number of server config update (SCUP) messages sent by this stream.
137 int num_server_config_update_messages_sent_; 171 int num_server_config_update_messages_sent_;
138 172
139 // If the client provides CachedNetworkParameters in the STK in the CHLO, then 173 // If the client provides CachedNetworkParameters in the STK in the CHLO, then
140 // store here, and send back in future STKs if we have no better bandwidth 174 // store here, and send back in future STKs if we have no better bandwidth
141 // estimate to send. 175 // estimate to send.
142 scoped_ptr<CachedNetworkParameters> previous_cached_network_params_; 176 scoped_ptr<CachedNetworkParameters> previous_cached_network_params_;
143 177
144 // Contains any source address tokens which were present in the CHLO. 178 // Contains any source address tokens which were present in the CHLO.
145 SourceAddressTokens previous_source_address_tokens_; 179 SourceAddressTokens previous_source_address_tokens_;
146 180
181 // If true, the server should use stateless rejects, so long as the
182 // client supports them, as indicated by
183 // peer_supports_stateless_rejects_.
184 bool use_stateless_rejects_if_peer_supported_;
185
186 // Set to true, once the server has received information from the
187 // client that it supports stateless reject.
188 // TODO(jokulik): Remove once client stateless reject support
189 // becomes the default.
190 bool peer_supports_stateless_rejects_;
191
147 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerStream); 192 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerStream);
148 }; 193 };
149 194
150 } // namespace net 195 } // namespace net
151 196
152 #endif // NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ 197 #endif // NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_
OLDNEW
« no previous file with comments | « net/quic/quic_crypto_client_stream_test.cc ('k') | net/quic/quic_crypto_server_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698