acl/lib_acl/include/net/acl_tcp_ctl.h

100 lines
2.9 KiB
C
Raw Normal View History

#ifndef ACL_TCP_CTL_INCLUDE_H
2014-11-19 00:25:21 +08:00
#define ACL_TCP_CTL_INCLUDE_H
#ifdef __cplusplus
extern "C" {
#endif
2017-06-02 14:47:24 +08:00
#include "../stdlib/acl_define.h"
2014-11-19 00:25:21 +08:00
#define ACL_SOCKET_RBUF_SIZE 204800 /**< 缺省读缓冲区大小 */
#define ACL_SOCKET_WBUF_SIZE 204800 /**< 缺少写缓冲区大小 */
2014-11-19 00:25:21 +08:00
/**
* TCP
* @param fd {ACL_SOCKET}
* @param size {int}
2014-11-19 00:25:21 +08:00
*/
ACL_API void acl_tcp_set_rcvbuf(ACL_SOCKET fd, int size);
/**
* TCP
* @param fd {ACL_SOCKET}
* @param size {int}
2014-11-19 00:25:21 +08:00
*/
ACL_API void acl_tcp_set_sndbuf(ACL_SOCKET fd, int size);
/**
* TCP
* @param fd {ACL_SOCKET}
* @return {int}
2014-11-19 00:25:21 +08:00
*/
ACL_API int acl_tcp_get_rcvbuf(ACL_SOCKET fd);
/**
* TCP
* @param fd {ACL_SOCKET}
* @return {int}
2014-11-19 00:25:21 +08:00
*/
ACL_API int acl_tcp_get_sndbuf(ACL_SOCKET fd);
/**
* TCP nodelay
* @param fd {ACL_SOCKET}
2014-11-19 00:25:21 +08:00
*/
ACL_API void acl_tcp_set_nodelay(ACL_SOCKET fd);
/**
* TCP nodelay
* @param fd {ACL_SOCKET}
* @param onoff {int} 1 0
2014-11-19 00:25:21 +08:00
*/
ACL_API void acl_tcp_nodelay(ACL_SOCKET fd, int onoff);
/**
* TCP nodelay
* @param fd {ACL_SOCKET}
* @return {int} 1 0
2014-11-19 00:25:21 +08:00
*/
ACL_API int acl_get_tcp_nodelay(ACL_SOCKET fd);
/**
* TCP SO_LINGER
* @param fd {ACL_SOCKET}
* @param onoff {int} SO_LINGER
* @param timeout {int} SO_LINGER打开时 timed_wait
2014-11-19 00:25:21 +08:00
*/
ACL_API void acl_tcp_so_linger(ACL_SOCKET fd, int onoff, int timeout);
/**
* TCP linger
* @param fd {ACL_SOCKET}
* @return {int} -1 linger >= 0
* linger TCP TIME_WAIT
* ()
2014-11-19 00:25:21 +08:00
*/
ACL_API int acl_get_tcp_solinger(ACL_SOCKET fd);
/**
*
* Linux
* @param fd {ACL_SOCKET}
* @param timeout {int}
*
2014-11-19 00:25:21 +08:00
*/
ACL_API void acl_tcp_defer_accept(ACL_SOCKET fd, int timeout);
/**
* TCP ()
* @param fd {ACL_SOCKET}
* @param on {int} 0
*/
ACL_API void acl_tcp_fastopen(ACL_SOCKET fd, int on);
2014-11-19 00:25:21 +08:00
#ifdef __cplusplus
}
#endif
#endif