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_SSL_SSL_CONNECTION_STATUS_FLAGS_H_ | 5 #ifndef NET_SSL_SSL_CONNECTION_STATUS_FLAGS_H_ |
6 #define NET_SSL_SSL_CONNECTION_STATUS_FLAGS_H_ | 6 #define NET_SSL_SSL_CONNECTION_STATUS_FLAGS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 // NOTE: the SSL version enum constants must be between 0 and | 41 // NOTE: the SSL version enum constants must be between 0 and |
42 // SSL_CONNECTION_VERSION_MASK, inclusive. These values are persisted to disk | 42 // SSL_CONNECTION_VERSION_MASK, inclusive. These values are persisted to disk |
43 // and used in UMA, so they must remain stable. | 43 // and used in UMA, so they must remain stable. |
44 enum { | 44 enum { |
45 SSL_CONNECTION_VERSION_UNKNOWN = 0, // Unknown SSL version. | 45 SSL_CONNECTION_VERSION_UNKNOWN = 0, // Unknown SSL version. |
46 SSL_CONNECTION_VERSION_SSL2 = 1, | 46 SSL_CONNECTION_VERSION_SSL2 = 1, |
47 SSL_CONNECTION_VERSION_SSL3 = 2, | 47 SSL_CONNECTION_VERSION_SSL3 = 2, |
48 SSL_CONNECTION_VERSION_TLS1 = 3, | 48 SSL_CONNECTION_VERSION_TLS1 = 3, |
49 SSL_CONNECTION_VERSION_TLS1_1 = 4, | 49 SSL_CONNECTION_VERSION_TLS1_1 = 4, |
50 SSL_CONNECTION_VERSION_TLS1_2 = 5, | 50 SSL_CONNECTION_VERSION_TLS1_2 = 5, |
51 // Reserve 6 for TLS 1.3. | 51 SSL_CONNECTION_VERSION_TLS1_3 = 6, |
52 SSL_CONNECTION_VERSION_QUIC = 7, | 52 SSL_CONNECTION_VERSION_QUIC = 7, |
53 SSL_CONNECTION_VERSION_MAX, | 53 SSL_CONNECTION_VERSION_MAX, |
54 }; | 54 }; |
55 static_assert(SSL_CONNECTION_VERSION_MAX - 1 <= SSL_CONNECTION_VERSION_MASK, | 55 static_assert(SSL_CONNECTION_VERSION_MAX - 1 <= SSL_CONNECTION_VERSION_MASK, |
56 "SSL_CONNECTION_VERSION_MASK too small"); | 56 "SSL_CONNECTION_VERSION_MASK too small"); |
57 | 57 |
58 inline uint16_t SSLConnectionStatusToCipherSuite(int connection_status) { | 58 inline uint16_t SSLConnectionStatusToCipherSuite(int connection_status) { |
59 return static_cast<uint16_t>(connection_status); | 59 return static_cast<uint16_t>(connection_status); |
60 } | 60 } |
61 | 61 |
(...skipping 18 matching lines...) Expand all Loading... |
80 *connection_status &= | 80 *connection_status &= |
81 ~(SSL_CONNECTION_VERSION_MASK << SSL_CONNECTION_VERSION_SHIFT); | 81 ~(SSL_CONNECTION_VERSION_MASK << SSL_CONNECTION_VERSION_SHIFT); |
82 // Set the new version. | 82 // Set the new version. |
83 *connection_status |= | 83 *connection_status |= |
84 ((version & SSL_CONNECTION_VERSION_MASK) << SSL_CONNECTION_VERSION_SHIFT); | 84 ((version & SSL_CONNECTION_VERSION_MASK) << SSL_CONNECTION_VERSION_SHIFT); |
85 } | 85 } |
86 | 86 |
87 } // namespace net | 87 } // namespace net |
88 | 88 |
89 #endif // NET_SSL_SSL_CONNECTION_STATUS_FLAGS_H_ | 89 #endif // NET_SSL_SSL_CONNECTION_STATUS_FLAGS_H_ |
OLD | NEW |