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 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 // connection. | 72 // connection. |
73 enum NextProtoStatus { | 73 enum NextProtoStatus { |
74 // WARNING: These values are serialized to disk. Don't change them. | 74 // WARNING: These values are serialized to disk. Don't change them. |
75 | 75 |
76 kNextProtoUnsupported = 0, // The server doesn't support NPN. | 76 kNextProtoUnsupported = 0, // The server doesn't support NPN. |
77 kNextProtoNegotiated = 1, // We agreed on a protocol. | 77 kNextProtoNegotiated = 1, // We agreed on a protocol. |
78 kNextProtoNoOverlap = 2, // No protocols in common. We requested | 78 kNextProtoNoOverlap = 2, // No protocols in common. We requested |
79 // the first protocol in our list. | 79 // the first protocol in our list. |
80 }; | 80 }; |
81 | 81 |
82 // TLS extension used to negotiate protocol. Recorded in UMA, do not change | |
83 // or reuse values. | |
davidben
2014/10/03 17:55:07
This comment seems no longer accurate (they don't
Bence
2014/10/10 15:26:11
Done.
| |
84 enum SSLNegotiationExtension { | |
85 kExtensionUnknown, | |
86 kExtensionALPN, | |
87 kExtensionNPN, | |
88 }; | |
89 | |
82 // StreamSocket: | 90 // StreamSocket: |
83 virtual bool WasNpnNegotiated() const OVERRIDE; | 91 virtual bool WasNpnNegotiated() const OVERRIDE; |
84 virtual NextProto GetNegotiatedProtocol() const OVERRIDE; | 92 virtual NextProto GetNegotiatedProtocol() const OVERRIDE; |
85 | 93 |
86 // Computes a unique key string for the SSL session cache. | 94 // Computes a unique key string for the SSL session cache. |
87 virtual std::string GetSessionCacheKey() const = 0; | 95 virtual std::string GetSessionCacheKey() const = 0; |
88 | 96 |
89 // Returns true if there is a cache entry in the SSL session cache | 97 // Returns true if there is a cache entry in the SSL session cache |
90 // for the cache key of the SSL socket. | 98 // for the cache key of the SSL socket. |
91 // | 99 // |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 static void ClearSessionCache(); | 151 static void ClearSessionCache(); |
144 | 152 |
145 virtual bool set_was_npn_negotiated(bool negotiated); | 153 virtual bool set_was_npn_negotiated(bool negotiated); |
146 | 154 |
147 virtual bool was_spdy_negotiated() const; | 155 virtual bool was_spdy_negotiated() const; |
148 | 156 |
149 virtual bool set_was_spdy_negotiated(bool negotiated); | 157 virtual bool set_was_spdy_negotiated(bool negotiated); |
150 | 158 |
151 virtual void set_protocol_negotiated(NextProto protocol_negotiated); | 159 virtual void set_protocol_negotiated(NextProto protocol_negotiated); |
152 | 160 |
161 void set_negotiation_extension(SSLNegotiationExtension negotiation_extension); | |
162 | |
153 // Returns the ChannelIDService used by this socket, or NULL if | 163 // Returns the ChannelIDService used by this socket, or NULL if |
154 // channel ids are not supported. | 164 // channel ids are not supported. |
155 virtual ChannelIDService* GetChannelIDService() const = 0; | 165 virtual ChannelIDService* GetChannelIDService() const = 0; |
156 | 166 |
157 // Returns true if a channel ID was sent on this connection. | 167 // Returns true if a channel ID was sent on this connection. |
158 // This may be useful for protocols, like SPDY, which allow the same | 168 // This may be useful for protocols, like SPDY, which allow the same |
159 // connection to be shared between multiple domains, each of which need | 169 // connection to be shared between multiple domains, each of which need |
160 // a channel ID. | 170 // a channel ID. |
161 // | 171 // |
162 // Public for ssl_client_socket_openssl_unittest.cc. | 172 // Public for ssl_client_socket_openssl_unittest.cc. |
163 virtual bool WasChannelIDSent() const; | 173 virtual bool WasChannelIDSent() const; |
164 | 174 |
175 // Record which TLS extension was used to negotiate protocol and protocol | |
176 // chosen in a UMA histogram. | |
177 void RecordNegotiationExtension(); | |
178 | |
165 protected: | 179 protected: |
166 virtual void set_channel_id_sent(bool channel_id_sent); | 180 virtual void set_channel_id_sent(bool channel_id_sent); |
167 | 181 |
168 virtual void set_signed_cert_timestamps_received( | 182 virtual void set_signed_cert_timestamps_received( |
169 bool signed_cert_timestamps_received); | 183 bool signed_cert_timestamps_received); |
170 | 184 |
171 virtual void set_stapled_ocsp_response_received( | 185 virtual void set_stapled_ocsp_response_received( |
172 bool stapled_ocsp_response_received); | 186 bool stapled_ocsp_response_received); |
173 | 187 |
174 // Records histograms for channel id support during full handshakes - resumed | 188 // Records histograms for channel id support during full handshakes - resumed |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 // True if NPN successfully negotiated SPDY. | 226 // True if NPN successfully negotiated SPDY. |
213 bool was_spdy_negotiated_; | 227 bool was_spdy_negotiated_; |
214 // Protocol that we negotiated with the server. | 228 // Protocol that we negotiated with the server. |
215 NextProto protocol_negotiated_; | 229 NextProto protocol_negotiated_; |
216 // True if a channel ID was sent. | 230 // True if a channel ID was sent. |
217 bool channel_id_sent_; | 231 bool channel_id_sent_; |
218 // True if SCTs were received via a TLS extension. | 232 // True if SCTs were received via a TLS extension. |
219 bool signed_cert_timestamps_received_; | 233 bool signed_cert_timestamps_received_; |
220 // True if a stapled OCSP response was received. | 234 // True if a stapled OCSP response was received. |
221 bool stapled_ocsp_response_received_; | 235 bool stapled_ocsp_response_received_; |
236 // Protocol negotiation extension used. | |
237 enum SSLNegotiationExtension negotiation_extension_; | |
davidben
2014/10/03 17:55:07
Nit: No 'enum' prefix in C++.
Bence
2014/10/10 15:26:11
Done.
| |
222 }; | 238 }; |
223 | 239 |
224 } // namespace net | 240 } // namespace net |
225 | 241 |
226 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 242 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
OLD | NEW |