Chromium Code Reviews| 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. | |
| 84 enum SSLProtocolNegotiation { | |
| 85 // Unknown. | |
| 86 PN_UNKNOWN = -1, | |
| 87 // Application-Layer Protocol Negotiation. | |
| 88 PN_ALPN = 0, | |
| 89 // Next Protocol Negotiation used. | |
| 90 PN_NPN = 500, | |
| 91 // Next Protocol Negotiation used, but there was no overlap between client | |
| 92 // and server supported protocols. Fallback to first one on client's list. | |
| 93 PN_NPN_NO_OVERLAP = 1000, | |
|
davidben
2014/09/19 21:09:17
It seems strange to have this enum with large numb
Bence
2014/10/03 10:50:22
Done.
I changed to kExtension* to better distingu
| |
| 94 }; | |
| 95 | |
| 82 // StreamSocket: | 96 // StreamSocket: |
| 83 virtual bool WasNpnNegotiated() const OVERRIDE; | 97 virtual bool WasNpnNegotiated() const OVERRIDE; |
| 84 virtual NextProto GetNegotiatedProtocol() const OVERRIDE; | 98 virtual NextProto GetNegotiatedProtocol() const OVERRIDE; |
| 85 | 99 |
| 86 // Computes a unique key string for the SSL session cache. | 100 // Computes a unique key string for the SSL session cache. |
| 87 virtual std::string GetSessionCacheKey() const = 0; | 101 virtual std::string GetSessionCacheKey() const = 0; |
| 88 | 102 |
| 89 // Returns true if there is a cache entry in the SSL session cache | 103 // Returns true if there is a cache entry in the SSL session cache |
| 90 // for the cache key of the SSL socket. | 104 // for the cache key of the SSL socket. |
| 91 // | 105 // |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 static void ClearSessionCache(); | 157 static void ClearSessionCache(); |
| 144 | 158 |
| 145 virtual bool set_was_npn_negotiated(bool negotiated); | 159 virtual bool set_was_npn_negotiated(bool negotiated); |
| 146 | 160 |
| 147 virtual bool was_spdy_negotiated() const; | 161 virtual bool was_spdy_negotiated() const; |
| 148 | 162 |
| 149 virtual bool set_was_spdy_negotiated(bool negotiated); | 163 virtual bool set_was_spdy_negotiated(bool negotiated); |
| 150 | 164 |
| 151 virtual void set_protocol_negotiated(NextProto protocol_negotiated); | 165 virtual void set_protocol_negotiated(NextProto protocol_negotiated); |
| 152 | 166 |
| 167 void set_protocol_negotiation( | |
| 168 enum SSLProtocolNegotiation protocol_negotiation); | |
|
davidben
2014/09/19 21:09:17
No 'enum' prefix in C++.
Bence
2014/10/03 10:50:22
Done.
| |
| 169 | |
| 153 // Returns the ChannelIDService used by this socket, or NULL if | 170 // Returns the ChannelIDService used by this socket, or NULL if |
| 154 // channel ids are not supported. | 171 // channel ids are not supported. |
| 155 virtual ChannelIDService* GetChannelIDService() const = 0; | 172 virtual ChannelIDService* GetChannelIDService() const = 0; |
| 156 | 173 |
| 157 // Returns true if a channel ID was sent on this connection. | 174 // Returns true if a channel ID was sent on this connection. |
| 158 // This may be useful for protocols, like SPDY, which allow the same | 175 // This may be useful for protocols, like SPDY, which allow the same |
| 159 // connection to be shared between multiple domains, each of which need | 176 // connection to be shared between multiple domains, each of which need |
| 160 // a channel ID. | 177 // a channel ID. |
| 161 // | 178 // |
| 162 // Public for ssl_client_socket_openssl_unittest.cc. | 179 // Public for ssl_client_socket_openssl_unittest.cc. |
| 163 virtual bool WasChannelIDSent() const; | 180 virtual bool WasChannelIDSent() const; |
| 164 | 181 |
| 182 // Record which TLS extension was used to negotiate protocol and protocol | |
| 183 // chosen in a UMA histogram. | |
| 184 void RecordProtocolNegotiation(); | |
| 185 | |
| 165 protected: | 186 protected: |
| 166 virtual void set_channel_id_sent(bool channel_id_sent); | 187 virtual void set_channel_id_sent(bool channel_id_sent); |
| 167 | 188 |
| 168 virtual void set_signed_cert_timestamps_received( | 189 virtual void set_signed_cert_timestamps_received( |
| 169 bool signed_cert_timestamps_received); | 190 bool signed_cert_timestamps_received); |
| 170 | 191 |
| 171 virtual void set_stapled_ocsp_response_received( | 192 virtual void set_stapled_ocsp_response_received( |
| 172 bool stapled_ocsp_response_received); | 193 bool stapled_ocsp_response_received); |
| 173 | 194 |
| 174 // Records histograms for channel id support during full handshakes - resumed | 195 // 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. | 233 // True if NPN successfully negotiated SPDY. |
| 213 bool was_spdy_negotiated_; | 234 bool was_spdy_negotiated_; |
| 214 // Protocol that we negotiated with the server. | 235 // Protocol that we negotiated with the server. |
| 215 NextProto protocol_negotiated_; | 236 NextProto protocol_negotiated_; |
| 216 // True if a channel ID was sent. | 237 // True if a channel ID was sent. |
| 217 bool channel_id_sent_; | 238 bool channel_id_sent_; |
| 218 // True if SCTs were received via a TLS extension. | 239 // True if SCTs were received via a TLS extension. |
| 219 bool signed_cert_timestamps_received_; | 240 bool signed_cert_timestamps_received_; |
| 220 // True if a stapled OCSP response was received. | 241 // True if a stapled OCSP response was received. |
| 221 bool stapled_ocsp_response_received_; | 242 bool stapled_ocsp_response_received_; |
| 243 // Protocol negotiation extension used. | |
| 244 enum SSLProtocolNegotiation protocol_negotiation_; | |
| 222 }; | 245 }; |
| 223 | 246 |
| 224 } // namespace net | 247 } // namespace net |
| 225 | 248 |
| 226 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 249 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
| OLD | NEW |