| 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 REMOTING_JINGLE_GLUE_SSL_SOCKET_ADAPTER_H_ | 5 #ifndef REMOTING_JINGLE_GLUE_SSL_SOCKET_ADAPTER_H_ |
| 6 #define REMOTING_JINGLE_GLUE_SSL_SOCKET_ADAPTER_H_ | 6 #define REMOTING_JINGLE_GLUE_SSL_SOCKET_ADAPTER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "net/base/completion_callback.h" | 9 #include "net/base/completion_callback.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| 11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 12 #include "net/base/net_log.h" | 12 #include "net/base/net_log.h" |
| 13 #include "net/socket/client_socket.h" | |
| 14 #include "net/socket/ssl_client_socket.h" | 13 #include "net/socket/ssl_client_socket.h" |
| 14 #include "net/socket/stream_socket.h" |
| 15 #include "third_party/libjingle/source/talk/base/asyncsocket.h" | 15 #include "third_party/libjingle/source/talk/base/asyncsocket.h" |
| 16 #include "third_party/libjingle/source/talk/base/ssladapter.h" | 16 #include "third_party/libjingle/source/talk/base/ssladapter.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 class CertVerifier; | 19 class CertVerifier; |
| 20 } // namespace net | 20 } // namespace net |
| 21 | 21 |
| 22 namespace remoting { | 22 namespace remoting { |
| 23 | 23 |
| 24 class SSLSocketAdapter; | 24 class SSLSocketAdapter; |
| 25 | 25 |
| 26 // TODO(sergeyu): Write unittests for this code! | 26 // TODO(sergeyu): Write unittests for this code! |
| 27 | 27 |
| 28 // This class provides a wrapper to libjingle's talk_base::AsyncSocket that | 28 // This class provides a wrapper to libjingle's talk_base::AsyncSocket that |
| 29 // implements Chromium's net::ClientSocket interface. It's used by | 29 // implements Chromium's net::StreamSocket interface. It's used by |
| 30 // SSLSocketAdapter to enable Chromium's SSL implementation to work over | 30 // SSLSocketAdapter to enable Chromium's SSL implementation to work over |
| 31 // libjingle's socket class. | 31 // libjingle's socket class. |
| 32 class TransportSocket : public net::ClientSocket, public sigslot::has_slots<> { | 32 class TransportSocket : public net::StreamSocket, public sigslot::has_slots<> { |
| 33 public: | 33 public: |
| 34 TransportSocket(talk_base::AsyncSocket* socket, | 34 TransportSocket(talk_base::AsyncSocket* socket, |
| 35 SSLSocketAdapter *ssl_adapter); | 35 SSLSocketAdapter *ssl_adapter); |
| 36 ~TransportSocket(); | 36 ~TransportSocket(); |
| 37 | 37 |
| 38 void set_addr(const talk_base::SocketAddress& addr) { | 38 void set_addr(const talk_base::SocketAddress& addr) { |
| 39 addr_ = addr; | 39 addr_ = addr; |
| 40 } | 40 } |
| 41 | 41 |
| 42 // net::ClientSocket implementation | 42 // net::StreamSocket implementation |
| 43 | 43 |
| 44 virtual int Connect(net::CompletionCallback* callback); | 44 virtual int Connect(net::CompletionCallback* callback); |
| 45 virtual void Disconnect(); | 45 virtual void Disconnect(); |
| 46 virtual bool IsConnected() const; | 46 virtual bool IsConnected() const; |
| 47 virtual bool IsConnectedAndIdle() const; | 47 virtual bool IsConnectedAndIdle() const; |
| 48 virtual int GetPeerAddress(net::AddressList* address) const; | 48 virtual int GetPeerAddress(net::AddressList* address) const; |
| 49 virtual int GetLocalAddress(net::IPEndPoint* address) const; | 49 virtual int GetLocalAddress(net::IPEndPoint* address) const; |
| 50 virtual const net::BoundNetLog& NetLog() const; | 50 virtual const net::BoundNetLog& NetLog() const; |
| 51 virtual void SetSubresourceSpeculation(); | 51 virtual void SetSubresourceSpeculation(); |
| 52 virtual void SetOmniboxSpeculation(); | 52 virtual void SetOmniboxSpeculation(); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 IOState write_state_; | 143 IOState write_state_; |
| 144 scoped_refptr<net::IOBuffer> transport_buf_; | 144 scoped_refptr<net::IOBuffer> transport_buf_; |
| 145 int data_transferred_; | 145 int data_transferred_; |
| 146 | 146 |
| 147 DISALLOW_COPY_AND_ASSIGN(SSLSocketAdapter); | 147 DISALLOW_COPY_AND_ASSIGN(SSLSocketAdapter); |
| 148 }; | 148 }; |
| 149 | 149 |
| 150 } // namespace remoting | 150 } // namespace remoting |
| 151 | 151 |
| 152 #endif // REMOTING_JINGLE_GLUE_SSL_SOCKET_ADAPTER_H_ | 152 #endif // REMOTING_JINGLE_GLUE_SSL_SOCKET_ADAPTER_H_ |
| OLD | NEW |