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_TCP_CLIENT_SOCKET_H_ | 5 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_H_ |
6 #define NET_SOCKET_TCP_CLIENT_SOCKET_H_ | 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_H_ |
7 | 7 |
8 #include "build/build_config.h" | |
9 #include "net/base/net_export.h" | |
10 | |
11 // TODO(yzshen): Switch OS_POSIX to use the same platform-independent | |
12 // TCPClientSocket. | |
13 #if defined(OS_POSIX) | |
14 | |
15 #include "net/socket/tcp_client_socket_libevent.h" | |
16 | |
17 #elif defined(OS_WIN) | |
18 | |
19 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
20 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
21 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
22 #include "net/base/address_list.h" | 11 #include "net/base/address_list.h" |
23 #include "net/base/completion_callback.h" | 12 #include "net/base/completion_callback.h" |
| 13 #include "net/base/net_export.h" |
24 #include "net/base/net_log.h" | 14 #include "net/base/net_log.h" |
25 #include "net/socket/stream_socket.h" | 15 #include "net/socket/stream_socket.h" |
26 #include "net/socket/tcp_socket.h" | 16 #include "net/socket/tcp_socket.h" |
27 | 17 |
28 #endif | |
29 | |
30 namespace net { | 18 namespace net { |
31 | 19 |
32 // Enable/disable experimental TCP FastOpen option. | |
33 // Not thread safe. Must be called during initialization/startup only. | |
34 NET_EXPORT void SetTCPFastOpenEnabled(bool value); | |
35 | |
36 // Check if the TCP FastOpen option is enabled. | |
37 bool IsTCPFastOpenEnabled(); | |
38 | |
39 // A client socket that uses TCP as the transport layer. | 20 // A client socket that uses TCP as the transport layer. |
40 #if defined(OS_POSIX) | |
41 typedef TCPClientSocketLibevent TCPClientSocket; | |
42 #elif defined(OS_WIN) | |
43 | |
44 class NET_EXPORT TCPClientSocket : public StreamSocket { | 21 class NET_EXPORT TCPClientSocket : public StreamSocket { |
45 public: | 22 public: |
46 // The IP address(es) and port number to connect to. The TCP socket will try | 23 // The IP address(es) and port number to connect to. The TCP socket will try |
47 // each IP address in the list until it succeeds in establishing a | 24 // each IP address in the list until it succeeds in establishing a |
48 // connection. | 25 // connection. |
49 TCPClientSocket(const AddressList& addresses, | 26 TCPClientSocket(const AddressList& addresses, |
50 net::NetLog* net_log, | 27 net::NetLog* net_log, |
51 const net::NetLog::Source& source); | 28 const net::NetLog::Source& source); |
52 | 29 |
53 // Adopts the given, connected socket and then acts as if Connect() had been | 30 // Adopts the given, connected socket and then acts as if Connect() had been |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // This socket was previously disconnected and has not been re-connected. | 109 // This socket was previously disconnected and has not been re-connected. |
133 bool previously_disconnected_; | 110 bool previously_disconnected_; |
134 | 111 |
135 // Record of connectivity and transmissions, for use in speculative connection | 112 // Record of connectivity and transmissions, for use in speculative connection |
136 // histograms. | 113 // histograms. |
137 UseHistory use_history_; | 114 UseHistory use_history_; |
138 | 115 |
139 DISALLOW_COPY_AND_ASSIGN(TCPClientSocket); | 116 DISALLOW_COPY_AND_ASSIGN(TCPClientSocket); |
140 }; | 117 }; |
141 | 118 |
142 #endif | |
143 | |
144 } // namespace net | 119 } // namespace net |
145 | 120 |
146 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_H_ | 121 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_H_ |
OLD | NEW |