OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SOCKET_H_ | 5 #ifndef NET_SOCKET_TCP_SOCKET_H_ |
6 #define NET_SOCKET_TCP_SOCKET_H_ | 6 #define NET_SOCKET_TCP_SOCKET_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "net/base/net_export.h" | 9 #include "net/base/net_export.h" |
10 | 10 |
11 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
12 #include "net/socket/tcp_socket_win.h" | 12 #include "net/socket/tcp_socket_win.h" |
13 #elif defined(OS_POSIX) | 13 #elif defined(OS_POSIX) |
14 #include "net/socket/tcp_socket_libevent.h" | 14 #include "net/socket/tcp_socket_posix.h" |
15 #endif | 15 #endif |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 // TCPSocket provides a platform-independent interface for TCP sockets. | 19 // TCPSocket provides a platform-independent interface for TCP sockets. |
20 // | 20 // |
21 // It is recommended to use TCPClientSocket/TCPServerSocket instead of this | 21 // It is recommended to use TCPClientSocket/TCPServerSocket instead of this |
22 // class, unless a clear separation of client and server socket functionality is | 22 // class, unless a clear separation of client and server socket functionality is |
23 // not suitable for your use case (e.g., a socket needs to be created and bound | 23 // not suitable for your use case (e.g., a socket needs to be created and bound |
24 // before you know whether it is a client or server socket). | 24 // before you know whether it is a client or server socket). |
25 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
26 typedef TCPSocketWin TCPSocket; | 26 typedef TCPSocketWin TCPSocket; |
27 #elif defined(OS_POSIX) | 27 #elif defined(OS_POSIX) |
28 typedef TCPSocketLibevent TCPSocket; | 28 typedef TCPSocketPosix TCPSocket; |
29 #endif | 29 #endif |
30 | 30 |
31 // Check if TCP FastOpen is supported by the OS. | 31 // Check if TCP FastOpen is supported by the OS. |
32 bool IsTCPFastOpenSupported(); | 32 bool IsTCPFastOpenSupported(); |
33 | 33 |
34 // Check if TCP FastOpen is enabled by the user. | 34 // Check if TCP FastOpen is enabled by the user. |
35 bool IsTCPFastOpenUserEnabled(); | 35 bool IsTCPFastOpenUserEnabled(); |
36 | 36 |
37 // Checks if TCP FastOpen is supported by the kernel. Also enables TFO for all | 37 // Checks if TCP FastOpen is supported by the kernel. Also enables TFO for all |
38 // connections if indicated by user. | 38 // connections if indicated by user. |
39 // Not thread safe. Must be called during initialization/startup only. | 39 // Not thread safe. Must be called during initialization/startup only. |
40 NET_EXPORT void CheckSupportAndMaybeEnableTCPFastOpen(bool user_enabled); | 40 NET_EXPORT void CheckSupportAndMaybeEnableTCPFastOpen(bool user_enabled); |
41 | 41 |
42 } // namespace net | 42 } // namespace net |
43 | 43 |
44 #endif // NET_SOCKET_TCP_SOCKET_H_ | 44 #endif // NET_SOCKET_TCP_SOCKET_H_ |
OLD | NEW |