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_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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; | 88 virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; |
| 89 | 89 |
| 90 // Socket implementation. | 90 // Socket implementation. |
| 91 virtual int Read(IOBuffer* buf, int buf_len, | 91 virtual int Read(IOBuffer* buf, int buf_len, |
| 92 const CompletionCallback& callback) OVERRIDE; | 92 const CompletionCallback& callback) OVERRIDE; |
| 93 virtual int Write(IOBuffer* buf, int buf_len, | 93 virtual int Write(IOBuffer* buf, int buf_len, |
| 94 const CompletionCallback& callback) OVERRIDE; | 94 const CompletionCallback& callback) OVERRIDE; |
| 95 virtual int SetReceiveBufferSize(int32 size) OVERRIDE; | 95 virtual int SetReceiveBufferSize(int32 size) OVERRIDE; |
| 96 virtual int SetSendBufferSize(int32 size) OVERRIDE; | 96 virtual int SetSendBufferSize(int32 size) OVERRIDE; |
| 97 | 97 |
| 98 void CheckIfSessionFinished(); | |
|
Ryan Sleevi
2014/08/06 01:31:30
This doesn't need to be public, does it? The stati
mshelley
2014/08/06 03:09:31
Done.
| |
| 99 | |
| 98 protected: | 100 protected: |
| 99 // SSLClientSocket implementation. | 101 // SSLClientSocket implementation. |
| 100 virtual scoped_refptr<X509Certificate> GetUnverifiedServerCertificateChain() | 102 virtual scoped_refptr<X509Certificate> GetUnverifiedServerCertificateChain() |
| 101 const OVERRIDE; | 103 const OVERRIDE; |
| 102 | 104 |
| 103 private: | 105 private: |
| 104 class PeerCertificateChain; | 106 class PeerCertificateChain; |
| 105 class SSLContext; | 107 class SSLContext; |
| 106 friend class SSLClientSocket; | 108 friend class SSLClientSocket; |
| 107 friend class SSLContext; | 109 friend class SSLContext; |
| 108 | 110 |
| 111 // Callback that is run by OpenSSL when a session's handshake has finished. | |
| 112 static void OnSessionFinishedCallback(const SSL* ssl, int result, int unused); | |
| 113 | |
| 109 int Init(); | 114 int Init(); |
| 110 void DoReadCallback(int result); | 115 void DoReadCallback(int result); |
| 111 void DoWriteCallback(int result); | 116 void DoWriteCallback(int result); |
| 112 | 117 |
| 113 // Compute a unique key string for the SSL session cache. | 118 // Compute a unique key string for the SSL session cache. |
| 114 std::string GetSessionCacheKey() const; | 119 std::string GetSessionCacheKey() const; |
| 115 void OnHandshakeCompletion(); | 120 void OnHandshakeCompletion(); |
| 116 | 121 |
| 117 bool DoTransportIO(); | 122 bool DoTransportIO(); |
| 118 int DoHandshake(); | 123 int DoHandshake(); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 261 STATE_VERIFY_CERT_COMPLETE, | 266 STATE_VERIFY_CERT_COMPLETE, |
| 262 }; | 267 }; |
| 263 State next_handshake_state_; | 268 State next_handshake_state_; |
| 264 NextProtoStatus npn_status_; | 269 NextProtoStatus npn_status_; |
| 265 std::string npn_proto_; | 270 std::string npn_proto_; |
| 266 // Written by the |channel_id_service_|. | 271 // Written by the |channel_id_service_|. |
| 267 std::string channel_id_private_key_; | 272 std::string channel_id_private_key_; |
| 268 std::string channel_id_cert_; | 273 std::string channel_id_cert_; |
| 269 // True if channel ID extension was negotiated. | 274 // True if channel ID extension was negotiated. |
| 270 bool channel_id_xtn_negotiated_; | 275 bool channel_id_xtn_negotiated_; |
| 276 // Integer indicating the status of this connection's SSL handshake. | |
| 277 // | |
| 278 // |session_completion_count_| < 2 means that the ssl session associated with | |
| 279 // this socket has not been added to the session cache or has not been marked | |
| 280 // as good. |session_completion_count_| is incremented when a sesion is added | |
| 281 // to the session cache or marked as good, thus |session_completion_count_| | |
| 282 // == 2 means that the session is ready for use. | |
| 283 int session_completion_count_; | |
| 271 // The request handle for |channel_id_service_|. | 284 // The request handle for |channel_id_service_|. |
| 272 ChannelIDService::RequestHandle channel_id_request_handle_; | 285 ChannelIDService::RequestHandle channel_id_request_handle_; |
| 273 BoundNetLog net_log_; | 286 BoundNetLog net_log_; |
| 274 }; | 287 }; |
| 275 | 288 |
| 276 } // namespace net | 289 } // namespace net |
| 277 | 290 |
| 278 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ | 291 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
| OLD | NEW |