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 // Sets |ran_session_finished_callback_| to true. | |
99 void SetSSLHandshakeComplete(); | |
Ryan Sleevi
2014/08/06 23:42:03
This doesn't need to be a public method
Explanati
mshelley
2014/08/07 00:21:59
Done.
| |
100 | |
98 protected: | 101 protected: |
99 // SSLClientSocket implementation. | 102 // SSLClientSocket implementation. |
100 virtual scoped_refptr<X509Certificate> GetUnverifiedServerCertificateChain() | 103 virtual scoped_refptr<X509Certificate> GetUnverifiedServerCertificateChain() |
101 const OVERRIDE; | 104 const OVERRIDE; |
102 | 105 |
103 private: | 106 private: |
104 class PeerCertificateChain; | 107 class PeerCertificateChain; |
105 class SSLContext; | 108 class SSLContext; |
106 friend class SSLClientSocket; | 109 friend class SSLClientSocket; |
107 friend class SSLContext; | 110 friend class SSLContext; |
108 | 111 |
112 // Callback that is run by OpenSSL when a session's handshake has finished. | |
113 static void OnSessionFinishedCallback(const SSL* ssl, int result, int unused); | |
114 | |
109 int Init(); | 115 int Init(); |
110 void DoReadCallback(int result); | 116 void DoReadCallback(int result); |
111 void DoWriteCallback(int result); | 117 void DoWriteCallback(int result); |
112 | 118 |
113 // Compute a unique key string for the SSL session cache. | 119 // Compute a unique key string for the SSL session cache. |
114 std::string GetSessionCacheKey() const; | 120 std::string GetSessionCacheKey() const; |
115 void OnHandshakeCompletion(); | 121 void OnHandshakeCompletion(); |
116 | 122 |
117 bool DoTransportIO(); | 123 bool DoTransportIO(); |
118 int DoHandshake(); | 124 int DoHandshake(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 const char *argp, int argi, long argl, | 167 const char *argp, int argi, long argl, |
162 long retvalue); | 168 long retvalue); |
163 | 169 |
164 // Callback from the SSL layer when an operation is performed on | 170 // Callback from the SSL layer when an operation is performed on |
165 // |transport_bio_|'s peer. | 171 // |transport_bio_|'s peer. |
166 static long BIOCallback(BIO *bio, | 172 static long BIOCallback(BIO *bio, |
167 int cmd, | 173 int cmd, |
168 const char *argp, int argi, long argl, | 174 const char *argp, int argi, long argl, |
169 long retvalue); | 175 long retvalue); |
170 | 176 |
177 void CheckIfSessionFinished(); | |
178 | |
171 bool transport_send_busy_; | 179 bool transport_send_busy_; |
172 bool transport_recv_busy_; | 180 bool transport_recv_busy_; |
173 | 181 |
174 scoped_refptr<DrainableIOBuffer> send_buffer_; | 182 scoped_refptr<DrainableIOBuffer> send_buffer_; |
175 scoped_refptr<IOBuffer> recv_buffer_; | 183 scoped_refptr<IOBuffer> recv_buffer_; |
176 | 184 |
177 CompletionCallback user_connect_callback_; | 185 CompletionCallback user_connect_callback_; |
178 CompletionCallback user_read_callback_; | 186 CompletionCallback user_read_callback_; |
179 CompletionCallback user_write_callback_; | 187 CompletionCallback user_write_callback_; |
180 | 188 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
261 STATE_VERIFY_CERT_COMPLETE, | 269 STATE_VERIFY_CERT_COMPLETE, |
262 }; | 270 }; |
263 State next_handshake_state_; | 271 State next_handshake_state_; |
264 NextProtoStatus npn_status_; | 272 NextProtoStatus npn_status_; |
265 std::string npn_proto_; | 273 std::string npn_proto_; |
266 // Written by the |channel_id_service_|. | 274 // Written by the |channel_id_service_|. |
267 std::string channel_id_private_key_; | 275 std::string channel_id_private_key_; |
268 std::string channel_id_cert_; | 276 std::string channel_id_cert_; |
269 // True if channel ID extension was negotiated. | 277 // True if channel ID extension was negotiated. |
270 bool channel_id_xtn_negotiated_; | 278 bool channel_id_xtn_negotiated_; |
279 // True if OnSessionFinishedCallback has been run. | |
280 bool ran_session_finished_callback_; | |
271 // The request handle for |channel_id_service_|. | 281 // The request handle for |channel_id_service_|. |
272 ChannelIDService::RequestHandle channel_id_request_handle_; | 282 ChannelIDService::RequestHandle channel_id_request_handle_; |
273 BoundNetLog net_log_; | 283 BoundNetLog net_log_; |
274 }; | 284 }; |
275 | 285 |
276 } // namespace net | 286 } // namespace net |
277 | 287 |
278 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ | 288 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
OLD | NEW |