OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CERT_CERT_STATUS_FLAGS_H_ | 5 #ifndef NET_CERT_CERT_STATUS_FLAGS_H_ |
6 #define NET_CERT_CERT_STATUS_FLAGS_H_ | 6 #define NET_CERT_CERT_STATUS_FLAGS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
11 | 11 |
12 namespace net { | 12 namespace net { |
13 | 13 |
14 // Bitmask of status flags of a certificate, representing any errors, as well as | 14 // Bitmask of status flags of a certificate, representing any errors, as well as |
15 // other non-error status information such as whether the certificate is EV. | 15 // other non-error status information such as whether the certificate is EV. |
16 typedef uint32_t CertStatus; | 16 typedef uint32_t CertStatus; |
17 | 17 |
18 // NOTE: Because these names have appeared in bug reports, we preserve them as | 18 // NOTE: Because these names have appeared in bug reports, we preserve them as |
19 // MACRO_STYLE for continuity, instead of renaming them to kConstantStyle as | 19 // MACRO_STYLE for continuity, instead of renaming them to kConstantStyle as |
20 // befits most static consts. | 20 // befits most static consts. |
21 #define CERT_STATUS_FLAG(label, value) \ | 21 #define CERT_STATUS_FLAG(label, value) \ |
22 CertStatus static const CERT_STATUS_##label = value; | 22 CertStatus static const CERT_STATUS_##label = value; |
23 #include "net/cert/cert_status_flags_list.h" | 23 #include "net/cert/cert_status_flags_list.h" |
24 #undef CERT_STATUS_FLAG | 24 #undef CERT_STATUS_FLAG |
25 | 25 |
26 static const CertStatus CERT_STATUS_ALL_ERRORS = 0xFFFF; | 26 static const CertStatus CERT_STATUS_ALL_ERRORS = 0xFFFF; |
27 | 27 |
28 static const CertStatus CERT_STATUS_NON_ERROR_STATUSES = 0xFFFF << 16; | |
jww
2015/09/19 02:16:34
This is more something for rsleevi@ to address, bu
Ryan Sleevi
2015/09/19 12:45:38
It's not clear why this is needed at all.
Eugene But (OOO till 7-30)
2015/09/21 17:23:40
Yeah... removed...
| |
29 | |
28 // Returns true if the specified cert status has an error set. | 30 // Returns true if the specified cert status has an error set. |
29 static inline bool IsCertStatusError(CertStatus status) { | 31 static inline bool IsCertStatusError(CertStatus status) { |
30 return (CERT_STATUS_ALL_ERRORS & status) != 0; | 32 return (CERT_STATUS_ALL_ERRORS & status) != 0; |
31 } | 33 } |
32 | 34 |
33 // IsCertStatusMinorError returns true iff |cert_status| indicates a condition | 35 // IsCertStatusMinorError returns true iff |cert_status| indicates a condition |
34 // that should typically be ignored by automated requests. (i.e. a revocation | 36 // that should typically be ignored by automated requests. (i.e. a revocation |
35 // check failure.) | 37 // check failure.) |
36 NET_EXPORT bool IsCertStatusMinorError(CertStatus cert_status); | 38 NET_EXPORT bool IsCertStatusMinorError(CertStatus cert_status); |
37 | 39 |
38 // Maps a network error code to the equivalent certificate status flag. If | 40 // Maps a network error code to the equivalent certificate status flag. If |
39 // the error code is not a certificate error, it is mapped to 0. | 41 // the error code is not a certificate error, it is mapped to 0. |
40 NET_EXPORT CertStatus MapNetErrorToCertStatus(int error); | 42 NET_EXPORT CertStatus MapNetErrorToCertStatus(int error); |
41 | 43 |
42 // Maps the most serious certificate error in the certificate status flags | 44 // Maps the most serious certificate error in the certificate status flags |
43 // to the equivalent network error code. | 45 // to the equivalent network error code. |
44 NET_EXPORT int MapCertStatusToNetError(CertStatus cert_status); | 46 NET_EXPORT int MapCertStatusToNetError(CertStatus cert_status); |
45 | 47 |
46 } // namespace net | 48 } // namespace net |
47 | 49 |
48 #endif // NET_CERT_CERT_STATUS_FLAGS_H_ | 50 #endif // NET_CERT_CERT_STATUS_FLAGS_H_ |
OLD | NEW |