| 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_SSL_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ |
| 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 namespace net { | 23 namespace net { |
| 24 | 24 |
| 25 class ClientSocketFactory; | 25 class ClientSocketFactory; |
| 26 class ConnectJobFactory; | 26 class ConnectJobFactory; |
| 27 class DnsRRResolver; | 27 class DnsRRResolver; |
| 28 class HttpProxyClientSocketPool; | 28 class HttpProxyClientSocketPool; |
| 29 class HttpProxySocketParams; | 29 class HttpProxySocketParams; |
| 30 class SOCKSClientSocketPool; | 30 class SOCKSClientSocketPool; |
| 31 class SOCKSSocketParams; | 31 class SOCKSSocketParams; |
| 32 class SSLClientSocket; | 32 class SSLClientSocket; |
| 33 class SSLHostInfoFactory; | |
| 34 class TCPClientSocketPool; | 33 class TCPClientSocketPool; |
| 35 class TCPSocketParams; | 34 class TCPSocketParams; |
| 36 struct RRResponse; | 35 struct RRResponse; |
| 37 | 36 |
| 38 // SSLSocketParams only needs the socket params for the transport socket | 37 // SSLSocketParams only needs the socket params for the transport socket |
| 39 // that will be used (denoted by |proxy|). | 38 // that will be used (denoted by |proxy|). |
| 40 class SSLSocketParams : public base::RefCounted<SSLSocketParams> { | 39 class SSLSocketParams : public base::RefCounted<SSLSocketParams> { |
| 41 public: | 40 public: |
| 42 SSLSocketParams(const scoped_refptr<TCPSocketParams>& tcp_params, | 41 SSLSocketParams(const scoped_refptr<TCPSocketParams>& tcp_params, |
| 43 const scoped_refptr<SOCKSSocketParams>& socks_params, | 42 const scoped_refptr<SOCKSSocketParams>& socks_params, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 SSLConnectJob( | 86 SSLConnectJob( |
| 88 const std::string& group_name, | 87 const std::string& group_name, |
| 89 const scoped_refptr<SSLSocketParams>& params, | 88 const scoped_refptr<SSLSocketParams>& params, |
| 90 const base::TimeDelta& timeout_duration, | 89 const base::TimeDelta& timeout_duration, |
| 91 TCPClientSocketPool* tcp_pool, | 90 TCPClientSocketPool* tcp_pool, |
| 92 SOCKSClientSocketPool* socks_pool, | 91 SOCKSClientSocketPool* socks_pool, |
| 93 HttpProxyClientSocketPool* http_proxy_pool, | 92 HttpProxyClientSocketPool* http_proxy_pool, |
| 94 ClientSocketFactory* client_socket_factory, | 93 ClientSocketFactory* client_socket_factory, |
| 95 HostResolver* host_resolver, | 94 HostResolver* host_resolver, |
| 96 DnsRRResolver* dnsrr_resolver, | 95 DnsRRResolver* dnsrr_resolver, |
| 97 SSLHostInfoFactory* ssl_host_info_factory, | |
| 98 Delegate* delegate, | 96 Delegate* delegate, |
| 99 NetLog* net_log); | 97 NetLog* net_log); |
| 100 virtual ~SSLConnectJob(); | 98 virtual ~SSLConnectJob(); |
| 101 | 99 |
| 102 // ConnectJob methods. | 100 // ConnectJob methods. |
| 103 virtual LoadState GetLoadState() const; | 101 virtual LoadState GetLoadState() const; |
| 104 | 102 |
| 105 virtual void GetAdditionalErrorState(ClientSocketHandle * handle); | 103 virtual void GetAdditionalErrorState(ClientSocketHandle * handle); |
| 106 | 104 |
| 107 private: | 105 private: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 135 int DoTunnelConnectComplete(int result); | 133 int DoTunnelConnectComplete(int result); |
| 136 int DoSSLConnect(); | 134 int DoSSLConnect(); |
| 137 int DoSSLConnectComplete(int result); | 135 int DoSSLConnectComplete(int result); |
| 138 | 136 |
| 139 scoped_refptr<SSLSocketParams> params_; | 137 scoped_refptr<SSLSocketParams> params_; |
| 140 TCPClientSocketPool* const tcp_pool_; | 138 TCPClientSocketPool* const tcp_pool_; |
| 141 SOCKSClientSocketPool* const socks_pool_; | 139 SOCKSClientSocketPool* const socks_pool_; |
| 142 HttpProxyClientSocketPool* const http_proxy_pool_; | 140 HttpProxyClientSocketPool* const http_proxy_pool_; |
| 143 ClientSocketFactory* const client_socket_factory_; | 141 ClientSocketFactory* const client_socket_factory_; |
| 144 HostResolver* const resolver_; | 142 HostResolver* const resolver_; |
| 145 DnsRRResolver* const dnsrr_resolver_; | 143 DnsRRResolver* dnsrr_resolver_; |
| 146 SSLHostInfoFactory* const ssl_host_info_factory_; | |
| 147 | 144 |
| 148 State next_state_; | 145 State next_state_; |
| 149 CompletionCallbackImpl<SSLConnectJob> callback_; | 146 CompletionCallbackImpl<SSLConnectJob> callback_; |
| 150 scoped_ptr<ClientSocketHandle> transport_socket_handle_; | 147 scoped_ptr<ClientSocketHandle> transport_socket_handle_; |
| 151 scoped_ptr<SSLClientSocket> ssl_socket_; | 148 scoped_ptr<SSLClientSocket> ssl_socket_; |
| 152 scoped_ptr<SSLHostInfo> ssl_host_info_; | |
| 153 | 149 |
| 154 // The time the DoSSLConnect() method was called. | 150 // The time the DoSSLConnect() method was called. |
| 155 base::TimeTicks ssl_connect_start_time_; | 151 base::TimeTicks ssl_connect_start_time_; |
| 156 | 152 |
| 157 HttpResponseInfo error_response_info_; | 153 HttpResponseInfo error_response_info_; |
| 158 | 154 |
| 159 DISALLOW_COPY_AND_ASSIGN(SSLConnectJob); | 155 DISALLOW_COPY_AND_ASSIGN(SSLConnectJob); |
| 160 }; | 156 }; |
| 161 | 157 |
| 162 class SSLClientSocketPool : public ClientSocketPool, | 158 class SSLClientSocketPool : public ClientSocketPool, |
| 163 public SSLConfigService::Observer { | 159 public SSLConfigService::Observer { |
| 164 public: | 160 public: |
| 165 // Only the pools that will be used are required. i.e. if you never | 161 // Only the pools that will be used are required. i.e. if you never |
| 166 // try to create an SSL over SOCKS socket, |socks_pool| may be NULL. | 162 // try to create an SSL over SOCKS socket, |socks_pool| may be NULL. |
| 167 SSLClientSocketPool( | 163 SSLClientSocketPool( |
| 168 int max_sockets, | 164 int max_sockets, |
| 169 int max_sockets_per_group, | 165 int max_sockets_per_group, |
| 170 ClientSocketPoolHistograms* histograms, | 166 ClientSocketPoolHistograms* histograms, |
| 171 HostResolver* host_resolver, | 167 HostResolver* host_resolver, |
| 172 DnsRRResolver* dnsrr_resolver, | 168 DnsRRResolver* dnsrr_resolver, |
| 173 SSLHostInfoFactory* ssl_host_info_factory, | |
| 174 ClientSocketFactory* client_socket_factory, | 169 ClientSocketFactory* client_socket_factory, |
| 175 TCPClientSocketPool* tcp_pool, | 170 TCPClientSocketPool* tcp_pool, |
| 176 SOCKSClientSocketPool* socks_pool, | 171 SOCKSClientSocketPool* socks_pool, |
| 177 HttpProxyClientSocketPool* http_proxy_pool, | 172 HttpProxyClientSocketPool* http_proxy_pool, |
| 178 SSLConfigService* ssl_config_service, | 173 SSLConfigService* ssl_config_service, |
| 179 NetLog* net_log); | 174 NetLog* net_log); |
| 180 | 175 |
| 181 virtual ~SSLClientSocketPool(); | 176 virtual ~SSLClientSocketPool(); |
| 182 | 177 |
| 183 // ClientSocketPool methods: | 178 // ClientSocketPool methods: |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 231 |
| 237 class SSLConnectJobFactory : public PoolBase::ConnectJobFactory { | 232 class SSLConnectJobFactory : public PoolBase::ConnectJobFactory { |
| 238 public: | 233 public: |
| 239 SSLConnectJobFactory( | 234 SSLConnectJobFactory( |
| 240 TCPClientSocketPool* tcp_pool, | 235 TCPClientSocketPool* tcp_pool, |
| 241 SOCKSClientSocketPool* socks_pool, | 236 SOCKSClientSocketPool* socks_pool, |
| 242 HttpProxyClientSocketPool* http_proxy_pool, | 237 HttpProxyClientSocketPool* http_proxy_pool, |
| 243 ClientSocketFactory* client_socket_factory, | 238 ClientSocketFactory* client_socket_factory, |
| 244 HostResolver* host_resolver, | 239 HostResolver* host_resolver, |
| 245 DnsRRResolver* dnsrr_resolver, | 240 DnsRRResolver* dnsrr_resolver, |
| 246 SSLHostInfoFactory* ssl_host_info_factory, | |
| 247 NetLog* net_log); | 241 NetLog* net_log); |
| 248 | 242 |
| 249 virtual ~SSLConnectJobFactory() {} | 243 virtual ~SSLConnectJobFactory() {} |
| 250 | 244 |
| 251 // ClientSocketPoolBase::ConnectJobFactory methods. | 245 // ClientSocketPoolBase::ConnectJobFactory methods. |
| 252 virtual ConnectJob* NewConnectJob( | 246 virtual ConnectJob* NewConnectJob( |
| 253 const std::string& group_name, | 247 const std::string& group_name, |
| 254 const PoolBase::Request& request, | 248 const PoolBase::Request& request, |
| 255 ConnectJob::Delegate* delegate) const; | 249 ConnectJob::Delegate* delegate) const; |
| 256 | 250 |
| 257 virtual base::TimeDelta ConnectionTimeout() const { return timeout_; } | 251 virtual base::TimeDelta ConnectionTimeout() const { return timeout_; } |
| 258 | 252 |
| 259 private: | 253 private: |
| 260 TCPClientSocketPool* const tcp_pool_; | 254 TCPClientSocketPool* const tcp_pool_; |
| 261 SOCKSClientSocketPool* const socks_pool_; | 255 SOCKSClientSocketPool* const socks_pool_; |
| 262 HttpProxyClientSocketPool* const http_proxy_pool_; | 256 HttpProxyClientSocketPool* const http_proxy_pool_; |
| 263 ClientSocketFactory* const client_socket_factory_; | 257 ClientSocketFactory* const client_socket_factory_; |
| 264 HostResolver* const host_resolver_; | 258 HostResolver* const host_resolver_; |
| 265 DnsRRResolver* const dnsrr_resolver_; | 259 DnsRRResolver* dnsrr_resolver_; |
| 266 SSLHostInfoFactory* const ssl_host_info_factory_; | |
| 267 base::TimeDelta timeout_; | 260 base::TimeDelta timeout_; |
| 268 NetLog* net_log_; | 261 NetLog* net_log_; |
| 269 | 262 |
| 270 DISALLOW_COPY_AND_ASSIGN(SSLConnectJobFactory); | 263 DISALLOW_COPY_AND_ASSIGN(SSLConnectJobFactory); |
| 271 }; | 264 }; |
| 272 | 265 |
| 273 TCPClientSocketPool* const tcp_pool_; | 266 TCPClientSocketPool* const tcp_pool_; |
| 274 SOCKSClientSocketPool* const socks_pool_; | 267 SOCKSClientSocketPool* const socks_pool_; |
| 275 HttpProxyClientSocketPool* const http_proxy_pool_; | 268 HttpProxyClientSocketPool* const http_proxy_pool_; |
| 276 PoolBase base_; | 269 PoolBase base_; |
| 277 const scoped_refptr<SSLConfigService> ssl_config_service_; | 270 const scoped_refptr<SSLConfigService> ssl_config_service_; |
| 278 | 271 |
| 279 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool); | 272 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool); |
| 280 }; | 273 }; |
| 281 | 274 |
| 282 REGISTER_SOCKET_PARAMS_FOR_POOL(SSLClientSocketPool, SSLSocketParams); | 275 REGISTER_SOCKET_PARAMS_FOR_POOL(SSLClientSocketPool, SSLSocketParams); |
| 283 | 276 |
| 284 } // namespace net | 277 } // namespace net |
| 285 | 278 |
| 286 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ | 279 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ |
| OLD | NEW |