diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 09:54:15 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 09:54:15 +0000 |
commit | f61c397ae7c8d07762b02d6578928163e2a8eca0 (patch) | |
tree | 3c029791e1a36b1218b5378c5e7b579d84023755 /net/socket/ssl_server_socket.h | |
parent | 88616f47602e8a2a16c65ca0a59444e0ce550772 (diff) | |
download | chromium_src-f61c397ae7c8d07762b02d6578928163e2a8eca0.zip chromium_src-f61c397ae7c8d07762b02d6578928163e2a8eca0.tar.gz chromium_src-f61c397ae7c8d07762b02d6578928163e2a8eca0.tar.bz2 |
Defines SSLServerSocket and implements SSLServerSocketNSS
Defines a SSLServerSocket interface. Implement this interface using NSS as
SSLServerSocketNSS.
This is the first version of the code. It disables several functions of NSS
like caching, session ticket, reneogotiation, etc. This is implemented to
suit the needs of Chromoting. Additional features of this socket will be added
when necessary.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/5746003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70041 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/ssl_server_socket.h')
-rw-r--r-- | net/socket/ssl_server_socket.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/net/socket/ssl_server_socket.h b/net/socket/ssl_server_socket.h new file mode 100644 index 0000000..b689c71 --- /dev/null +++ b/net/socket/ssl_server_socket.h @@ -0,0 +1,53 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_SOCKET_SSL_SERVER_SOCKET_H_ +#define NET_SOCKET_SSL_SERVER_SOCKET_H_ + +#include "base/basictypes.h" +#include "net/base/completion_callback.h" +#include "net/socket/socket.h" + +namespace base { +class RSAPrivateKey; +} // namespace base + +namespace net { + +class IOBuffer; +struct SSLConfig; +class X509Certificate; + +// SSLServerSocket takes an already connected socket and performs SSL on top of +// it. +// +// This class is designed to work in a peer-to-peer connection and is not +// intended to be used as a standalone SSL server. +class SSLServerSocket : public Socket { + public: + virtual ~SSLServerSocket() {} + + // Performs an SSL server handshake on the existing socket. The given socket + // must have already been connected. + // + // Accept either returns ERR_IO_PENDING, in which case the given callback + // will be called in the future with the real result, or it completes + // synchronously, returning the result immediately. + virtual int Accept(CompletionCallback* callback) = 0; +}; + +// Creates an SSL server socket using an already connected socket. A certificate +// and private key needs to be provided. +// +// This created server socket will take ownership of |socket|. However |key| +// is copied. +// TODO(hclam): Defines ServerSocketFactory to create SSLServerSocket. This will +// make mocking easier. +SSLServerSocket* CreateSSLServerSocket( + Socket* socket, X509Certificate* certificate, base::RSAPrivateKey* key, + const SSLConfig& ssl_config); + +} // namespace net + +#endif // NET_SOCKET_SSL_SERVER_SOCKET_NSS_H_ |