OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "net/base/cert_verify_result.h" | 10 #include "net/base/cert_verify_result.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 class SSLInfo; | 25 class SSLInfo; |
26 | 26 |
27 // An SSL client socket implemented with OpenSSL. | 27 // An SSL client socket implemented with OpenSSL. |
28 class SSLClientSocketOpenSSL : public SSLClientSocket { | 28 class SSLClientSocketOpenSSL : public SSLClientSocket { |
29 public: | 29 public: |
30 // Takes ownership of the transport_socket, which may already be connected. | 30 // Takes ownership of the transport_socket, which may already be connected. |
31 // The given hostname will be compared with the name(s) in the server's | 31 // The given hostname will be compared with the name(s) in the server's |
32 // certificate during the SSL handshake. ssl_config specifies the SSL | 32 // certificate during the SSL handshake. ssl_config specifies the SSL |
33 // settings. | 33 // settings. |
34 SSLClientSocketOpenSSL(ClientSocketHandle* transport_socket, | 34 SSLClientSocketOpenSSL(ClientSocketHandle* transport_socket, |
35 const std::string& hostname, | 35 const HostPortPair& host_and_port, |
36 uint16 port, | |
37 const SSLConfig& ssl_config); | 36 const SSLConfig& ssl_config); |
38 ~SSLClientSocketOpenSSL(); | 37 ~SSLClientSocketOpenSSL(); |
39 | 38 |
40 // SSLClientSocket methods: | 39 // SSLClientSocket methods: |
41 virtual void GetSSLInfo(SSLInfo* ssl_info); | 40 virtual void GetSSLInfo(SSLInfo* ssl_info); |
42 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); | 41 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); |
43 virtual NextProtoStatus GetNextProto(std::string* proto); | 42 virtual NextProtoStatus GetNextProto(std::string* proto); |
44 | 43 |
45 // ClientSocket methods: | 44 // ClientSocket methods: |
46 virtual int Connect(CompletionCallback* callback); | 45 virtual int Connect(CompletionCallback* callback); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 bool client_auth_cert_needed_; | 118 bool client_auth_cert_needed_; |
120 | 119 |
121 scoped_ptr<CertVerifier> verifier_; | 120 scoped_ptr<CertVerifier> verifier_; |
122 CompletionCallbackImpl<SSLClientSocketOpenSSL> handshake_io_callback_; | 121 CompletionCallbackImpl<SSLClientSocketOpenSSL> handshake_io_callback_; |
123 | 122 |
124 // OpenSSL stuff | 123 // OpenSSL stuff |
125 SSL* ssl_; | 124 SSL* ssl_; |
126 BIO* transport_bio_; | 125 BIO* transport_bio_; |
127 | 126 |
128 scoped_ptr<ClientSocketHandle> transport_; | 127 scoped_ptr<ClientSocketHandle> transport_; |
129 std::string hostname_; | 128 const HostPortPair host_and_port_; |
130 uint16 port_; | |
131 SSLConfig ssl_config_; | 129 SSLConfig ssl_config_; |
132 | 130 |
133 bool completed_handshake_; | 131 bool completed_handshake_; |
134 | 132 |
135 enum State { | 133 enum State { |
136 STATE_NONE, | 134 STATE_NONE, |
137 STATE_HANDSHAKE, | 135 STATE_HANDSHAKE, |
138 STATE_VERIFY_CERT, | 136 STATE_VERIFY_CERT, |
139 STATE_VERIFY_CERT_COMPLETE, | 137 STATE_VERIFY_CERT_COMPLETE, |
140 }; | 138 }; |
141 State next_handshake_state_; | 139 State next_handshake_state_; |
142 BoundNetLog net_log_; | 140 BoundNetLog net_log_; |
143 }; | 141 }; |
144 | 142 |
145 } // namespace net | 143 } // namespace net |
146 | 144 |
147 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ | 145 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
148 | 146 |
OLD | NEW |