Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: net/base/ssl_config_service.h

Issue 6969077: net: Add NET_API to net/base (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_BASE_SSL_CONFIG_SERVICE_H_ 5 #ifndef NET_BASE_SSL_CONFIG_SERVICE_H_
6 #define NET_BASE_SSL_CONFIG_SERVICE_H_ 6 #define NET_BASE_SSL_CONFIG_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "net/base/net_api.h"
14 #include "net/base/x509_certificate.h" 15 #include "net/base/x509_certificate.h"
15 16
16 namespace net { 17 namespace net {
17 18
18 // A collection of SSL-related configuration settings. 19 // A collection of SSL-related configuration settings.
19 struct SSLConfig { 20 struct NET_API SSLConfig {
20 // Default to revocation checking. 21 // Default to revocation checking.
21 // Default to SSL 3.0 on and TLS 1.0 on. 22 // Default to SSL 3.0 on and TLS 1.0 on.
22 SSLConfig(); 23 SSLConfig();
23 ~SSLConfig(); 24 ~SSLConfig();
24 25
25 // Returns true if |cert| is one of the certs in |allowed_bad_certs|. 26 // Returns true if |cert| is one of the certs in |allowed_bad_certs|.
26 // The expected cert status is written to |cert_status|. |*cert_status| can 27 // The expected cert status is written to |cert_status|. |*cert_status| can
27 // be NULL if user doesn't care about the cert status. 28 // be NULL if user doesn't care about the cert status.
28 bool IsAllowedBadCert(X509Certificate* cert, int* cert_status) const; 29 bool IsAllowedBadCert(X509Certificate* cert, int* cert_status) const;
29 30
(...skipping 25 matching lines...) Expand all
55 // disable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002. 56 // disable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002.
56 // 57 //
57 // TODO(rsleevi): Not implemented when using Schannel. 58 // TODO(rsleevi): Not implemented when using Schannel.
58 std::vector<uint16> disabled_cipher_suites; 59 std::vector<uint16> disabled_cipher_suites;
59 60
60 bool false_start_enabled; // True if we'll use TLS False Start. 61 bool false_start_enabled; // True if we'll use TLS False Start.
61 62
62 // TODO(wtc): move the following members to a new SSLParams structure. They 63 // TODO(wtc): move the following members to a new SSLParams structure. They
63 // are not SSL configuration settings. 64 // are not SSL configuration settings.
64 65
65 struct CertAndStatus { 66 struct NET_API CertAndStatus {
66 CertAndStatus(); 67 CertAndStatus();
67 ~CertAndStatus(); 68 ~CertAndStatus();
68 69
69 scoped_refptr<X509Certificate> cert; 70 scoped_refptr<X509Certificate> cert;
70 int cert_status; 71 int cert_status;
71 }; 72 };
72 73
73 // Add any known-bad SSL certificate (with its cert status) to 74 // Add any known-bad SSL certificate (with its cert status) to
74 // |allowed_bad_certs| that should not trigger an ERR_CERT_* error when 75 // |allowed_bad_certs| that should not trigger an ERR_CERT_* error when
75 // calling SSLClientSocket::Connect. This would normally be done in 76 // calling SSLClientSocket::Connect. This would normally be done in
(...skipping 16 matching lines...) Expand all
92 // first protocol in this list will be requested by the client. 93 // first protocol in this list will be requested by the client.
93 std::string next_protos; 94 std::string next_protos;
94 95
95 scoped_refptr<X509Certificate> client_cert; 96 scoped_refptr<X509Certificate> client_cert;
96 }; 97 };
97 98
98 // The interface for retrieving the SSL configuration. This interface 99 // The interface for retrieving the SSL configuration. This interface
99 // does not cover setting the SSL configuration, as on some systems, the 100 // does not cover setting the SSL configuration, as on some systems, the
100 // SSLConfigService objects may not have direct access to the configuration, or 101 // SSLConfigService objects may not have direct access to the configuration, or
101 // live longer than the configuration preferences. 102 // live longer than the configuration preferences.
102 class SSLConfigService : public base::RefCountedThreadSafe<SSLConfigService> { 103 class NET_API SSLConfigService
104 : public base::RefCountedThreadSafe<SSLConfigService> {
103 public: 105 public:
104 // Observer is notified when SSL config settings have changed. 106 // Observer is notified when SSL config settings have changed.
105 class Observer { 107 class NET_API Observer {
106 public: 108 public:
107 // Notify observers if SSL settings have changed. We don't check all of the 109 // Notify observers if SSL settings have changed. We don't check all of the
108 // data in SSLConfig, just those that qualify as a user config change. 110 // data in SSLConfig, just those that qualify as a user config change.
109 // The following settings are considered user changes: 111 // The following settings are considered user changes:
110 // rev_checking_enabled 112 // rev_checking_enabled
111 // ssl3_enabled 113 // ssl3_enabled
112 // tls1_enabled 114 // tls1_enabled
113 virtual void OnSSLConfigChanged() = 0; 115 virtual void OnSSLConfigChanged() = 0;
114 116
115 protected: 117 protected:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 void ProcessConfigUpdate(const SSLConfig& orig_config, 169 void ProcessConfigUpdate(const SSLConfig& orig_config,
168 const SSLConfig& new_config); 170 const SSLConfig& new_config);
169 171
170 private: 172 private:
171 ObserverList<Observer> observer_list_; 173 ObserverList<Observer> observer_list_;
172 }; 174 };
173 175
174 } // namespace net 176 } // namespace net
175 177
176 #endif // NET_BASE_SSL_CONFIG_SERVICE_H_ 178 #endif // NET_BASE_SSL_CONFIG_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698