diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 18:48:36 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 18:48:36 +0000 |
commit | f4ae0ed7eedbb35d59376c300a6147da2b41c2b7 (patch) | |
tree | 71142f08e29e7d4c1799ff6af4f74c3e799446a5 /remoting/jingle_glue | |
parent | 59ba0142d4219a4ac6c5e3b463a1d5f923e0b568 (diff) | |
download | chromium_src-f4ae0ed7eedbb35d59376c300a6147da2b41c2b7.zip chromium_src-f4ae0ed7eedbb35d59376c300a6147da2b41c2b7.tar.gz chromium_src-f4ae0ed7eedbb35d59376c300a6147da2b41c2b7.tar.bz2 |
Add an extra SSL layer in JingleSession for Chromoting
Wrap the existing StreamSocketAdpaters in JingleSession with an extra of
SSLClientSocket and SSLServerSocket. Since the server certificate is
self-signed, SSLClientSocket will refuse to connect. An additional patch is
needed to transmit the certificate via other channels so client sSL socket can
accept this untrusted certificate.
BUG=None
TEST=remoting_unittests
Review URL: http://codereview.chromium.org/5675003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70074 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/jingle_glue')
-rw-r--r-- | remoting/jingle_glue/stream_socket_adapter.cc | 42 | ||||
-rw-r--r-- | remoting/jingle_glue/stream_socket_adapter.h | 19 |
2 files changed, 59 insertions, 2 deletions
diff --git a/remoting/jingle_glue/stream_socket_adapter.cc b/remoting/jingle_glue/stream_socket_adapter.cc index 3155328..4c5e6cf 100644 --- a/remoting/jingle_glue/stream_socket_adapter.cc +++ b/remoting/jingle_glue/stream_socket_adapter.cc @@ -6,6 +6,7 @@ #include "base/logging.h" #include "base/message_loop.h" +#include "net/base/address_list.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" #include "remoting/jingle_glue/utils.h" @@ -26,6 +27,47 @@ StreamSocketAdapter::StreamSocketAdapter(talk_base::StreamInterface* stream) StreamSocketAdapter::~StreamSocketAdapter() { } +int StreamSocketAdapter::Connect(net::CompletionCallback* callback) { + return net::OK; +} + +void StreamSocketAdapter::Disconnect() { +} + +bool StreamSocketAdapter::IsConnected() const { + return true; +} + +bool StreamSocketAdapter::IsConnectedAndIdle() const { + return true; +} + +int StreamSocketAdapter::GetPeerAddress(net::AddressList* address) const { + // We actually don't know the peer address. Returning so the upper layers + // won't complain. + net::IPAddressNumber ip_address(4); + *address = net::AddressList(ip_address, 0, false); + return net::OK; +} + +const net::BoundNetLog& StreamSocketAdapter::NetLog() const { + return net_log_; +} + +void StreamSocketAdapter::SetSubresourceSpeculation() { +} + +void StreamSocketAdapter::SetOmniboxSpeculation() { +} + +bool StreamSocketAdapter::WasEverUsed() const { + return true; +} + +bool StreamSocketAdapter::UsingTCPFastOpen() const { + return false; +} + int StreamSocketAdapter::Read( net::IOBuffer* buffer, int buffer_size, net::CompletionCallback* callback) { DCHECK_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); diff --git a/remoting/jingle_glue/stream_socket_adapter.h b/remoting/jingle_glue/stream_socket_adapter.h index 2387bdd..942aa45 100644 --- a/remoting/jingle_glue/stream_socket_adapter.h +++ b/remoting/jingle_glue/stream_socket_adapter.h @@ -6,7 +6,8 @@ #define REMOTING_JINGLE_GLUE_STREAM_SOCKET_ADAPTER_H_ #include "base/scoped_ptr.h" -#include "net/socket/socket.h" +#include "net/base/net_log.h" +#include "net/socket/client_socket.h" #include "third_party/libjingle/source/talk/base/sigslot.h" namespace talk_base { @@ -18,13 +19,25 @@ namespace remoting { // StreamSocketAdapter implements net::Socket interface on top of // libjingle's StreamInterface. It is used by JingleChromotocolConnection // to provide net::Socket interface for channels. -class StreamSocketAdapter : public net::Socket, +class StreamSocketAdapter : public net::ClientSocket, public sigslot::has_slots<> { public: // Ownership of the stream is passed to the adapter. explicit StreamSocketAdapter(talk_base::StreamInterface* stream); virtual ~StreamSocketAdapter(); + // ClientSocket interface. + virtual int Connect(net::CompletionCallback* callback); + virtual void Disconnect(); + virtual bool IsConnected() const; + virtual bool IsConnectedAndIdle() const; + virtual int GetPeerAddress(net::AddressList* address) const; + virtual const net::BoundNetLog& NetLog() const; + virtual void SetSubresourceSpeculation(); + virtual void SetOmniboxSpeculation(); + virtual bool WasEverUsed() const; + virtual bool UsingTCPFastOpen() const; + // Closes the stream. |error_code| specifies error code that will // be returned by Read() and Write() after the stream is closed. void Close(int error_code); @@ -62,6 +75,8 @@ class StreamSocketAdapter : public net::Socket, int closed_error_code_; + net::BoundNetLog net_log_; + DISALLOW_COPY_AND_ASSIGN(StreamSocketAdapter); }; |