2014-11-19 00:25:21 +08:00
|
|
|
|
#ifndef ACL_TCP_CTL_INCLUDE_H
|
|
|
|
|
#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 /**< ȱʡ<C8B1><CAA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С */
|
|
|
|
|
#define ACL_SOCKET_WBUF_SIZE 204800 /**< ȱ<><C8B1>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С */
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> TCP <EFBFBD><EFBFBD><EFBFBD>ֵĶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param size {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD>С
|
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_tcp_set_rcvbuf(ACL_SOCKET fd, int size);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> TCP <EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param size {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD>С
|
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_tcp_set_sndbuf(ACL_SOCKET fd, int size);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD>ȡ TCP <EFBFBD><EFBFBD><EFBFBD>ֵĶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_tcp_get_rcvbuf(ACL_SOCKET fd);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD>ȡ TCP <EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_tcp_get_sndbuf(ACL_SOCKET fd);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> TCP <EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD> nodelay <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_tcp_set_nodelay(ACL_SOCKET fd);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> TCP <EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD> nodelay <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param onoff {int} 1 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>0 <EFBFBD><EFBFBD>ʾ<EFBFBD>ر<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_tcp_nodelay(ACL_SOCKET fd, int onoff);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> TCP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> nodelay ѡ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {int} 1 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>0 <EFBFBD><EFBFBD>ʾ<EFBFBD>ر<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_get_tcp_nodelay(ACL_SOCKET fd);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> TCP <EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD> SO_LINGER ѡ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param onoff {int} <EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SO_LINGER ѡ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param timeout {int} <EFBFBD><EFBFBD>SO_LINGER<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD> timed_wait <EFBFBD><EFBFBD>ʱ<EFBFBD>䣬<EFBFBD><EFBFBD>λΪ<EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_tcp_so_linger(ACL_SOCKET fd, int onoff, int timeout);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> TCP <EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD> linger ֵ
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2016-02-25 19:57:02 +08:00
|
|
|
|
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> -1 <EFBFBD><EFBFBD>ʾδ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> linger ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>= 0 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* linger ѡ<EFBFBD><EFBFBD><EFBFBD>Ҹ<EFBFBD>ֵ<EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD>ֹرպ<EFBFBD><EFBFBD><EFBFBD> TCP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ں<EFBFBD><EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD> TIME_WAIT ״̬
|
|
|
|
|
* <EFBFBD>Ķ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD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EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_tcp_defer_accept(ACL_SOCKET fd, int timeout);
|
|
|
|
|
|
2016-02-25 19:57:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵĿ<EFBFBD><EFBFBD>ٽ<EFBFBD><EFBFBD><EFBFBD> TCP <EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>Ҫ<EFBFBD>ں<EFBFBD>֧<EFBFBD><EFBFBD>)
|
|
|
|
|
* @param fd {ACL_SOCKET}
|
|
|
|
|
* @param on {int} <EFBFBD><EFBFBD> 0 ʱ<EFBFBD>˹<EFBFBD><EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>رմ˹<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_tcp_fastopen(ACL_SOCKET fd, int on);
|
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|