| 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_SOCKET_SSL_SERVER_SOCKET_H_ | 5 #ifndef NET_SOCKET_SSL_SERVER_SOCKET_H_ |
| 6 #define NET_SOCKET_SSL_SERVER_SOCKET_H_ | 6 #define NET_SOCKET_SSL_SERVER_SOCKET_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include <memory> |
| 9 |
| 9 #include "net/base/completion_callback.h" | 10 #include "net/base/completion_callback.h" |
| 10 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
| 11 #include "net/socket/ssl_socket.h" | 12 #include "net/socket/ssl_socket.h" |
| 12 #include "net/socket/stream_socket.h" | 13 #include "net/socket/stream_socket.h" |
| 13 | 14 |
| 14 namespace crypto { | 15 namespace crypto { |
| 15 class RSAPrivateKey; | 16 class RSAPrivateKey; |
| 16 } // namespace crypto | 17 } // namespace crypto |
| 17 | 18 |
| 18 namespace net { | 19 namespace net { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 34 class SSLServerContext { | 35 class SSLServerContext { |
| 35 public: | 36 public: |
| 36 virtual ~SSLServerContext(){}; | 37 virtual ~SSLServerContext(){}; |
| 37 | 38 |
| 38 // Creates an SSL server socket over an already-connected transport socket. | 39 // Creates an SSL server socket over an already-connected transport socket. |
| 39 // The caller must ensure the returned socket does not outlive the server | 40 // The caller must ensure the returned socket does not outlive the server |
| 40 // context. | 41 // context. |
| 41 // | 42 // |
| 42 // The caller starts the SSL server handshake by calling Handshake on the | 43 // The caller starts the SSL server handshake by calling Handshake on the |
| 43 // returned socket. | 44 // returned socket. |
| 44 virtual scoped_ptr<SSLServerSocket> CreateSSLServerSocket( | 45 virtual std::unique_ptr<SSLServerSocket> CreateSSLServerSocket( |
| 45 scoped_ptr<StreamSocket> socket) = 0; | 46 std::unique_ptr<StreamSocket> socket) = 0; |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 // Configures the underlying SSL library for the use of SSL server sockets. | 49 // Configures the underlying SSL library for the use of SSL server sockets. |
| 49 // | 50 // |
| 50 // Due to the requirements of the underlying libraries, this should be called | 51 // Due to the requirements of the underlying libraries, this should be called |
| 51 // early in process initialization, before any SSL socket, client or server, | 52 // early in process initialization, before any SSL socket, client or server, |
| 52 // has been used. | 53 // has been used. |
| 53 // | 54 // |
| 54 // Note: If a process does not use SSL server sockets, this call may be | 55 // Note: If a process does not use SSL server sockets, this call may be |
| 55 // omitted. | 56 // omitted. |
| 56 NET_EXPORT void EnableSSLServerSockets(); | 57 NET_EXPORT void EnableSSLServerSockets(); |
| 57 | 58 |
| 58 // Creates an SSL server socket context where all sockets spawned using this | 59 // Creates an SSL server socket context where all sockets spawned using this |
| 59 // context will share the same session cache. | 60 // context will share the same session cache. |
| 60 // | 61 // |
| 61 // The caller must provide the server certificate and private key to use. | 62 // The caller must provide the server certificate and private key to use. |
| 62 // It takes a reference to |certificate|. | 63 // It takes a reference to |certificate|. |
| 63 // The |key| and |ssl_config| parameters are copied. | 64 // The |key| and |ssl_config| parameters are copied. |
| 64 // | 65 // |
| 65 NET_EXPORT scoped_ptr<SSLServerContext> CreateSSLServerContext( | 66 NET_EXPORT std::unique_ptr<SSLServerContext> CreateSSLServerContext( |
| 66 X509Certificate* certificate, | 67 X509Certificate* certificate, |
| 67 const crypto::RSAPrivateKey& key, | 68 const crypto::RSAPrivateKey& key, |
| 68 const SSLServerConfig& ssl_config); | 69 const SSLServerConfig& ssl_config); |
| 69 | 70 |
| 70 } // namespace net | 71 } // namespace net |
| 71 | 72 |
| 72 #endif // NET_SOCKET_SSL_SERVER_SOCKET_H_ | 73 #endif // NET_SOCKET_SSL_SERVER_SOCKET_H_ |
| OLD | NEW |