| 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" |
| 11 #include "net/base/completion_callback.h" | 11 #include "net/base/completion_callback.h" |
| 12 #include "net/base/load_flags.h" | 12 #include "net/base/load_flags.h" |
| 13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 14 #include "net/socket/ssl_socket.h" | 14 #include "net/socket/ssl_socket.h" |
| 15 #include "net/socket/stream_socket.h" | 15 #include "net/socket/stream_socket.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 | 18 |
| 19 class CertPolicyEnforcer; | 19 class CertPolicyEnforcer; |
| 20 class CertVerifier; | 20 class CertVerifier; |
| 21 class ChannelIDService; | 21 class ChannelIDService; |
| 22 class CTVerifier; | 22 class CTVerifier; |
| 23 class HostPortPair; | |
| 24 class ServerBoundCertService; | |
| 25 class SSLCertRequestInfo; | 23 class SSLCertRequestInfo; |
| 26 struct SSLConfig; | 24 struct SSLConfig; |
| 27 class SSLInfo; | 25 class SSLInfo; |
| 28 class TransportSecurityState; | 26 class TransportSecurityState; |
| 29 class X509Certificate; | 27 class X509Certificate; |
| 30 | 28 |
| 31 // This struct groups together several fields which are used by various | 29 // This struct groups together several fields which are used by various |
| 32 // classes related to SSLClientSocket. | 30 // classes related to SSLClientSocket. |
| 33 struct SSLClientSocketContext { | 31 struct SSLClientSocketContext { |
| 34 SSLClientSocketContext() | 32 SSLClientSocketContext() |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 enum SSLNegotiationExtension { | 86 enum SSLNegotiationExtension { |
| 89 kExtensionUnknown, | 87 kExtensionUnknown, |
| 90 kExtensionALPN, | 88 kExtensionALPN, |
| 91 kExtensionNPN, | 89 kExtensionNPN, |
| 92 }; | 90 }; |
| 93 | 91 |
| 94 // StreamSocket: | 92 // StreamSocket: |
| 95 bool WasNpnNegotiated() const override; | 93 bool WasNpnNegotiated() const override; |
| 96 NextProto GetNegotiatedProtocol() const override; | 94 NextProto GetNegotiatedProtocol() const override; |
| 97 | 95 |
| 98 // Computes a unique key string for the SSL session cache. | |
| 99 virtual std::string GetSessionCacheKey() const = 0; | |
| 100 | |
| 101 // Returns true if there is a cache entry in the SSL session cache | |
| 102 // for the cache key of the SSL socket. | |
| 103 // | |
| 104 // The cache key consists of a host and port concatenated with a session | |
| 105 // cache shard. These two strings are passed to the constructor of most | |
| 106 // subclasses of SSLClientSocket. | |
| 107 virtual bool InSessionCache() const = 0; | |
| 108 | |
| 109 // Sets |callback| to be run when the handshake has fully completed. | |
| 110 // For example, in the case of False Start, Connect() will return | |
| 111 // early, before the peer's TLS Finished message has been verified, | |
| 112 // in order to allow the caller to call Write() and send application | |
| 113 // data with the client's Finished message. | |
| 114 // In such situations, |callback| will be invoked sometime after | |
| 115 // Connect() - either during a Write() or Read() call, and before | |
| 116 // invoking the Read() or Write() callback. | |
| 117 // Otherwise, during a traditional TLS connection (i.e. no False | |
| 118 // Start), this will be called right before the Connect() callback | |
| 119 // is called. | |
| 120 // | |
| 121 // Note that it's not valid to mutate this socket during such | |
| 122 // callbacks, including deleting the socket. | |
| 123 // | |
| 124 // TODO(mshelley): Provide additional details about whether or not | |
| 125 // the handshake actually succeeded or not. This can be inferred | |
| 126 // from the result to Connect()/Read()/Write(), but may be useful | |
| 127 // to inform here as well. | |
| 128 virtual void SetHandshakeCompletionCallback( | |
| 129 const base::Closure& callback) = 0; | |
| 130 | |
| 131 // Gets the SSL CertificateRequest info of the socket after Connect failed | 96 // Gets the SSL CertificateRequest info of the socket after Connect failed |
| 132 // with ERR_SSL_CLIENT_AUTH_CERT_NEEDED. | 97 // with ERR_SSL_CLIENT_AUTH_CERT_NEEDED. |
| 133 virtual void GetSSLCertRequestInfo( | 98 virtual void GetSSLCertRequestInfo( |
| 134 SSLCertRequestInfo* cert_request_info) = 0; | 99 SSLCertRequestInfo* cert_request_info) = 0; |
| 135 | 100 |
| 136 // Get the application level protocol that we negotiated with the server. | 101 // Get the application level protocol that we negotiated with the server. |
| 137 // *proto is set to the resulting protocol (n.b. that the string may have | 102 // *proto is set to the resulting protocol (n.b. that the string may have |
| 138 // embedded NULs). | 103 // embedded NULs). |
| 139 // kNextProtoUnsupported: *proto is cleared. | 104 // kNextProtoUnsupported: *proto is cleared. |
| 140 // kNextProtoNegotiated: *proto is set to the negotiated protocol. | 105 // kNextProtoNegotiated: *proto is set to the negotiated protocol. |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 bool signed_cert_timestamps_received_; | 222 bool signed_cert_timestamps_received_; |
| 258 // True if a stapled OCSP response was received. | 223 // True if a stapled OCSP response was received. |
| 259 bool stapled_ocsp_response_received_; | 224 bool stapled_ocsp_response_received_; |
| 260 // Protocol negotiation extension used. | 225 // Protocol negotiation extension used. |
| 261 SSLNegotiationExtension negotiation_extension_; | 226 SSLNegotiationExtension negotiation_extension_; |
| 262 }; | 227 }; |
| 263 | 228 |
| 264 } // namespace net | 229 } // namespace net |
| 265 | 230 |
| 266 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 231 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
| OLD | NEW |