OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_POOL_H_ | 5 #ifndef NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_ |
6 #define NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_ | 6 #define NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 private: | 69 private: |
70 enum State { | 70 enum State { |
71 STATE_TCP_CONNECT, | 71 STATE_TCP_CONNECT, |
72 STATE_TCP_CONNECT_COMPLETE, | 72 STATE_TCP_CONNECT_COMPLETE, |
73 STATE_SOCKS_CONNECT, | 73 STATE_SOCKS_CONNECT, |
74 STATE_SOCKS_CONNECT_COMPLETE, | 74 STATE_SOCKS_CONNECT_COMPLETE, |
75 STATE_NONE, | 75 STATE_NONE, |
76 }; | 76 }; |
77 | 77 |
78 // Begins the tcp connection and the SOCKS handshake. Returns OK on success | |
79 // and ERR_IO_PENDING if it cannot immediately service the request. | |
80 // Otherwise, it returns a net error code. | |
81 virtual int ConnectInternal(); | |
82 | |
83 void OnIOComplete(int result); | 78 void OnIOComplete(int result); |
84 | 79 |
85 // Runs the state transition loop. | 80 // Runs the state transition loop. |
86 int DoLoop(int result); | 81 int DoLoop(int result); |
87 | 82 |
88 int DoTCPConnect(); | 83 int DoTCPConnect(); |
89 int DoTCPConnectComplete(int result); | 84 int DoTCPConnectComplete(int result); |
90 int DoSOCKSConnect(); | 85 int DoSOCKSConnect(); |
91 int DoSOCKSConnectComplete(int result); | 86 int DoSOCKSConnectComplete(int result); |
92 | 87 |
| 88 // Begins the tcp connection and the SOCKS handshake. Returns OK on success |
| 89 // and ERR_IO_PENDING if it cannot immediately service the request. |
| 90 // Otherwise, it returns a net error code. |
| 91 virtual int ConnectInternal(); |
| 92 |
93 scoped_refptr<SOCKSSocketParams> socks_params_; | 93 scoped_refptr<SOCKSSocketParams> socks_params_; |
94 TCPClientSocketPool* const tcp_pool_; | 94 TCPClientSocketPool* const tcp_pool_; |
95 HostResolver* const resolver_; | 95 HostResolver* const resolver_; |
96 | 96 |
97 State next_state_; | 97 State next_state_; |
98 CompletionCallbackImpl<SOCKSConnectJob> callback_; | 98 CompletionCallbackImpl<SOCKSConnectJob> callback_; |
99 scoped_ptr<ClientSocketHandle> tcp_socket_handle_; | 99 scoped_ptr<ClientSocketHandle> tcp_socket_handle_; |
100 scoped_ptr<ClientSocket> socket_; | 100 scoped_ptr<ClientSocket> socket_; |
101 | 101 |
102 DISALLOW_COPY_AND_ASSIGN(SOCKSConnectJob); | 102 DISALLOW_COPY_AND_ASSIGN(SOCKSConnectJob); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 PoolBase base_; | 187 PoolBase base_; |
188 | 188 |
189 DISALLOW_COPY_AND_ASSIGN(SOCKSClientSocketPool); | 189 DISALLOW_COPY_AND_ASSIGN(SOCKSClientSocketPool); |
190 }; | 190 }; |
191 | 191 |
192 REGISTER_SOCKET_PARAMS_FOR_POOL(SOCKSClientSocketPool, SOCKSSocketParams); | 192 REGISTER_SOCKET_PARAMS_FOR_POOL(SOCKSClientSocketPool, SOCKSSocketParams); |
193 | 193 |
194 } // namespace net | 194 } // namespace net |
195 | 195 |
196 #endif // NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_ | 196 #endif // NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_ |
OLD | NEW |