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