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_STREAM_SOCKET_STREAM_H_ | 5 #ifndef NET_SOCKET_STREAM_SOCKET_STREAM_H_ |
6 #define NET_SOCKET_STREAM_SOCKET_STREAM_H_ | 6 #define NET_SOCKET_STREAM_SOCKET_STREAM_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <map> | 10 #include <map> |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 STATE_RESOLVE_PROTOCOL, | 221 STATE_RESOLVE_PROTOCOL, |
222 STATE_RESOLVE_PROTOCOL_COMPLETE, | 222 STATE_RESOLVE_PROTOCOL_COMPLETE, |
223 STATE_TCP_CONNECT, | 223 STATE_TCP_CONNECT, |
224 STATE_TCP_CONNECT_COMPLETE, | 224 STATE_TCP_CONNECT_COMPLETE, |
225 STATE_WRITE_TUNNEL_HEADERS, | 225 STATE_WRITE_TUNNEL_HEADERS, |
226 STATE_WRITE_TUNNEL_HEADERS_COMPLETE, | 226 STATE_WRITE_TUNNEL_HEADERS_COMPLETE, |
227 STATE_READ_TUNNEL_HEADERS, | 227 STATE_READ_TUNNEL_HEADERS, |
228 STATE_READ_TUNNEL_HEADERS_COMPLETE, | 228 STATE_READ_TUNNEL_HEADERS_COMPLETE, |
229 STATE_SOCKS_CONNECT, | 229 STATE_SOCKS_CONNECT, |
230 STATE_SOCKS_CONNECT_COMPLETE, | 230 STATE_SOCKS_CONNECT_COMPLETE, |
231 STATE_SECURE_PROXY_CONNECT, | |
232 STATE_SECURE_PROXY_CONNECT_COMPLETE, | |
233 STATE_SSL_CONNECT, | 231 STATE_SSL_CONNECT, |
234 STATE_SSL_CONNECT_COMPLETE, | 232 STATE_SSL_CONNECT_COMPLETE, |
235 STATE_READ_WRITE, | 233 STATE_READ_WRITE, |
236 STATE_AUTH_REQUIRED, | 234 STATE_AUTH_REQUIRED, |
237 STATE_CLOSE, | 235 STATE_CLOSE, |
238 }; | 236 }; |
239 | 237 |
240 enum ProxyMode { | 238 enum ProxyMode { |
241 kDirectConnection, // If using a direct connection | 239 kDirectConnection, // If using a direct connection |
242 kTunnelProxy, // If using a tunnel (CONNECT method as HTTPS) | 240 kTunnelProxy, // If using a tunnel (CONNECT method as HTTPS) |
243 kSOCKSProxy, // If using a SOCKS proxy | 241 kSOCKSProxy, // If using a SOCKS proxy |
244 }; | 242 }; |
245 | 243 |
246 // Use the same number as HttpNetworkTransaction::kMaxHeaderBufSize. | 244 // Use the same number as HttpNetworkTransaction::kMaxHeaderBufSize. |
247 enum { kMaxTunnelResponseHeadersSize = 32768 }; // 32 kilobytes. | 245 enum { kMaxTunnelResponseHeadersSize = 32768 }; // 32 kilobytes. |
248 | 246 |
249 // Copies the given addrinfo list in |addresses_|. | 247 // Copies the given addrinfo list in |addresses_|. |
250 // Used for WebSocketThrottleTest. | 248 // Used for WebSocketThrottleTest. |
251 void CopyAddrInfo(struct addrinfo* head); | 249 void CopyAddrInfo(struct addrinfo* head); |
252 | 250 |
253 void DoClose(); | 251 void DoClose(); |
254 | 252 |
255 // Finishes the job. | 253 // Finishes the job. |
256 // Calls OnError and OnClose of delegate, and no more | 254 // Calls OnError and OnClose of delegate, and no more |
257 // notifications will be sent to delegate. | 255 // notifications will be sent to delegate. |
258 void Finish(int result); | 256 void Finish(int result); |
259 | 257 |
260 int DidEstablishSSL(int result); | |
261 int DidEstablishConnection(); | 258 int DidEstablishConnection(); |
262 int DidReceiveData(int result); | 259 int DidReceiveData(int result); |
263 int DidSendData(int result); | 260 int DidSendData(int result); |
264 | 261 |
265 void OnIOCompleted(int result); | 262 void OnIOCompleted(int result); |
266 void OnReadCompleted(int result); | 263 void OnReadCompleted(int result); |
267 void OnWriteCompleted(int result); | 264 void OnWriteCompleted(int result); |
268 | 265 |
269 void DoLoop(int result); | 266 void DoLoop(int result); |
270 | 267 |
271 int DoResolveProxy(); | 268 int DoResolveProxy(); |
272 int DoResolveProxyComplete(int result); | 269 int DoResolveProxyComplete(int result); |
273 int DoResolveHost(); | 270 int DoResolveHost(); |
274 int DoResolveHostComplete(int result); | 271 int DoResolveHostComplete(int result); |
275 int DoResolveProtocol(int result); | 272 int DoResolveProtocol(int result); |
276 int DoResolveProtocolComplete(int result); | 273 int DoResolveProtocolComplete(int result); |
277 int DoTcpConnect(int result); | 274 int DoTcpConnect(int result); |
278 int DoTcpConnectComplete(int result); | 275 int DoTcpConnectComplete(int result); |
279 int DoWriteTunnelHeaders(); | 276 int DoWriteTunnelHeaders(); |
280 int DoWriteTunnelHeadersComplete(int result); | 277 int DoWriteTunnelHeadersComplete(int result); |
281 int DoReadTunnelHeaders(); | 278 int DoReadTunnelHeaders(); |
282 int DoReadTunnelHeadersComplete(int result); | 279 int DoReadTunnelHeadersComplete(int result); |
283 int DoSOCKSConnect(); | 280 int DoSOCKSConnect(); |
284 int DoSOCKSConnectComplete(int result); | 281 int DoSOCKSConnectComplete(int result); |
285 int DoSecureProxyConnect(); | |
286 int DoSecureProxyConnectComplete(int result); | |
287 int DoSSLConnect(); | 282 int DoSSLConnect(); |
288 int DoSSLConnectComplete(int result); | 283 int DoSSLConnectComplete(int result); |
289 int DoReadWrite(int result); | 284 int DoReadWrite(int result); |
290 | 285 |
291 GURL ProxyAuthOrigin() const; | 286 GURL ProxyAuthOrigin() const; |
292 int HandleAuthChallenge(const HttpResponseHeaders* headers); | 287 int HandleAuthChallenge(const HttpResponseHeaders* headers); |
293 void DoAuthRequired(); | 288 void DoAuthRequired(); |
294 void DoRestartWithAuth(); | 289 void DoRestartWithAuth(); |
295 | 290 |
296 int HandleCertificateError(int result); | 291 int HandleCertificateError(int result); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 bool server_closed_; | 354 bool server_closed_; |
360 | 355 |
361 scoped_ptr<SocketStreamMetrics> metrics_; | 356 scoped_ptr<SocketStreamMetrics> metrics_; |
362 | 357 |
363 DISALLOW_COPY_AND_ASSIGN(SocketStream); | 358 DISALLOW_COPY_AND_ASSIGN(SocketStream); |
364 }; | 359 }; |
365 | 360 |
366 } // namespace net | 361 } // namespace net |
367 | 362 |
368 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_H_ | 363 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_H_ |
OLD | NEW |