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

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: Add a StartHandshake method, and make Connect NOT_IMPLEMENTED. 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 | « no previous file | net/socket/ssl_server_socket_nss.h » ('j') | net/socket/ssl_server_socket_nss.h » ('J')
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 net::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 // Start the SSL server handshake, and notify the supplied callback
33 // must have already been connected. 28 // when the process completes, or fails. If Disconnect is called on
wtc 2011/06/10 22:17:35 Nit: change "process" to "handshake" to be more sp
Wez 2011/06/11 01:08:33 Reworded this anyway.
34 // 29 // the SSLServerSocket then the callback will be silently dropped, in
35 // Accept either returns ERR_IO_PENDING, in which case the given callback 30 // the same way as for other StreamSocket calls.
36 // will be called in the future with the real result, or it completes 31 virtual int StartHandshake(CompletionCallback* callback) = 0;
wtc 2011/06/10 22:17:35 Just call this method "Handshake" unless "handshak
Wez 2011/06/11 01:08:33 Done.
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-side StreamSocket over an already-connected transport
42 // and private key needs to be provided. 35 // StreamSocket. The caller must provide the server certificate and private
36 // key to use.
43 // 37 //
44 // This created server socket will take ownership of |socket|. However |key| 38 // The returned SSLServerSocket takes ownership of |socket|. Stubbed versions
45 // is copied. 39 // of CreateSSLServerSocket will delete |socket| and return NULL.
46 // TODO(hclam): Defines ServerSocketFactory to create SSLServerSocket. This will 40 // It takes a reference to |certificate|.
47 // make mocking easier. 41 // The |key| and |ssl_config| parameters are copied. |key| cannot be const
42 // because the methods used to copy its contents are non-const.
43 //
44 // The caller starts the SSL server handshake by calling StartHandshake on the
45 // returned socket.
48 NET_API SSLServerSocket* CreateSSLServerSocket( 46 NET_API SSLServerSocket* CreateSSLServerSocket(
49 Socket* socket, X509Certificate* certificate, crypto::RSAPrivateKey* key, 47 StreamSocket* socket,
48 X509Certificate* certificate,
49 crypto::RSAPrivateKey* key,
50 const SSLConfig& ssl_config); 50 const SSLConfig& ssl_config);
51 51
52 } // namespace net 52 } // namespace net
53 53
54 #endif // NET_SOCKET_SSL_SERVER_SOCKET_NSS_H_ 54 #endif // NET_SOCKET_SSL_SERVER_SOCKET_NSS_H_
OLDNEW
« no previous file with comments | « no previous file | net/socket/ssl_server_socket_nss.h » ('j') | net/socket/ssl_server_socket_nss.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698