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

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

Issue 3522004: FBTF: Move ctors/dtors into implementation files. Adds ctors/dtors to non-POD structs. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 2 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_CLIENT_AUTH_CACHE_H_ 5 #ifndef NET_BASE_SSL_CLIENT_AUTH_CACHE_H_
6 #define NET_BASE_SSL_CLIENT_AUTH_CACHE_H_ 6 #define NET_BASE_SSL_CLIENT_AUTH_CACHE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <map> 10 #include <map>
11 11
12 #include "base/ref_counted.h" 12 #include "base/ref_counted.h"
13 #include "net/base/x509_certificate.h" 13 #include "net/base/x509_certificate.h"
14 14
15 namespace net { 15 namespace net {
16 16
17 // The SSLClientAuthCache class is a simple cache structure to store SSL 17 // The SSLClientAuthCache class is a simple cache structure to store SSL
18 // client certificates. Provides lookup, insertion, and deletion of entries. 18 // client certificates. Provides lookup, insertion, and deletion of entries.
19 // The parameter for doing lookups, insertions, and deletions is the server's 19 // The parameter for doing lookups, insertions, and deletions is the server's
20 // host and port. 20 // host and port.
21 // 21 //
22 // TODO(wtc): This class is based on FtpAuthCache. We can extract the common 22 // TODO(wtc): This class is based on FtpAuthCache. We can extract the common
23 // code to a template class. 23 // code to a template class.
24 class SSLClientAuthCache { 24 class SSLClientAuthCache {
25 public: 25 public:
26 SSLClientAuthCache() {} 26 SSLClientAuthCache();
27 ~SSLClientAuthCache() {} 27 ~SSLClientAuthCache();
28 28
29 // Check if we have a client certificate for SSL server at |server|. 29 // Check if we have a client certificate for SSL server at |server|.
30 // Returns the client certificate (if found) or NULL (if not found). 30 // Returns the client certificate (if found) or NULL (if not found).
31 X509Certificate* Lookup(const std::string& server); 31 X509Certificate* Lookup(const std::string& server);
32 32
33 // Add a client certificate for |server| to the cache. If there is already 33 // Add a client certificate for |server| to the cache. If there is already
34 // a client certificate for |server|, it will be overwritten. Both parameters 34 // a client certificate for |server|, it will be overwritten. Both parameters
35 // are IN only. 35 // are IN only.
36 void Add(const std::string& server, X509Certificate* client_cert); 36 void Add(const std::string& server, X509Certificate* client_cert);
37 37
38 // Remove the client certificate for |server| from the cache, if one exists. 38 // Remove the client certificate for |server| from the cache, if one exists.
39 void Remove(const std::string& server); 39 void Remove(const std::string& server);
40 40
41 private: 41 private:
42 typedef std::string AuthCacheKey; 42 typedef std::string AuthCacheKey;
43 typedef scoped_refptr<X509Certificate> AuthCacheValue; 43 typedef scoped_refptr<X509Certificate> AuthCacheValue;
44 typedef std::map<AuthCacheKey, AuthCacheValue> AuthCacheMap; 44 typedef std::map<AuthCacheKey, AuthCacheValue> AuthCacheMap;
45 45
46 // internal representation of cache, an STL map. 46 // internal representation of cache, an STL map.
47 AuthCacheMap cache_; 47 AuthCacheMap cache_;
48 }; 48 };
49 49
50 } // namespace net 50 } // namespace net
51 51
52 #endif // NET_BASE_SSL_CLIENT_AUTH_CACHE_H_ 52 #endif // NET_BASE_SSL_CLIENT_AUTH_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698