OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "net/base/completion_callback.h" | 9 #include "net/base/completion_callback.h" |
10 #include "net/base/net_api.h" | 10 #include "net/base/net_api.h" |
11 #include "net/socket/socket.h" | 11 #include "net/socket/stream_socket.h" |
12 | 12 |
13 namespace crypto { | 13 namespace crypto { |
14 class RSAPrivateKey; | 14 class RSAPrivateKey; |
15 } // namespace base | 15 } // namespace base |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 class IOBuffer; | 19 class IOBuffer; |
20 struct SSLConfig; | 20 struct SSLConfig; |
21 class X509Certificate; | 21 class X509Certificate; |
22 | 22 |
23 // SSLServerSocket takes an already connected socket and performs SSL on top of | |
24 // it. | |
25 // | |
26 // This class is designed to work in a peer-to-peer connection and is not | |
27 // intended to be used as a standalone SSL server. | |
28 class SSLServerSocket : public Socket { | |
29 public: | |
30 virtual ~SSLServerSocket() {} | |
31 | |
32 // Performs an SSL server handshake on the existing socket. The given socket | |
33 // must have already been connected. | |
34 // | |
35 // Accept either returns ERR_IO_PENDING, in which case the given callback | |
36 // will be called in the future with the real result, or it completes | |
37 // synchronously, returning the result immediately. | |
38 virtual int Accept(CompletionCallback* callback) = 0; | |
39 }; | |
wtc
2011/06/02 19:48:24
It is strange that a header file named ssl_server_
| |
40 | |
41 // Creates an SSL server socket using an already connected socket. A certificate | 23 // Creates an SSL server socket using an already connected socket. A certificate |
42 // and private key needs to be provided. | 24 // and private key needs to be provided. |
43 // | 25 // |
44 // This created server socket will take ownership of |socket|. However |key| | 26 // The SSL StreamSocket takes ownership of |socket|. |
wtc
2011/06/02 19:48:24
You should document that this happens even if the
Wez
2011/06/02 22:06:01
Done.
| |
45 // is copied. | 27 // It takes a reference to |certificate|. |
46 // TODO(hclam): Defines ServerSocketFactory to create SSLServerSocket. This will | 28 // The |key| and |ssl_config| parameters are copied. |key| cannot be const |
47 // make mocking easier. | 29 // because the methods used to copy its contents are non-const. |
48 NET_API SSLServerSocket* CreateSSLServerSocket( | 30 // |
49 Socket* socket, X509Certificate* certificate, crypto::RSAPrivateKey* key, | 31 // The caller starts the SSL connection acceptance protocol by calling Connect |
wtc
2011/06/02 19:48:24
Nit: SSL connection acceptance protocol => SSL ser
Wez
2011/06/02 22:06:01
Done.
| |
32 // on the returned socket. | |
33 NET_API StreamSocket* CreateSSLServerSocket( | |
34 StreamSocket* socket, | |
35 X509Certificate* certificate, | |
36 crypto::RSAPrivateKey* key, | |
50 const SSLConfig& ssl_config); | 37 const SSLConfig& ssl_config); |
51 | 38 |
52 } // namespace net | 39 } // namespace net |
53 | 40 |
54 #endif // NET_SOCKET_SSL_SERVER_SOCKET_NSS_H_ | 41 #endif // NET_SOCKET_SSL_SERVER_SOCKET_NSS_H_ |
OLD | NEW |