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_HOST_INFO_H_ | 5 #ifndef NET_SOCKET_SSL_HOST_INFO_H_ |
6 #define NET_SOCKET_SSL_HOST_INFO_H_ | 6 #define NET_SOCKET_SSL_HOST_INFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "net/base/cert_verifier.h" | 15 #include "net/base/cert_verifier.h" |
16 #include "net/base/cert_verify_result.h" | 16 #include "net/base/cert_verify_result.h" |
17 #include "net/base/completion_callback.h" | 17 #include "net/base/completion_callback.h" |
18 #include "net/base/dnsrr_resolver.h" | |
19 #include "net/base/net_export.h" | 18 #include "net/base/net_export.h" |
20 #include "net/socket/ssl_client_socket.h" | 19 #include "net/socket/ssl_client_socket.h" |
21 | 20 |
22 namespace net { | 21 namespace net { |
23 | 22 |
24 class CRLSet; | 23 class CRLSet; |
25 class X509Certificate; | 24 class X509Certificate; |
26 struct SSLConfig; | 25 struct SSLConfig; |
27 | 26 |
28 // SSLHostInfo is an interface for fetching information about an SSL server. | 27 // SSLHostInfo is an interface for fetching information about an SSL server. |
(...skipping 24 matching lines...) Expand all Loading... |
53 // but, obviously, a callback will never be made. | 52 // but, obviously, a callback will never be made. |
54 virtual int WaitForDataReady(const CompletionCallback& callback) = 0; | 53 virtual int WaitForDataReady(const CompletionCallback& callback) = 0; |
55 | 54 |
56 // Persist allows for the host information to be updated for future users. | 55 // Persist allows for the host information to be updated for future users. |
57 // This is a fire and forget operation: the caller may drop its reference | 56 // This is a fire and forget operation: the caller may drop its reference |
58 // from this object and the store operation will still complete. This can | 57 // from this object and the store operation will still complete. This can |
59 // only be called once WaitForDataReady has returned OK or called its | 58 // only be called once WaitForDataReady has returned OK or called its |
60 // callback. | 59 // callback. |
61 virtual void Persist() = 0; | 60 virtual void Persist() = 0; |
62 | 61 |
63 // StartDnsLookup triggers a DNS lookup for the host. | |
64 void StartDnsLookup(DnsRRResolver* dnsrr_resolver); | |
65 | |
66 struct State { | 62 struct State { |
67 State(); | 63 State(); |
68 ~State(); | 64 ~State(); |
69 | 65 |
70 void Clear(); | 66 void Clear(); |
71 | 67 |
72 // certs is a vector of DER encoded X.509 certificates, as the server | 68 // certs is a vector of DER encoded X.509 certificates, as the server |
73 // returned them and in the same order. | 69 // returned them and in the same order. |
74 std::vector<std::string> certs; | 70 std::vector<std::string> certs; |
75 | 71 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // These three members are taken from the SSLConfig. | 121 // These three members are taken from the SSLConfig. |
126 bool rev_checking_enabled_; | 122 bool rev_checking_enabled_; |
127 bool verify_ev_cert_; | 123 bool verify_ev_cert_; |
128 scoped_refptr<CRLSet> crl_set_; | 124 scoped_refptr<CRLSet> crl_set_; |
129 base::TimeTicks verification_start_time_; | 125 base::TimeTicks verification_start_time_; |
130 base::TimeTicks verification_end_time_; | 126 base::TimeTicks verification_end_time_; |
131 CertVerifyResult cert_verify_result_; | 127 CertVerifyResult cert_verify_result_; |
132 SingleRequestCertVerifier verifier_; | 128 SingleRequestCertVerifier verifier_; |
133 scoped_refptr<X509Certificate> cert_; | 129 scoped_refptr<X509Certificate> cert_; |
134 base::WeakPtrFactory<SSLHostInfo> weak_factory_; | 130 base::WeakPtrFactory<SSLHostInfo> weak_factory_; |
135 | |
136 DnsRRResolver* dnsrr_resolver_; | |
137 OldCompletionCallback* dns_callback_; | |
138 DnsRRResolver::Handle dns_handle_; | |
139 RRResponse dns_response_; | |
140 base::TimeTicks dns_lookup_start_time_; | |
141 base::TimeTicks cert_verification_finished_time_; | 131 base::TimeTicks cert_verification_finished_time_; |
142 }; | 132 }; |
143 | 133 |
144 class SSLHostInfoFactory { | 134 class SSLHostInfoFactory { |
145 public: | 135 public: |
146 virtual ~SSLHostInfoFactory(); | 136 virtual ~SSLHostInfoFactory(); |
147 | 137 |
148 // GetForHost returns a fresh, allocated SSLHostInfo for the given hostname | 138 // GetForHost returns a fresh, allocated SSLHostInfo for the given hostname |
149 // or NULL on failure. | 139 // or NULL on failure. |
150 virtual SSLHostInfo* GetForHost(const std::string& hostname, | 140 virtual SSLHostInfo* GetForHost(const std::string& hostname, |
151 const SSLConfig& ssl_config) = 0; | 141 const SSLConfig& ssl_config) = 0; |
152 }; | 142 }; |
153 | 143 |
154 } // namespace net | 144 } // namespace net |
155 | 145 |
156 #endif // NET_SOCKET_SSL_HOST_INFO_H_ | 146 #endif // NET_SOCKET_SSL_HOST_INFO_H_ |
OLD | NEW |