| 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 hostname specified in |host_and_port| will be compared with the name(s) |
| 42 // certificate during the SSL handshake. ssl_config specifies the SSL | 43 // in the server's certificate during the SSL handshake. If SSL client |
| 43 // settings. | 44 // authentication is requested, the host_and_port field of SSLCertRequestInfo |
| 45 // will be populated with |host_and_port|. |ssl_config| specifies |
| 46 // the SSL settings. |
| 44 SSLClientSocketNSS(ClientSocketHandle* transport_socket, | 47 SSLClientSocketNSS(ClientSocketHandle* transport_socket, |
| 45 const std::string& hostname, | 48 const HostPortPair& host_and_port, |
| 46 const SSLConfig& ssl_config, | 49 const SSLConfig& ssl_config, |
| 47 SSLHostInfo* ssl_host_info, | 50 SSLHostInfo* ssl_host_info, |
| 48 DnsRRResolver* dnsrr_resolver); | 51 DnsRRResolver* dnsrr_resolver); |
| 49 ~SSLClientSocketNSS(); | 52 ~SSLClientSocketNSS(); |
| 50 | 53 |
| 51 // SSLClientSocket methods: | 54 // SSLClientSocket methods: |
| 52 virtual void GetSSLInfo(SSLInfo* ssl_info); | 55 virtual void GetSSLInfo(SSLInfo* ssl_info); |
| 53 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); | 56 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); |
| 54 virtual NextProtoStatus GetNextProto(std::string* proto); | 57 virtual NextProtoStatus GetNextProto(std::string* proto); |
| 55 virtual void UseDNSSEC(DNSSECProvider* provider); | 58 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 | 154 // corked_ is true if we are currently suspending writes to the network. This |
| 152 // is named after the similar kernel flag, TCP_CORK. | 155 // is named after the similar kernel flag, TCP_CORK. |
| 153 bool corked_; | 156 bool corked_; |
| 154 // uncork_timer_ is used to limit the amount of time that we'll delay the | 157 // uncork_timer_ is used to limit the amount of time that we'll delay the |
| 155 // Finished message while waiting for a Write. | 158 // Finished message while waiting for a Write. |
| 156 base::OneShotTimer<SSLClientSocketNSS> uncork_timer_; | 159 base::OneShotTimer<SSLClientSocketNSS> uncork_timer_; |
| 157 scoped_refptr<IOBuffer> recv_buffer_; | 160 scoped_refptr<IOBuffer> recv_buffer_; |
| 158 | 161 |
| 159 CompletionCallbackImpl<SSLClientSocketNSS> handshake_io_callback_; | 162 CompletionCallbackImpl<SSLClientSocketNSS> handshake_io_callback_; |
| 160 scoped_ptr<ClientSocketHandle> transport_; | 163 scoped_ptr<ClientSocketHandle> transport_; |
| 161 std::string hostname_; | 164 HostPortPair host_and_port_; |
| 162 SSLConfig ssl_config_; | 165 SSLConfig ssl_config_; |
| 163 | 166 |
| 164 CompletionCallback* user_connect_callback_; | 167 CompletionCallback* user_connect_callback_; |
| 165 CompletionCallback* user_read_callback_; | 168 CompletionCallback* user_read_callback_; |
| 166 CompletionCallback* user_write_callback_; | 169 CompletionCallback* user_write_callback_; |
| 167 | 170 |
| 168 // Used by Read function. | 171 // Used by Read function. |
| 169 scoped_refptr<IOBuffer> user_read_buf_; | 172 scoped_refptr<IOBuffer> user_read_buf_; |
| 170 int user_read_buf_len_; | 173 int user_read_buf_len_; |
| 171 | 174 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 std::string predicted_npn_proto_; | 249 std::string predicted_npn_proto_; |
| 247 bool predicted_npn_proto_used_; | 250 bool predicted_npn_proto_used_; |
| 248 | 251 |
| 249 scoped_ptr<SSLHostInfo> ssl_host_info_; | 252 scoped_ptr<SSLHostInfo> ssl_host_info_; |
| 250 DnsRRResolver* const dnsrr_resolver_; | 253 DnsRRResolver* const dnsrr_resolver_; |
| 251 }; | 254 }; |
| 252 | 255 |
| 253 } // namespace net | 256 } // namespace net |
| 254 | 257 |
| 255 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ | 258 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ |
| OLD | NEW |