1 // Copyright 2012 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef NET_CERT_CERT_STATUS_FLAGS_H_ 6 #define NET_CERT_CERT_STATUS_FLAGS_H_ 7 8 #include <stdint.h> 9 10 #include "net/base/net_export.h" 11 12 namespace net { 13 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. 16 typedef uint32_t CertStatus; 17 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 20 // befits most static consts. 21 #define CERT_STATUS_FLAG(label, value) \ 22 CertStatus static const CERT_STATUS_##label = value; 23 #include "net/cert/cert_status_flags_list.h" 24 #undef CERT_STATUS_FLAG 25 26 static const CertStatus CERT_STATUS_ALL_ERRORS = 0xFF00FFFF; 27 28 // Returns true if the specified cert status has an error set. IsCertStatusError(CertStatus status)29inline bool IsCertStatusError(CertStatus status) { 30 return (CERT_STATUS_ALL_ERRORS & status) != 0; 31 } 32 33 // Maps the most serious certificate error in the certificate status flags 34 // to the equivalent network error code. 35 NET_EXPORT int MapCertStatusToNetError(CertStatus cert_status); 36 37 } // namespace net 38 39 #endif // NET_CERT_CERT_STATUS_FLAGS_H_ 40