| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
| 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "net/base/completion_callback.h" | 11 #include "net/base/completion_callback.h" |
| 12 #include "net/base/load_flags.h" | 12 #include "net/base/load_flags.h" |
| 13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 14 #include "net/socket/ssl_socket.h" | 14 #include "net/socket/ssl_socket.h" |
| 15 #include "net/socket/stream_socket.h" | 15 #include "net/socket/stream_socket.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 | 18 |
| 19 class CertVerifier; | 19 class CertVerifier; |
| 20 class DnsCertProvenanceChecker; | 20 class DnsCertProvenanceChecker; |
| 21 class DnsRRResolver; | |
| 22 class OriginBoundCertService; | 21 class OriginBoundCertService; |
| 23 class SSLCertRequestInfo; | 22 class SSLCertRequestInfo; |
| 24 class SSLHostInfo; | 23 class SSLHostInfo; |
| 25 class SSLHostInfoFactory; | 24 class SSLHostInfoFactory; |
| 26 class SSLInfo; | 25 class SSLInfo; |
| 27 struct RRResponse; | 26 class TransportSecurityState; |
| 28 | |
| 29 // DNSSECProvider is an interface to an object that can return DNSSEC data. | |
| 30 class DNSSECProvider { | |
| 31 public: | |
| 32 // GetDNSSECRecords will either: | |
| 33 // 1) set |*out| to NULL and return OK. | |
| 34 // 2) set |*out| to a pointer, which is owned by this object, and return OK. | |
| 35 // 3) return IO_PENDING and call |callback| on the current MessageLoop at | |
| 36 // some point in the future. Once the callback has been made, this | |
| 37 // function will return OK if called again. | |
| 38 virtual int GetDNSSECRecords(RRResponse** out, | |
| 39 OldCompletionCallback* callback) = 0; | |
| 40 | |
| 41 private: | |
| 42 ~DNSSECProvider() {} | |
| 43 }; | |
| 44 | 27 |
| 45 // This struct groups together several fields which are used by various | 28 // This struct groups together several fields which are used by various |
| 46 // classes related to SSLClientSocket. | 29 // classes related to SSLClientSocket. |
| 47 struct SSLClientSocketContext { | 30 struct SSLClientSocketContext { |
| 48 SSLClientSocketContext() | 31 SSLClientSocketContext() |
| 49 : cert_verifier(NULL), | 32 : cert_verifier(NULL), |
| 50 origin_bound_cert_service(NULL), | 33 origin_bound_cert_service(NULL), |
| 51 dnsrr_resolver(NULL), | |
| 52 dns_cert_checker(NULL), | 34 dns_cert_checker(NULL), |
| 53 ssl_host_info_factory(NULL) {} | 35 ssl_host_info_factory(NULL) {} |
| 54 | 36 |
| 55 SSLClientSocketContext(CertVerifier* cert_verifier_arg, | 37 SSLClientSocketContext(CertVerifier* cert_verifier_arg, |
| 56 OriginBoundCertService* origin_bound_cert_service_arg, | 38 OriginBoundCertService* origin_bound_cert_service_arg, |
| 57 DnsRRResolver* dnsrr_resolver_arg, | 39 TransportSecurityState* transport_security_state_arg, |
| 58 DnsCertProvenanceChecker* dns_cert_checker_arg, | 40 DnsCertProvenanceChecker* dns_cert_checker_arg, |
| 59 SSLHostInfoFactory* ssl_host_info_factory_arg) | 41 SSLHostInfoFactory* ssl_host_info_factory_arg) |
| 60 : cert_verifier(cert_verifier_arg), | 42 : cert_verifier(cert_verifier_arg), |
| 61 origin_bound_cert_service(origin_bound_cert_service_arg), | 43 origin_bound_cert_service(origin_bound_cert_service_arg), |
| 62 dnsrr_resolver(dnsrr_resolver_arg), | 44 transport_security_state(transport_security_state_arg), |
| 63 dns_cert_checker(dns_cert_checker_arg), | 45 dns_cert_checker(dns_cert_checker_arg), |
| 64 ssl_host_info_factory(ssl_host_info_factory_arg) {} | 46 ssl_host_info_factory(ssl_host_info_factory_arg) {} |
| 65 | 47 |
| 66 CertVerifier* cert_verifier; | 48 CertVerifier* cert_verifier; |
| 67 OriginBoundCertService* origin_bound_cert_service; | 49 OriginBoundCertService* origin_bound_cert_service; |
| 68 DnsRRResolver* dnsrr_resolver; | 50 TransportSecurityState* transport_security_state; |
| 69 DnsCertProvenanceChecker* dns_cert_checker; | 51 DnsCertProvenanceChecker* dns_cert_checker; |
| 70 SSLHostInfoFactory* ssl_host_info_factory; | 52 SSLHostInfoFactory* ssl_host_info_factory; |
| 71 }; | 53 }; |
| 72 | 54 |
| 73 // A client socket that uses SSL as the transport layer. | 55 // A client socket that uses SSL as the transport layer. |
| 74 // | 56 // |
| 75 // NOTE: The SSL handshake occurs within the Connect method after a TCP | 57 // NOTE: The SSL handshake occurs within the Connect method after a TCP |
| 76 // connection is established. If a SSL error occurs during the handshake, | 58 // connection is established. If a SSL error occurs during the handshake, |
| 77 // Connect will fail. | 59 // Connect will fail. |
| 78 // | 60 // |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // Can be used with the second argument(|server_protos|) of |GetNextProto| to | 115 // Can be used with the second argument(|server_protos|) of |GetNextProto| to |
| 134 // construct a comma separated string of server advertised protocols. | 116 // construct a comma separated string of server advertised protocols. |
| 135 static std::string ServerProtosToString(const std::string& server_protos); | 117 static std::string ServerProtosToString(const std::string& server_protos); |
| 136 | 118 |
| 137 static bool IgnoreCertError(int error, int load_flags); | 119 static bool IgnoreCertError(int error, int load_flags); |
| 138 | 120 |
| 139 virtual bool was_npn_negotiated() const; | 121 virtual bool was_npn_negotiated() const; |
| 140 | 122 |
| 141 virtual bool set_was_npn_negotiated(bool negotiated); | 123 virtual bool set_was_npn_negotiated(bool negotiated); |
| 142 | 124 |
| 143 virtual void UseDNSSEC(DNSSECProvider*) { } | |
| 144 | |
| 145 virtual bool was_spdy_negotiated() const; | 125 virtual bool was_spdy_negotiated() const; |
| 146 | 126 |
| 147 virtual bool set_was_spdy_negotiated(bool negotiated); | 127 virtual bool set_was_spdy_negotiated(bool negotiated); |
| 148 | 128 |
| 149 private: | 129 private: |
| 150 // True if NPN was responded to, independent of selecting SPDY or HTTP. | 130 // True if NPN was responded to, independent of selecting SPDY or HTTP. |
| 151 bool was_npn_negotiated_; | 131 bool was_npn_negotiated_; |
| 152 // True if NPN successfully negotiated SPDY. | 132 // True if NPN successfully negotiated SPDY. |
| 153 bool was_spdy_negotiated_; | 133 bool was_spdy_negotiated_; |
| 154 }; | 134 }; |
| 155 | 135 |
| 156 } // namespace net | 136 } // namespace net |
| 157 | 137 |
| 158 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 138 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
| OLD | NEW |