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_OPENSSL_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 SSLClientSocketOpenSSL(scoped_ptr<ClientSocketHandle> transport_socket, | 48 SSLClientSocketOpenSSL(scoped_ptr<ClientSocketHandle> transport_socket, |
49 const HostPortPair& host_and_port, | 49 const HostPortPair& host_and_port, |
50 const SSLConfig& ssl_config, | 50 const SSLConfig& ssl_config, |
51 const SSLClientSocketContext& context); | 51 const SSLClientSocketContext& context); |
52 virtual ~SSLClientSocketOpenSSL(); | 52 virtual ~SSLClientSocketOpenSSL(); |
53 | 53 |
54 const HostPortPair& host_and_port() const { return host_and_port_; } | 54 const HostPortPair& host_and_port() const { return host_and_port_; } |
55 const std::string& ssl_session_cache_shard() const { | 55 const std::string& ssl_session_cache_shard() const { |
56 return ssl_session_cache_shard_; | 56 return ssl_session_cache_shard_; |
57 } | 57 } |
| 58 std::string GetSessionCacheKey() const; |
58 | 59 |
59 // SSLClientSocket implementation. | 60 // SSLClientSocket implementation. |
| 61 virtual bool InSessionCache() const OVERRIDE; |
| 62 virtual void WatchSessionForCompletion( |
| 63 const base::Closure& callback) OVERRIDE; |
| 64 virtual void SetSocketFailureCallback(const base::Closure& callback) OVERRIDE; |
| 65 virtual void SetIsLeader() OVERRIDE; |
| 66 virtual void OnSocketFailure() OVERRIDE; |
60 virtual void GetSSLCertRequestInfo( | 67 virtual void GetSSLCertRequestInfo( |
61 SSLCertRequestInfo* cert_request_info) OVERRIDE; | 68 SSLCertRequestInfo* cert_request_info) OVERRIDE; |
62 virtual NextProtoStatus GetNextProto(std::string* proto, | 69 virtual NextProtoStatus GetNextProto(std::string* proto, |
63 std::string* server_protos) OVERRIDE; | 70 std::string* server_protos) OVERRIDE; |
64 virtual ServerBoundCertService* GetServerBoundCertService() const OVERRIDE; | 71 virtual ServerBoundCertService* GetServerBoundCertService() const OVERRIDE; |
65 | 72 |
66 // SSLSocket implementation. | 73 // SSLSocket implementation. |
67 virtual int ExportKeyingMaterial(const base::StringPiece& label, | 74 virtual int ExportKeyingMaterial(const base::StringPiece& label, |
68 bool has_context, | 75 bool has_context, |
69 const base::StringPiece& context, | 76 const base::StringPiece& context, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 int CertVerifyCallback(X509_STORE_CTX *store_ctx); | 153 int CertVerifyCallback(X509_STORE_CTX *store_ctx); |
147 | 154 |
148 // Callback from the SSL layer to check which NPN protocol we are supporting | 155 // Callback from the SSL layer to check which NPN protocol we are supporting |
149 int SelectNextProtoCallback(unsigned char** out, unsigned char* outlen, | 156 int SelectNextProtoCallback(unsigned char** out, unsigned char* outlen, |
150 const unsigned char* in, unsigned int inlen); | 157 const unsigned char* in, unsigned int inlen); |
151 | 158 |
152 bool transport_send_busy_; | 159 bool transport_send_busy_; |
153 bool transport_recv_busy_; | 160 bool transport_recv_busy_; |
154 bool transport_recv_eof_; | 161 bool transport_recv_eof_; |
155 | 162 |
| 163 // True if the socket has been read from before. |
| 164 bool has_read_; |
| 165 |
| 166 // Counts how many times the socket has been written to. |
| 167 int has_written_; |
| 168 |
156 scoped_refptr<DrainableIOBuffer> send_buffer_; | 169 scoped_refptr<DrainableIOBuffer> send_buffer_; |
157 scoped_refptr<IOBuffer> recv_buffer_; | 170 scoped_refptr<IOBuffer> recv_buffer_; |
158 | 171 |
159 CompletionCallback user_connect_callback_; | 172 CompletionCallback user_connect_callback_; |
160 CompletionCallback user_read_callback_; | 173 CompletionCallback user_read_callback_; |
161 CompletionCallback user_write_callback_; | 174 CompletionCallback user_write_callback_; |
162 | 175 |
163 base::WeakPtrFactory<SSLClientSocketOpenSSL> weak_factory_; | 176 base::WeakPtrFactory<SSLClientSocketOpenSSL> weak_factory_; |
164 | 177 |
165 // Used by Read function. | 178 // Used by Read function. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // List of SSLClientCertType values for client certificates allowed by the | 214 // List of SSLClientCertType values for client certificates allowed by the |
202 // server. | 215 // server. |
203 std::vector<SSLClientCertType> cert_key_types_; | 216 std::vector<SSLClientCertType> cert_key_types_; |
204 | 217 |
205 CertVerifier* const cert_verifier_; | 218 CertVerifier* const cert_verifier_; |
206 scoped_ptr<SingleRequestCertVerifier> verifier_; | 219 scoped_ptr<SingleRequestCertVerifier> verifier_; |
207 | 220 |
208 // The service for retrieving Channel ID keys. May be NULL. | 221 // The service for retrieving Channel ID keys. May be NULL. |
209 ServerBoundCertService* server_bound_cert_service_; | 222 ServerBoundCertService* server_bound_cert_service_; |
210 | 223 |
| 224 // Callback that is invoked when the connection encounters an error. |
| 225 base::Closure error_callback_; |
| 226 |
| 227 // True if there may be pending sockets waiting for this socket to connect. |
| 228 bool is_leader_; |
| 229 |
211 // OpenSSL stuff | 230 // OpenSSL stuff |
212 SSL* ssl_; | 231 SSL* ssl_; |
213 BIO* transport_bio_; | 232 BIO* transport_bio_; |
214 | 233 |
215 scoped_ptr<ClientSocketHandle> transport_; | 234 scoped_ptr<ClientSocketHandle> transport_; |
216 const HostPortPair host_and_port_; | 235 const HostPortPair host_and_port_; |
217 SSLConfig ssl_config_; | 236 SSLConfig ssl_config_; |
218 // ssl_session_cache_shard_ is an opaque string that partitions the SSL | 237 // ssl_session_cache_shard_ is an opaque string that partitions the SSL |
219 // session cache. i.e. sessions created with one value will not attempt to | 238 // session cache. i.e. sessions created with one value will not attempt to |
220 // resume on the socket with a different value. | 239 // resume on the socket with a different value. |
(...skipping 20 matching lines...) Expand all Loading... |
241 // True if channel ID extension was negotiated. | 260 // True if channel ID extension was negotiated. |
242 bool channel_id_xtn_negotiated_; | 261 bool channel_id_xtn_negotiated_; |
243 // The request handle for |server_bound_cert_service_|. | 262 // The request handle for |server_bound_cert_service_|. |
244 ServerBoundCertService::RequestHandle channel_id_request_handle_; | 263 ServerBoundCertService::RequestHandle channel_id_request_handle_; |
245 BoundNetLog net_log_; | 264 BoundNetLog net_log_; |
246 }; | 265 }; |
247 | 266 |
248 } // namespace net | 267 } // namespace net |
249 | 268 |
250 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ | 269 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
OLD | NEW |