| 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_NSS_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ |
| 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <certt.h> | 9 #include <certt.h> |
| 10 #include <keyt.h> | 10 #include <keyt.h> |
| 11 #include <nspr.h> | 11 #include <nspr.h> |
| 12 #include <nss.h> | 12 #include <nss.h> |
| 13 | 13 |
| 14 #include <string> | 14 #include <string> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/scoped_ptr.h" | 17 #include "base/scoped_ptr.h" |
| 18 #include "base/time.h" | 18 #include "base/time.h" |
| 19 #include "base/timer.h" | 19 #include "base/timer.h" |
| 20 #include "net/base/cert_verify_result.h" | 20 #include "net/base/cert_verify_result.h" |
| 21 #include "net/base/completion_callback.h" | 21 #include "net/base/completion_callback.h" |
| 22 #include "net/base/host_port_pair.h" |
| 22 #include "net/base/net_log.h" | 23 #include "net/base/net_log.h" |
| 23 #include "net/base/nss_memio.h" | 24 #include "net/base/nss_memio.h" |
| 24 #include "net/base/ssl_config_service.h" | 25 #include "net/base/ssl_config_service.h" |
| 25 #include "net/base/x509_certificate.h" | 26 #include "net/base/x509_certificate.h" |
| 26 #include "net/socket/ssl_client_socket.h" | 27 #include "net/socket/ssl_client_socket.h" |
| 27 | 28 |
| 28 namespace net { | 29 namespace net { |
| 29 | 30 |
| 30 class BoundNetLog; | 31 class BoundNetLog; |
| 31 class CertVerifier; | 32 class CertVerifier; |
| 32 class ClientSocketHandle; | 33 class ClientSocketHandle; |
| 33 class DnsRRResolver; | 34 class DnsRRResolver; |
| 34 class SSLHostInfo; | 35 class SSLHostInfo; |
| 35 class X509Certificate; | 36 class X509Certificate; |
| 36 | 37 |
| 37 // An SSL client socket implemented with Mozilla NSS. | 38 // An SSL client socket implemented with Mozilla NSS. |
| 38 class SSLClientSocketNSS : public SSLClientSocket { | 39 class SSLClientSocketNSS : public SSLClientSocket { |
| 39 public: | 40 public: |
| 40 // Takes ownership of the |transport_socket|, which must already be connected. | 41 // Takes ownership of the |transport_socket|, which must already be connected. |
| 41 // The given hostname will be compared with the name(s) in the server's | 42 // The given hostname will be compared with the name(s) in the server's |
| 42 // certificate during the SSL handshake. ssl_config specifies the SSL | 43 // certificate during the SSL handshake. ssl_config specifies the SSL |
| 43 // settings. | 44 // settings. |
| 44 SSLClientSocketNSS(ClientSocketHandle* transport_socket, | 45 SSLClientSocketNSS(ClientSocketHandle* transport_socket, |
| 45 const std::string& hostname, | 46 const HostPortPair& host_and_port, |
| 46 const SSLConfig& ssl_config, | 47 const SSLConfig& ssl_config, |
| 47 SSLHostInfo* ssl_host_info, | 48 SSLHostInfo* ssl_host_info, |
| 48 DnsRRResolver* dnsrr_resolver); | 49 DnsRRResolver* dnsrr_resolver); |
| 49 ~SSLClientSocketNSS(); | 50 ~SSLClientSocketNSS(); |
| 50 | 51 |
| 51 // SSLClientSocket methods: | 52 // SSLClientSocket methods: |
| 52 virtual void GetSSLInfo(SSLInfo* ssl_info); | 53 virtual void GetSSLInfo(SSLInfo* ssl_info); |
| 53 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); | 54 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); |
| 54 virtual NextProtoStatus GetNextProto(std::string* proto); | 55 virtual NextProtoStatus GetNextProto(std::string* proto); |
| 55 virtual void UseDNSSEC(DNSSECProvider* provider); | 56 virtual void UseDNSSEC(DNSSECProvider* provider); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // corked_ is true if we are currently suspending writes to the network. This | 152 // corked_ is true if we are currently suspending writes to the network. This |
| 152 // is named after the similar kernel flag, TCP_CORK. | 153 // is named after the similar kernel flag, TCP_CORK. |
| 153 bool corked_; | 154 bool corked_; |
| 154 // uncork_timer_ is used to limit the amount of time that we'll delay the | 155 // uncork_timer_ is used to limit the amount of time that we'll delay the |
| 155 // Finished message while waiting for a Write. | 156 // Finished message while waiting for a Write. |
| 156 base::OneShotTimer<SSLClientSocketNSS> uncork_timer_; | 157 base::OneShotTimer<SSLClientSocketNSS> uncork_timer_; |
| 157 scoped_refptr<IOBuffer> recv_buffer_; | 158 scoped_refptr<IOBuffer> recv_buffer_; |
| 158 | 159 |
| 159 CompletionCallbackImpl<SSLClientSocketNSS> handshake_io_callback_; | 160 CompletionCallbackImpl<SSLClientSocketNSS> handshake_io_callback_; |
| 160 scoped_ptr<ClientSocketHandle> transport_; | 161 scoped_ptr<ClientSocketHandle> transport_; |
| 161 std::string hostname_; | 162 HostPortPair host_and_port_; |
| 162 SSLConfig ssl_config_; | 163 SSLConfig ssl_config_; |
| 163 | 164 |
| 164 CompletionCallback* user_connect_callback_; | 165 CompletionCallback* user_connect_callback_; |
| 165 CompletionCallback* user_read_callback_; | 166 CompletionCallback* user_read_callback_; |
| 166 CompletionCallback* user_write_callback_; | 167 CompletionCallback* user_write_callback_; |
| 167 | 168 |
| 168 // Used by Read function. | 169 // Used by Read function. |
| 169 scoped_refptr<IOBuffer> user_read_buf_; | 170 scoped_refptr<IOBuffer> user_read_buf_; |
| 170 int user_read_buf_len_; | 171 int user_read_buf_len_; |
| 171 | 172 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 std::string predicted_npn_proto_; | 247 std::string predicted_npn_proto_; |
| 247 bool predicted_npn_proto_used_; | 248 bool predicted_npn_proto_used_; |
| 248 | 249 |
| 249 scoped_ptr<SSLHostInfo> ssl_host_info_; | 250 scoped_ptr<SSLHostInfo> ssl_host_info_; |
| 250 DnsRRResolver* const dnsrr_resolver_; | 251 DnsRRResolver* const dnsrr_resolver_; |
| 251 }; | 252 }; |
| 252 | 253 |
| 253 } // namespace net | 254 } // namespace net |
| 254 | 255 |
| 255 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ | 256 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ |
| OLD | NEW |