00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef tcp_options_h
00027 #define tcp_options_h
00028
00029 #ifdef USE_TCP
00030
00031 #ifndef NO_TCP_ASYNC
00032 #define TCP_ASYNC
00033 #endif
00034
00035 #if !defined(NO_TCP_CONNECT_WAIT) && defined(TCP_ASYNC)
00036 #define TCP_CONNECT_WAIT
00037 #endif
00038
00039 #if defined(TCP_CONNECT_WAIT) && !defined(TCP_ASYNC)
00040
00041 #warning "disabling TCP_CONNECT_WAIT because TCP_ASYNC is not defined"
00042 #undef TCP_CONNECT_WAIT
00043 #endif
00044
00045 #ifndef NO_TCP_FD_CACHE
00046 #define TCP_FD_CACHE
00047 #endif
00048
00049
00050
00051
00052 #ifndef NO_TCP_DEFER_ACCEPT
00053 #ifdef __OS_linux
00054 #define HAVE_TCP_DEFER_ACCEPT
00055 #elif defined __OS_freebsd
00056 #define HAVE_TCP_ACCEPT_FILTER
00057 #endif
00058 #endif
00059
00060
00061
00062 #ifndef NO_TCP_SYNCNT
00063 #ifdef __OS_linux
00064 #define HAVE_TCP_SYNCNT
00065 #endif
00066 #endif
00067
00068
00069 #ifndef NO_TCP_LINGER2
00070 #ifdef __OS_linux
00071 #define HAVE_TCP_LINGER2
00072 #endif
00073 #endif
00074
00075
00076 #ifndef NO_TCP_KEEPALIVE
00077 #define HAVE_SO_KEEPALIVE
00078 #endif
00079
00080
00081 #ifndef NO_TCP_KEEPINTVL
00082 #ifdef __OS_linux
00083 #define HAVE_TCP_KEEPINTVL
00084 #endif
00085 #endif
00086
00087
00088 #ifndef NO_TCP_KEEPIDLE
00089 #ifdef __OS_linux
00090 #define HAVE_TCP_KEEPIDLE
00091 #endif
00092 #endif
00093
00094
00095
00096 #ifndef NO_TCP_KEEPCNT
00097 #ifdef __OS_linux
00098 #define HAVE_TCP_KEEPCNT
00099 #endif
00100 #endif
00101
00102
00103
00104 #ifndef NO_TCP_QUICKACK
00105 #ifdef __OS_linux
00106 #define HAVE_TCP_QUICKACK
00107 #endif
00108 #endif
00109
00110 #endif
00111
00112 struct cfg_group_tcp{
00113
00114 int connect_timeout_s;
00115 int send_timeout;
00116 int con_lifetime;
00117 int max_connections;
00118 int max_tls_connections;
00119 int no_connect;
00120 int fd_cache;
00121
00122 int async;
00123 int tcp_connect_wait;
00124 unsigned int tcpconn_wq_max;
00125 unsigned int tcp_wq_max;
00126
00127
00128 int defer_accept;
00129 int delayed_ack;
00130 int syncnt;
00131 int linger2;
00132 int keepalive;
00133 int keepidle;
00134 int keepintvl;
00135 int keepcnt;
00136
00137
00138 int crlf_ping;
00139 int accept_aliases;
00140 int alias_flags;
00141 int new_conn_alias_flags;
00142 int accept_no_cl;
00143
00144
00145 unsigned int rd_buf_size;
00146 unsigned int wq_blk_size;
00147 };
00148
00149 extern struct cfg_group_tcp tcp_default_cfg;
00150
00151
00152 extern void* tcp_cfg;
00153
00154
00155 void init_tcp_options(void);
00156 void tcp_options_check(void);
00157 int tcp_register_cfg(void);
00158 void tcp_options_get(struct cfg_group_tcp* t);
00159
00160 #ifdef USE_TCP
00161 int tcp_set_clone_rcvbuf(int v);
00162 #endif
00163
00164 #endif