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

tcp_init.h

00001 /*
00002  * $Id$
00003  *
00004  * Copyright (C) 2001-2003 FhG Fokus
00005  *
00006  * This file is part of ser, a free SIP server.
00007  *
00008  * ser is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version
00012  *
00013  * For a license to use the ser software under conditions
00014  * other than those described here, or to purchase support for this
00015  * software, please contact iptel.org by e-mail at the following addresses:
00016  *    info@iptel.org
00017  *
00018  * ser is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License 
00024  * along with this program; if not, write to the Free Software 
00025  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  */
00027 
00028 #ifndef tcp_init_h
00029 #define tcp_init_h
00030 #include "ip_addr.h"
00031 
00032 #define DEFAULT_TCP_CONNECTION_LIFETIME_S 120 /* in  seconds */
00033 /* maximum accepted lifetime in ticks (maximum possible is  ~ MAXINT/2) */
00034 #define MAX_TCP_CON_LIFETIME    ((1U<<(sizeof(ticks_t)*8-1))-1)
00035 
00036 #define DEFAULT_TCP_SEND_TIMEOUT 10 /* if a send can't write for more then 10s,
00037                                                                            timeout */
00038 #define DEFAULT_TCP_CONNECT_TIMEOUT 10 /* if a connect doesn't complete in this
00039                                                                                   time, timeout */
00040 #define DEFAULT_TCP_MAX_CONNECTIONS 2048 /* maximum tcp connections */
00041 
00042 #define DEFAULT_TLS_MAX_CONNECTIONS 2048 /* maximum tls connections */
00043 
00044 #define DEFAULT_TCP_BUF_SIZE    4096  /* buffer size used for reads */
00045 
00046 #define DEFAULT_TCP_WBUF_SIZE   2100 /*  after debugging switch to 4-16k */
00047 
00048 struct tcp_child{
00049         pid_t pid;
00050         int proc_no; /* ser proc_no, for debugging */
00051         int unix_sock; /* unix "read child" sock fd */
00052         int busy;
00053         struct socket_info *mysocket; /* listen socket to handle traffic on it */
00054         int n_reqs; /* number of requests serviced so far */
00055 };
00056 
00057 #define TCP_ALIAS_FORCE_ADD 1
00058 #define TCP_ALIAS_REPLACE   2
00059 
00060 
00061 int init_tcp(void);
00062 void destroy_tcp(void);
00063 int tcp_init(struct socket_info* sock_info);
00064 int tcp_init_children(void);
00065 void tcp_main_loop(void);
00066 void tcp_receive_loop(int unix_sock);
00067 int tcp_fix_child_sockets(int* fd);
00068 
00069 /* sets source address used when opening new sockets and no source is specified
00070  *  (by default the address is choosen by the kernel)
00071  * Should be used only on init.
00072  * returns -1 on error */
00073 int tcp_set_src_addr(struct ip_addr* ip);
00074 
00075 #endif

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