Chromium Code Reviews| 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 // This file is only included in ssl_client_socket_nss.cc and | 5 // This file is only included in ssl_client_socket_nss.cc and |
| 6 // ssl_server_socket_nss.cc to share common functions of NSS. | 6 // ssl_server_socket_nss.cc to share common functions of NSS. |
| 7 | 7 |
| 8 #ifndef NET_SOCKET_NSS_SSL_UTIL_H_ | 8 #ifndef NET_SOCKET_NSS_SSL_UTIL_H_ |
| 9 #define NET_SOCKET_NSS_SSL_UTIL_H_ | 9 #define NET_SOCKET_NSS_SSL_UTIL_H_ |
| 10 | 10 |
| 11 #include <prerror.h> | 11 #include <prerror.h> |
| 12 #include <prio.h> | 12 #include <prio.h> |
| 13 | 13 |
| 14 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
| 15 #include "net/base/net_log.h" | 15 #include "net/base/net_log.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 | 18 |
| 19 class BoundNetLog; | 19 class BoundNetLog; |
| 20 struct SSLConfig; | |
| 20 | 21 |
| 21 // Initalize NSS SSL library. | 22 // Initalize NSS SSL library. |
| 22 NET_EXPORT void EnsureNSSSSLInit(); | 23 NET_EXPORT void EnsureNSSSSLInit(); |
| 23 | 24 |
| 24 // Log a failed NSS funcion call. | 25 // Log a failed NSS funcion call. |
| 25 void LogFailedNSSFunction(const BoundNetLog& net_log, | 26 void LogFailedNSSFunction(const BoundNetLog& net_log, |
| 26 const char* function, | 27 const char* function, |
| 27 const char* param); | 28 const char* param); |
| 28 | 29 |
| 29 // Map network error code to NSS error code. | 30 // Map network error code to NSS error code. |
| 30 PRErrorCode MapErrorToNSS(int result); | 31 PRErrorCode MapErrorToNSS(int result); |
| 31 | 32 |
| 32 // GetNSSModelSocket returns either NULL, or an NSS socket that can be passed | 33 // GetNSSModelSocket returns either NULL, or an NSS socket that can be passed |
| 33 // to |SSL_ImportFD| in order to inherit some default options. | 34 // to |SSL_ImportFD| in order to inherit some default options. |
| 34 PRFileDesc* GetNSSModelSocket(); | 35 PRFileDesc* GetNSSModelSocket(); |
| 35 | 36 |
| 36 // Map NSS error code to network error code. | 37 // Map NSS error code to network error code. |
| 37 int MapNSSError(PRErrorCode err); | 38 int MapNSSError(PRErrorCode err); |
| 38 | 39 |
| 39 // Creates a NetLog callback for an SSL error. | 40 // Creates a NetLog callback for an SSL error. |
| 40 NetLog::ParametersCallback CreateNetLogSSLErrorCallback(int net_error, | 41 NetLog::ParametersCallback CreateNetLogSSLErrorCallback(int net_error, |
| 41 int ssl_lib_error); | 42 int ssl_lib_error); |
| 42 | 43 |
| 44 // Extracts various aspects of the connection status from the socket denoted | |
| 45 // by |nss_fd| and the |ssl_config| and updates the value at | |
| 46 // |ssl_connection_status| accordingly. | |
| 47 void UpdateSSLConnectionStatus(PRFileDesc* nss_fd, | |
|
Ryan Sleevi
2015/03/19 04:38:24
I'm generally uneasy with moving this into a commo
| |
| 48 const SSLConfig& ssl_config, | |
| 49 int* ssl_connection_status); | |
| 43 | 50 |
| 44 } // namespace net | 51 } // namespace net |
| 45 | 52 |
| 46 #endif // NET_SOCKET_NSS_SSL_UTIL_H_ | 53 #endif // NET_SOCKET_NSS_SSL_UTIL_H_ |
| OLD | NEW |