Index: net/ssl/ssl_connection_status_flags.h |
diff --git a/net/ssl/ssl_connection_status_flags.h b/net/ssl/ssl_connection_status_flags.h |
index 05757558ed8e9b2acdd8c686359e30cbff8201b0..faae306a5055b69c61db1edd7fb80daa982debb3 100644 |
--- a/net/ssl/ssl_connection_status_flags.h |
+++ b/net/ssl/ssl_connection_status_flags.h |
@@ -5,6 +5,9 @@ |
#ifndef NET_SSL_SSL_CONNECTION_STATUS_FLAGS_H_ |
#define NET_SSL_SSL_CONNECTION_STATUS_FLAGS_H_ |
+#include "base/logging.h" |
+#include "base/macros.h" |
+ |
namespace net { |
// Status flags for SSLInfo::connection_status. |
@@ -60,6 +63,28 @@ inline int SSLConnectionStatusToVersion(int connection_status) { |
SSL_CONNECTION_VERSION_MASK; |
} |
+inline void SSLConnectionStatusSetCipherSuite(int cipher_suite, |
+ int* connection_status) { |
+ // Clear out the old ciphersuite. |
+ *connection_status &= |
+ ~(SSL_CONNECTION_CIPHERSUITE_MASK << SSL_CONNECTION_CIPHERSUITE_SHIFT); |
+ // Set the new ciphersuite. |
+ *connection_status |= ((cipher_suite & SSL_CONNECTION_CIPHERSUITE_MASK) |
+ << SSL_CONNECTION_CIPHERSUITE_SHIFT); |
+} |
+ |
+inline void SSLConnectionStatusSetVersion(int version, int* connection_status) { |
+ DCHECK_GT(version, 0); |
+ DCHECK_LT(version, SSL_CONNECTION_VERSION_MAX); |
+ |
+ // Clear out the old version. |
+ *connection_status &= |
+ ~(SSL_CONNECTION_VERSION_MASK << SSL_CONNECTION_VERSION_SHIFT); |
+ // Set the new version. |
+ *connection_status |= |
+ ((version & SSL_CONNECTION_VERSION_MASK) << SSL_CONNECTION_VERSION_SHIFT); |
+} |
+ |
} // namespace net |
#endif // NET_SSL_SSL_CONNECTION_STATUS_FLAGS_H_ |