Chromium Code Reviews| 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..a01056a6cbcf84160bb65503201c5b9d1fd26ef5 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,32 @@ inline int SSLConnectionStatusToVersion(int connection_status) { |
| SSL_CONNECTION_VERSION_MASK; |
| } |
| +inline void SSLConnectionStatusSetCipherSuite(int cipher_suite, |
| + int* connection_status) { |
| + int tmp = *connection_status; |
|
wtc
2014/05/21 21:51:10
Nit: why do we need to use a tmp variable? Does th
wtc
2014/05/22 17:57:02
I'm still curious about the answer to this questio
willchan no longer on Chromium
2014/05/22 18:26:43
Oops, I missed this earlier. I've removed the tmp
|
| + // Clear out the old ciphersuite. |
| + tmp &= ~(SSL_CONNECTION_CIPHERSUITE_MASK << SSL_CONNECTION_CIPHERSUITE_SHIFT); |
| + // Set the new ciphersuite. |
| + tmp |= ((cipher_suite & SSL_CONNECTION_CIPHERSUITE_MASK) |
| + << SSL_CONNECTION_CIPHERSUITE_SHIFT); |
| + |
| + *connection_status = tmp; |
| +} |
| + |
| +inline void SSLConnectionStatusSetVersion(int version, int* connection_status) { |
| + DCHECK_GT(version, 0); |
| + DCHECK_LT(version, SSL_CONNECTION_VERSION_MAX); |
| + |
| + int tmp = *connection_status; |
| + // Clear out the old version. |
| + tmp &= ~(SSL_CONNECTION_VERSION_MASK << SSL_CONNECTION_VERSION_SHIFT); |
| + // Set the new version. |
| + tmp |= |
| + ((version & SSL_CONNECTION_VERSION_MASK) << SSL_CONNECTION_VERSION_SHIFT); |
| + |
| + *connection_status = tmp; |
| +} |
| + |
| } // namespace net |
| #endif // NET_SSL_SSL_CONNECTION_STATUS_FLAGS_H_ |