| 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 NET_SOCKET_SOCKS_CLIENT_SOCKET_H_ | 5 #ifndef NET_SOCKET_SOCKS_CLIENT_SOCKET_H_ |
| 6 #define NET_SOCKET_SOCKS_CLIENT_SOCKET_H_ | 6 #define NET_SOCKET_SOCKS_CLIENT_SOCKET_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 16 #include "net/base/address_list.h" | 16 #include "net/base/address_list.h" |
| 17 #include "net/base/completion_callback.h" | 17 #include "net/base/completion_callback.h" |
| 18 #include "net/base/host_resolver.h" | 18 #include "net/base/host_resolver.h" |
| 19 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
| 20 #include "net/base/net_log.h" | 20 #include "net/base/net_log.h" |
| 21 #include "net/socket/client_socket.h" | 21 #include "net/socket/stream_socket.h" |
| 22 | 22 |
| 23 namespace net { | 23 namespace net { |
| 24 | 24 |
| 25 class ClientSocketHandle; | 25 class ClientSocketHandle; |
| 26 class BoundNetLog; | 26 class BoundNetLog; |
| 27 | 27 |
| 28 // The SOCKS client socket implementation | 28 // The SOCKS client socket implementation |
| 29 class SOCKSClientSocket : public ClientSocket { | 29 class SOCKSClientSocket : public StreamSocket { |
| 30 public: | 30 public: |
| 31 // Takes ownership of the |transport_socket|, which should already be | 31 // Takes ownership of the |transport_socket|, which should already be |
| 32 // connected by the time Connect() is called. | 32 // connected by the time Connect() is called. |
| 33 // | 33 // |
| 34 // |req_info| contains the hostname and port to which the socket above will | 34 // |req_info| contains the hostname and port to which the socket above will |
| 35 // communicate to via the socks layer. For testing the referrer is optional. | 35 // communicate to via the socks layer. For testing the referrer is optional. |
| 36 SOCKSClientSocket(ClientSocketHandle* transport_socket, | 36 SOCKSClientSocket(ClientSocketHandle* transport_socket, |
| 37 const HostResolver::RequestInfo& req_info, | 37 const HostResolver::RequestInfo& req_info, |
| 38 HostResolver* host_resolver); | 38 HostResolver* host_resolver); |
| 39 | 39 |
| 40 // Deprecated constructor (http://crbug.com/37810) that takes a ClientSocket. | 40 // Deprecated constructor (http://crbug.com/37810) that takes a StreamSocket. |
| 41 SOCKSClientSocket(ClientSocket* transport_socket, | 41 SOCKSClientSocket(StreamSocket* transport_socket, |
| 42 const HostResolver::RequestInfo& req_info, | 42 const HostResolver::RequestInfo& req_info, |
| 43 HostResolver* host_resolver); | 43 HostResolver* host_resolver); |
| 44 | 44 |
| 45 // On destruction Disconnect() is called. | 45 // On destruction Disconnect() is called. |
| 46 virtual ~SOCKSClientSocket(); | 46 virtual ~SOCKSClientSocket(); |
| 47 | 47 |
| 48 // ClientSocket methods: | 48 // StreamSocket methods: |
| 49 | 49 |
| 50 // Does the SOCKS handshake and completes the protocol. | 50 // Does the SOCKS handshake and completes the protocol. |
| 51 virtual int Connect(CompletionCallback* callback); | 51 virtual int Connect(CompletionCallback* callback); |
| 52 virtual void Disconnect(); | 52 virtual void Disconnect(); |
| 53 virtual bool IsConnected() const; | 53 virtual bool IsConnected() const; |
| 54 virtual bool IsConnectedAndIdle() const; | 54 virtual bool IsConnectedAndIdle() const; |
| 55 virtual const BoundNetLog& NetLog() const; | 55 virtual const BoundNetLog& NetLog() const; |
| 56 virtual void SetSubresourceSpeculation(); | 56 virtual void SetSubresourceSpeculation(); |
| 57 virtual void SetOmniboxSpeculation(); | 57 virtual void SetOmniboxSpeculation(); |
| 58 virtual bool WasEverUsed() const; | 58 virtual bool WasEverUsed() const; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 HostResolver::RequestInfo host_request_info_; | 129 HostResolver::RequestInfo host_request_info_; |
| 130 | 130 |
| 131 BoundNetLog net_log_; | 131 BoundNetLog net_log_; |
| 132 | 132 |
| 133 DISALLOW_COPY_AND_ASSIGN(SOCKSClientSocket); | 133 DISALLOW_COPY_AND_ASSIGN(SOCKSClientSocket); |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 } // namespace net | 136 } // namespace net |
| 137 | 137 |
| 138 #endif // NET_SOCKET_SOCKS_CLIENT_SOCKET_H_ | 138 #endif // NET_SOCKET_SOCKS_CLIENT_SOCKET_H_ |
| OLD | NEW |