Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: net/socket/ssl_server_socket.h

Issue 7054010: Update SSLServerSocket to provide the net::StreamSocket interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix missed Connect call to Handshake in unit test. Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/net_log_event_type_list.h ('k') | net/socket/ssl_server_socket_nss.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 23 class SSLServerSocket : public StreamSocket {
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: 24 public:
30 virtual ~SSLServerSocket() {} 25 virtual ~SSLServerSocket() {}
31 26
32 // Performs an SSL server handshake on the existing socket. The given socket 27 // Perform the SSL server handshake, and notify the supplied callback
33 // must have already been connected. 28 // if the process completes asynchronously. If Disconnect is called before
34 // 29 // completion then the callback will be silently, as for other StreamSocket
35 // Accept either returns ERR_IO_PENDING, in which case the given callback 30 // calls.
36 // will be called in the future with the real result, or it completes 31 virtual int Handshake(CompletionCallback* callback) = 0;
37 // synchronously, returning the result immediately.
38 virtual int Accept(CompletionCallback* callback) = 0;
39 }; 32 };
40 33
41 // Creates an SSL server socket using an already connected socket. A certificate 34 // Creates an SSL server socket over an already-connected transport socket.
42 // and private key needs to be provided. 35 // The caller must provide the server certificate and private key to use.
43 // 36 //
44 // This created server socket will take ownership of |socket|. However |key| 37 // The returned SSLServerSocket takes ownership of |socket|. Stubbed versions
45 // is copied. 38 // of CreateSSLServerSocket will delete |socket| and return NULL.
46 // TODO(hclam): Defines ServerSocketFactory to create SSLServerSocket. This will 39 // It takes a reference to |certificate|.
47 // make mocking easier. 40 // The |key| and |ssl_config| parameters are copied. |key| cannot be const
41 // because the methods used to copy its contents are non-const.
42 //
43 // The caller starts the SSL server handshake by calling Handshake on the
44 // returned socket.
48 NET_API SSLServerSocket* CreateSSLServerSocket( 45 NET_API SSLServerSocket* CreateSSLServerSocket(
49 Socket* socket, X509Certificate* certificate, crypto::RSAPrivateKey* key, 46 StreamSocket* socket,
47 X509Certificate* certificate,
48 crypto::RSAPrivateKey* key,
50 const SSLConfig& ssl_config); 49 const SSLConfig& ssl_config);
51 50
52 } // namespace net 51 } // namespace net
53 52
54 #endif // NET_SOCKET_SSL_SERVER_SOCKET_NSS_H_ 53 #endif // NET_SOCKET_SSL_SERVER_SOCKET_H_
OLDNEW
« no previous file with comments | « net/base/net_log_event_type_list.h ('k') | net/socket/ssl_server_socket_nss.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698