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. |
| 83 enum SSLNegotiationExtension { |
| 84 kExtensionUnknown, |
| 85 kExtensionALPN, |
| 86 kExtensionNPN, |
| 87 }; |
| 88 |
82 // StreamSocket: | 89 // StreamSocket: |
83 virtual bool WasNpnNegotiated() const override; | 90 virtual bool WasNpnNegotiated() const override; |
84 virtual NextProto GetNegotiatedProtocol() const override; | 91 virtual NextProto GetNegotiatedProtocol() const override; |
85 | 92 |
86 // Computes a unique key string for the SSL session cache. | 93 // Computes a unique key string for the SSL session cache. |
87 virtual std::string GetSessionCacheKey() const = 0; | 94 virtual std::string GetSessionCacheKey() const = 0; |
88 | 95 |
89 // Returns true if there is a cache entry in the SSL session cache | 96 // Returns true if there is a cache entry in the SSL session cache |
90 // for the cache key of the SSL socket. | 97 // for the cache key of the SSL socket. |
91 // | 98 // |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 static void ClearSessionCache(); | 150 static void ClearSessionCache(); |
144 | 151 |
145 virtual bool set_was_npn_negotiated(bool negotiated); | 152 virtual bool set_was_npn_negotiated(bool negotiated); |
146 | 153 |
147 virtual bool was_spdy_negotiated() const; | 154 virtual bool was_spdy_negotiated() const; |
148 | 155 |
149 virtual bool set_was_spdy_negotiated(bool negotiated); | 156 virtual bool set_was_spdy_negotiated(bool negotiated); |
150 | 157 |
151 virtual void set_protocol_negotiated(NextProto protocol_negotiated); | 158 virtual void set_protocol_negotiated(NextProto protocol_negotiated); |
152 | 159 |
| 160 void set_negotiation_extension(SSLNegotiationExtension negotiation_extension); |
| 161 |
153 // Returns the ChannelIDService used by this socket, or NULL if | 162 // Returns the ChannelIDService used by this socket, or NULL if |
154 // channel ids are not supported. | 163 // channel ids are not supported. |
155 virtual ChannelIDService* GetChannelIDService() const = 0; | 164 virtual ChannelIDService* GetChannelIDService() const = 0; |
156 | 165 |
157 // Returns true if a channel ID was sent on this connection. | 166 // Returns true if a channel ID was sent on this connection. |
158 // This may be useful for protocols, like SPDY, which allow the same | 167 // This may be useful for protocols, like SPDY, which allow the same |
159 // connection to be shared between multiple domains, each of which need | 168 // connection to be shared between multiple domains, each of which need |
160 // a channel ID. | 169 // a channel ID. |
161 // | 170 // |
162 // Public for ssl_client_socket_openssl_unittest.cc. | 171 // Public for ssl_client_socket_openssl_unittest.cc. |
163 virtual bool WasChannelIDSent() const; | 172 virtual bool WasChannelIDSent() const; |
164 | 173 |
| 174 // Record which TLS extension was used to negotiate protocol and protocol |
| 175 // chosen in a UMA histogram. |
| 176 void RecordNegotiationExtension(); |
| 177 |
165 protected: | 178 protected: |
166 virtual void set_channel_id_sent(bool channel_id_sent); | 179 virtual void set_channel_id_sent(bool channel_id_sent); |
167 | 180 |
168 virtual void set_signed_cert_timestamps_received( | 181 virtual void set_signed_cert_timestamps_received( |
169 bool signed_cert_timestamps_received); | 182 bool signed_cert_timestamps_received); |
170 | 183 |
171 virtual void set_stapled_ocsp_response_received( | 184 virtual void set_stapled_ocsp_response_received( |
172 bool stapled_ocsp_response_received); | 185 bool stapled_ocsp_response_received); |
173 | 186 |
174 // Records histograms for channel id support during full handshakes - resumed | 187 // 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. | 225 // True if NPN successfully negotiated SPDY. |
213 bool was_spdy_negotiated_; | 226 bool was_spdy_negotiated_; |
214 // Protocol that we negotiated with the server. | 227 // Protocol that we negotiated with the server. |
215 NextProto protocol_negotiated_; | 228 NextProto protocol_negotiated_; |
216 // True if a channel ID was sent. | 229 // True if a channel ID was sent. |
217 bool channel_id_sent_; | 230 bool channel_id_sent_; |
218 // True if SCTs were received via a TLS extension. | 231 // True if SCTs were received via a TLS extension. |
219 bool signed_cert_timestamps_received_; | 232 bool signed_cert_timestamps_received_; |
220 // True if a stapled OCSP response was received. | 233 // True if a stapled OCSP response was received. |
221 bool stapled_ocsp_response_received_; | 234 bool stapled_ocsp_response_received_; |
| 235 // Protocol negotiation extension used. |
| 236 SSLNegotiationExtension negotiation_extension_; |
222 }; | 237 }; |
223 | 238 |
224 } // namespace net | 239 } // namespace net |
225 | 240 |
226 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 241 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
OLD | NEW |