| 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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 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 virtual ~TransportSocket(); | 36 virtual ~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::StreamSocket implementation. | 42 // net::StreamSocket implementation. |
| 43 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; | |
| 44 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; | 43 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; |
| 45 virtual void Disconnect() OVERRIDE; | 44 virtual void Disconnect() OVERRIDE; |
| 46 virtual bool IsConnected() const OVERRIDE; | 45 virtual bool IsConnected() const OVERRIDE; |
| 47 virtual bool IsConnectedAndIdle() const OVERRIDE; | 46 virtual bool IsConnectedAndIdle() const OVERRIDE; |
| 48 virtual int GetPeerAddress(net::AddressList* address) const OVERRIDE; | 47 virtual int GetPeerAddress(net::AddressList* address) const OVERRIDE; |
| 49 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; | 48 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; |
| 50 virtual const net::BoundNetLog& NetLog() const OVERRIDE; | 49 virtual const net::BoundNetLog& NetLog() const OVERRIDE; |
| 51 virtual void SetSubresourceSpeculation() OVERRIDE; | 50 virtual void SetSubresourceSpeculation() OVERRIDE; |
| 52 virtual void SetOmniboxSpeculation() OVERRIDE; | 51 virtual void SetOmniboxSpeculation() OVERRIDE; |
| 53 virtual bool WasEverUsed() const OVERRIDE; | 52 virtual bool WasEverUsed() const OVERRIDE; |
| 54 virtual bool UsingTCPFastOpen() const OVERRIDE; | 53 virtual bool UsingTCPFastOpen() const OVERRIDE; |
| 55 virtual int64 NumBytesRead() const OVERRIDE; | 54 virtual int64 NumBytesRead() const OVERRIDE; |
| 56 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; | 55 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; |
| 57 | 56 |
| 58 // net::Socket implementation. | 57 // net::Socket implementation. |
| 59 virtual int Read(net::IOBuffer* buf, int buf_len, | 58 virtual int Read(net::IOBuffer* buf, int buf_len, |
| 60 net::OldCompletionCallback* callback) OVERRIDE; | |
| 61 virtual int Read(net::IOBuffer* buf, int buf_len, | |
| 62 const net::CompletionCallback& callback) OVERRIDE; | 59 const net::CompletionCallback& callback) OVERRIDE; |
| 63 virtual int Write(net::IOBuffer* buf, int buf_len, | 60 virtual int Write(net::IOBuffer* buf, int buf_len, |
| 64 net::OldCompletionCallback* callback) OVERRIDE; | 61 const net::CompletionCallback& callback) OVERRIDE; |
| 65 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; | 62 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
| 66 virtual bool SetSendBufferSize(int32 size) OVERRIDE; | 63 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
| 67 | 64 |
| 68 private: | 65 private: |
| 69 friend class SSLSocketAdapter; | 66 friend class SSLSocketAdapter; |
| 70 | 67 |
| 71 void OnReadEvent(talk_base::AsyncSocket* socket); | 68 void OnReadEvent(talk_base::AsyncSocket* socket); |
| 72 void OnWriteEvent(talk_base::AsyncSocket* socket); | 69 void OnWriteEvent(talk_base::AsyncSocket* socket); |
| 73 | 70 |
| 74 net::OldCompletionCallback* old_read_callback_; | 71 // Holds the user's completion callback when Write and Read are called. |
| 75 net::CompletionCallback read_callback_; | 72 net::CompletionCallback read_callback_; |
| 76 net::OldCompletionCallback* write_callback_; | 73 net::CompletionCallback write_callback_; |
| 77 | 74 |
| 78 scoped_refptr<net::IOBuffer> read_buffer_; | 75 scoped_refptr<net::IOBuffer> read_buffer_; |
| 79 int read_buffer_len_; | 76 int read_buffer_len_; |
| 80 scoped_refptr<net::IOBuffer> write_buffer_; | 77 scoped_refptr<net::IOBuffer> write_buffer_; |
| 81 int write_buffer_len_; | 78 int write_buffer_len_; |
| 82 | 79 |
| 83 net::BoundNetLog net_log_; | 80 net::BoundNetLog net_log_; |
| 84 | 81 |
| 85 talk_base::AsyncSocket *socket_; | 82 talk_base::AsyncSocket *socket_; |
| 86 talk_base::SocketAddress addr_; | 83 talk_base::SocketAddress addr_; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 133 |
| 137 bool ignore_bad_cert_; | 134 bool ignore_bad_cert_; |
| 138 std::string hostname_; | 135 std::string hostname_; |
| 139 TransportSocket* transport_socket_; | 136 TransportSocket* transport_socket_; |
| 140 | 137 |
| 141 // |cert_verifier_| must be defined before |ssl_socket_|, so that | 138 // |cert_verifier_| must be defined before |ssl_socket_|, so that |
| 142 // it's destroyed after |ssl_socket_|. | 139 // it's destroyed after |ssl_socket_|. |
| 143 scoped_ptr<net::CertVerifier> cert_verifier_; | 140 scoped_ptr<net::CertVerifier> cert_verifier_; |
| 144 scoped_ptr<net::SSLClientSocket> ssl_socket_; | 141 scoped_ptr<net::SSLClientSocket> ssl_socket_; |
| 145 | 142 |
| 146 net::OldCompletionCallbackImpl<SSLSocketAdapter> connected_callback_; | |
| 147 net::OldCompletionCallbackImpl<SSLSocketAdapter> read_callback_; | |
| 148 net::OldCompletionCallbackImpl<SSLSocketAdapter> write_callback_; | |
| 149 SSLState ssl_state_; | 143 SSLState ssl_state_; |
| 150 IOState read_state_; | 144 IOState read_state_; |
| 151 IOState write_state_; | 145 IOState write_state_; |
| 152 scoped_refptr<net::IOBuffer> transport_buf_; | 146 scoped_refptr<net::IOBuffer> transport_buf_; |
| 153 int data_transferred_; | 147 int data_transferred_; |
| 154 | 148 |
| 155 DISALLOW_COPY_AND_ASSIGN(SSLSocketAdapter); | 149 DISALLOW_COPY_AND_ASSIGN(SSLSocketAdapter); |
| 156 }; | 150 }; |
| 157 | 151 |
| 158 } // namespace remoting | 152 } // namespace remoting |
| 159 | 153 |
| 160 #endif // REMOTING_JINGLE_GLUE_SSL_SOCKET_ADAPTER_H_ | 154 #endif // REMOTING_JINGLE_GLUE_SSL_SOCKET_ADAPTER_H_ |
| OLD | NEW |