• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • Directories
  • File List
  • Globals

tcp_options.h

00001 /* 
00002  * $Id$
00003  * 
00004  * Copyright (C) 2007 iptelorg GmbH
00005  *
00006  * Permission to use, copy, modify, and distribute this software for any
00007  * purpose with or without fee is hereby granted, provided that the above
00008  * copyright notice and this permission notice appear in all copies.
00009  *
00010  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
00011  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
00012  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
00013  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00014  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00015  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
00016  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00017  */
00018 /*
00019  * tcp options
00020  *
00021  * History:
00022  * --------
00023  *  2007-11-28  created by andrei
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 /* enabled async mode */
00033 #endif
00034 
00035 #if !defined(NO_TCP_CONNECT_WAIT) && defined(TCP_ASYNC)
00036 #define TCP_CONNECT_WAIT /* enable pending connects support */
00037 #endif
00038 
00039 #if defined(TCP_CONNECT_WAIT) && !defined(TCP_ASYNC)
00040 /* check for impossible configuration: TCP_CONNECT_WAIT w/o TCP_ASYNC */
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 /* enable fd caching */
00047 #endif
00048 
00049 
00050 
00051 /* defer accept */
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 /* __OS_ */
00058 #endif /* NO_TCP_DEFER_ACCEPT */
00059 
00060 
00061 /* syn count */
00062 #ifndef NO_TCP_SYNCNT
00063 #ifdef __OS_linux
00064 #define HAVE_TCP_SYNCNT
00065 #endif /* __OS_*/
00066 #endif /* NO_TCP_SYNCNT */
00067 
00068 /* tcp linger2 */
00069 #ifndef NO_TCP_LINGER2
00070 #ifdef __OS_linux
00071 #define HAVE_TCP_LINGER2
00072 #endif /* __OS_ */
00073 #endif /* NO_TCP_LINGER2 */
00074 
00075 /* keepalive */
00076 #ifndef NO_TCP_KEEPALIVE
00077 #define HAVE_SO_KEEPALIVE
00078 #endif /* NO_TCP_KEEPALIVE */
00079 
00080 /* keepintvl */
00081 #ifndef NO_TCP_KEEPINTVL
00082 #ifdef __OS_linux
00083 #define HAVE_TCP_KEEPINTVL
00084 #endif /* __OS_ */
00085 #endif /* NO_TCP_KEEPIDLE */
00086 
00087 /* keepidle */
00088 #ifndef NO_TCP_KEEPIDLE
00089 #ifdef __OS_linux
00090 #define HAVE_TCP_KEEPIDLE
00091 #endif /* __OS_*/
00092 #endif /* NO_TCP_KEEPIDLE */
00093 
00094 
00095 /* keepcnt */
00096 #ifndef NO_TCP_KEEPCNT
00097 #ifdef __OS_linux
00098 #define HAVE_TCP_KEEPCNT
00099 #endif /* __OS_ */
00100 #endif /* NO_TCP_KEEPCNT */
00101 
00102 
00103 /* delayed ack (quick_ack) */
00104 #ifndef NO_TCP_QUICKACK
00105 #ifdef __OS_linux
00106 #define HAVE_TCP_QUICKACK
00107 #endif /* __OS_ */
00108 #endif /* NO_TCP_QUICKACK */
00109 
00110 #endif /* USE_TCP */
00111 
00112 struct cfg_group_tcp{
00113         /* ser tcp options, low level */
00114         int connect_timeout_s; /* in s */
00115         int send_timeout; /* in ticks (s fixed to ticks) */
00116         int con_lifetime; /* in ticks (s fixed to ticks) */
00117         int max_connections; /* max tcp connections (includes tls connections) */
00118         int max_tls_connections; /* max tls connections */
00119         int no_connect; /* do not open any new tcp connection (but accept them) */
00120         int fd_cache; /* on /off */
00121         /* tcp async options */
00122         int async; /* on / off */
00123         int tcp_connect_wait; /* on / off, depends on async */
00124         unsigned int tcpconn_wq_max; /* maximum queue len per connection */
00125         unsigned int tcp_wq_max; /* maximum overall queued bytes */
00126 
00127         /* tcp socket options */
00128         int defer_accept; /* on / off */
00129         int delayed_ack; /* delay ack on connect */ 
00130         int syncnt;     /* numbers of SYNs retrs. before giving up connecting */
00131         int linger2;    /* lifetime of orphaned  FIN_WAIT2 state sockets */
00132         int keepalive;  /* on /off */
00133         int keepidle;   /* idle time (s) before tcp starts sending keepalives */
00134         int keepintvl;  /* interval between keep alives */
00135         int keepcnt;    /* maximum no. of keepalives before giving up */
00136         
00137         /* other options */
00138         int crlf_ping;  /* on/off - reply to double CRLF keepalives */
00139         int accept_aliases;
00140         int alias_flags;
00141         int new_conn_alias_flags;
00142         int accept_no_cl;  /* on/off - accpet messages without content-lenght */
00143 
00144         /* internal, "fixed" vars */
00145         unsigned int rd_buf_size; /* read buffer size (should be > max. datagram)*/
00146         unsigned int wq_blk_size; /* async write block size (debugging use) */
00147 };
00148 
00149 extern struct cfg_group_tcp tcp_default_cfg;
00150 
00151 /* tcp config handle*/
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 /* USE_TCP */
00163 
00164 #endif /* tcp_options_h */

Generated on Tue May 22 2012 13:10:17 for SIP Router by  doxygen 1.7.1