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_WIN_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ |
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ |
7 | 7 |
8 #define SECURITY_WIN32 // Needs to be defined before including security.h | 8 #define SECURITY_WIN32 // Needs to be defined before including security.h |
9 | 9 |
10 #include <windows.h> | 10 #include <windows.h> |
11 #include <wincrypt.h> | 11 #include <wincrypt.h> |
12 #include <security.h> | 12 #include <security.h> |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 | 15 |
16 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
17 #include "net/base/cert_verify_result.h" | 17 #include "net/base/cert_verify_result.h" |
18 #include "net/base/completion_callback.h" | 18 #include "net/base/completion_callback.h" |
19 #include "net/base/net_log.h" | 19 #include "net/base/net_log.h" |
20 #include "net/base/ssl_config_service.h" | 20 #include "net/base/ssl_config_service.h" |
21 #include "net/socket/ssl_client_socket.h" | 21 #include "net/socket/ssl_client_socket.h" |
22 | 22 |
23 namespace net { | 23 namespace net { |
24 | 24 |
25 class CertVerifier; | 25 class CertVerifier; |
| 26 class ClientSocketHandle; |
26 class BoundNetLog; | 27 class BoundNetLog; |
27 | 28 |
28 // An SSL client socket implemented with the Windows Schannel. | 29 // An SSL client socket implemented with the Windows Schannel. |
29 class SSLClientSocketWin : public SSLClientSocket { | 30 class SSLClientSocketWin : public SSLClientSocket { |
30 public: | 31 public: |
31 // Takes ownership of the transport_socket, which may already be connected. | 32 // Takes ownership of the transport_socket, which may already be connected. |
32 // The given hostname will be compared with the name(s) in the server's | 33 // The given hostname will be compared with the name(s) in the server's |
33 // certificate during the SSL handshake. ssl_config specifies the SSL | 34 // certificate during the SSL handshake. ssl_config specifies the SSL |
34 // settings. | 35 // settings. |
35 SSLClientSocketWin(ClientSocket* transport_socket, | 36 SSLClientSocketWin(ClientSocketHandle* transport_socket, |
36 const std::string& hostname, | 37 const std::string& hostname, |
37 const SSLConfig& ssl_config); | 38 const SSLConfig& ssl_config); |
38 ~SSLClientSocketWin(); | 39 ~SSLClientSocketWin(); |
39 | 40 |
40 // SSLClientSocket methods: | 41 // SSLClientSocket methods: |
41 virtual void GetSSLInfo(SSLInfo* ssl_info); | 42 virtual void GetSSLInfo(SSLInfo* ssl_info); |
42 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); | 43 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); |
43 virtual NextProtoStatus GetNextProto(std::string* proto); | 44 virtual NextProtoStatus GetNextProto(std::string* proto); |
44 | 45 |
45 // ClientSocket methods: | 46 // ClientSocket methods: |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 int DidCompleteHandshake(); | 90 int DidCompleteHandshake(); |
90 void DidCompleteRenegotiation(); | 91 void DidCompleteRenegotiation(); |
91 void LogConnectionTypeMetrics() const; | 92 void LogConnectionTypeMetrics() const; |
92 void FreeSendBuffer(); | 93 void FreeSendBuffer(); |
93 | 94 |
94 // Internal callbacks as async operations complete. | 95 // Internal callbacks as async operations complete. |
95 CompletionCallbackImpl<SSLClientSocketWin> handshake_io_callback_; | 96 CompletionCallbackImpl<SSLClientSocketWin> handshake_io_callback_; |
96 CompletionCallbackImpl<SSLClientSocketWin> read_callback_; | 97 CompletionCallbackImpl<SSLClientSocketWin> read_callback_; |
97 CompletionCallbackImpl<SSLClientSocketWin> write_callback_; | 98 CompletionCallbackImpl<SSLClientSocketWin> write_callback_; |
98 | 99 |
99 scoped_ptr<ClientSocket> transport_; | 100 scoped_ptr<ClientSocketHandle> transport_; |
100 std::string hostname_; | 101 std::string hostname_; |
101 SSLConfig ssl_config_; | 102 SSLConfig ssl_config_; |
102 | 103 |
103 // User function to callback when the Connect() completes. | 104 // User function to callback when the Connect() completes. |
104 CompletionCallback* user_connect_callback_; | 105 CompletionCallback* user_connect_callback_; |
105 | 106 |
106 // User function to callback when a Read() completes. | 107 // User function to callback when a Read() completes. |
107 CompletionCallback* user_read_callback_; | 108 CompletionCallback* user_read_callback_; |
108 scoped_refptr<IOBuffer> user_read_buf_; | 109 scoped_refptr<IOBuffer> user_read_buf_; |
109 int user_read_buf_len_; | 110 int user_read_buf_len_; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 183 |
183 // True when the decrypter needs more data in order to decrypt. | 184 // True when the decrypter needs more data in order to decrypt. |
184 bool need_more_data_; | 185 bool need_more_data_; |
185 | 186 |
186 BoundNetLog net_log_; | 187 BoundNetLog net_log_; |
187 }; | 188 }; |
188 | 189 |
189 } // namespace net | 190 } // namespace net |
190 | 191 |
191 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ | 192 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ |
OLD | NEW |