Browse code

- added disable tcp support (-T or disable_tcp=yes in the cfg) - the number of tcp "worker" processes is now setable (-N or tcp_children=NN) - replaced get_out_socket w/ get_send_socket in tm/uac.c & fixed some proto stuff (proto was not set properly when called w/ PROTO_NONE) - updated man pages & INSTALL

Andrei Pelinescu-Onciul authored on 15/04/2003 20:39:37
Showing 15 changed files
... ...
@@ -42,7 +42,7 @@ TOC
42 42
 -------------------------------------------
43 43
 
44 44
 Supported arhitectures: Linux/i386, Linux/armv4l, FreeBSD/i386, OpenBSD/i386
45
-Solaris/sparc64 
45
+Solaris/sparc64, NetBSD/sparc64
46 46
 (for other arhitectures the Makefiles might need to be edited)
47 47
 
48 48
 There are various configuration options defined in the Makefile.
... ...
@@ -66,7 +66,7 @@ Requirements:
66 66
 
67 67
 OS Notes:
68 68
 
69
-- FreeBSD/OpenBSD: make sure gmake, bison or yacc & flex are installed
69
+- FreeBSD/OpenBSD/NetBSD: make sure gmake, bison or yacc & flex are installed
70 70
 - Solaris: as above; you can use Solaris's yacc instead of bison. You might
71 71
   need also gtar and ginstall.
72 72
 - Windows: it works in windows (only the core, w/o shared mem. support) but you
... ...
@@ -220,6 +220,8 @@ tar.gz:
220 220
      /usr/local/etc/ser/ser.cfg)
221 221
 Solaris:
222 222
     gunzip <package_name>.gz ; pkgadd -d <package_name>
223
+*BSD:
224
+    pkg_add package_name
223 225
     
224 226
 3) start the server
225 227
 RPM:
... ...
@@ -21,7 +21,7 @@
21 21
 VERSION = 0
22 22
 PATCHLEVEL = 8
23 23
 SUBLEVEL =   11
24
-EXTRAVERSION = pre19
24
+EXTRAVERSION = pre20
25 25
 
26 26
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
27 27
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
... ...
@@ -3,6 +3,7 @@ $Id$
3 3
 ( - todo, x - done)
4 4
 
5 5
 release:
6
+- fix -march=..., or compile w/ i386 for the release
6 7
 x resolver should resolve [ipv6]
7 8
 - remove parse_uri debugging info
8 9
 - fix DBG("<%.*s>", len, _null_)
... ...
@@ -99,6 +100,7 @@ optimizations:
99 99
 
100 100
 
101 101
 tcp stuff:
102
+- timeout on long sends
102 103
 x tcp disable nagle 
103 104
 x set TOS to minimize delay
104 105
 - tcp locking/atomic ops review
... ...
@@ -110,5 +112,6 @@ tm optimizations:
110 110
 - replace snprintfs int build_uac_request, *_dlg
111 111
 - fix the huge param no. in this functions (use structs if neccessary):
112 112
   build_uac_request, build_uac_request_dlg, t_uac, t_uac_dlg
113
+- uri2proxy - t_uac_dlg => extra malloc/free (no �roxy needed here)
113 114
   
114 115
 
... ...
@@ -155,6 +155,8 @@ GROUP		"group"|"gid"
155 155
 CHROOT		"chroot"
156 156
 WDIR		"workdir"|"wdir"
157 157
 MHOMED		mhomed
158
+DISABLE_TCP		"disable_tcp"
159
+TCP_CHILDREN	"tcp_children"
158 160
 
159 161
 LOADMODULE	loadmodule
160 162
 MODPARAM        modparam
... ...
@@ -272,6 +274,8 @@ EAT_ABLE	[\ \t\b\r]
272 272
 <INITIAL>{CHROOT}	{ count(); yylval.strval=yytext; return CHROOT; }
273 273
 <INITIAL>{WDIR}	{ count(); yylval.strval=yytext; return WDIR; }
274 274
 <INITIAL>{MHOMED}	{ count(); yylval.strval=yytext; return MHOMED; }
275
+<INITIAL>{DISABLE_TCP}	{ count(); yylval.strval=yytext; return DISABLE_TCP; }
276
+<INITIAL>{TCP_CHILDREN}	{ count(); yylval.strval=yytext; return TCP_CHILDREN; }
275 277
 <INITIAL>{FIFO}	{ count(); yylval.strval=yytext; return FIFO; }
276 278
 <INITIAL>{FIFO_MODE}	{ count(); yylval.strval=yytext; return FIFO_MODE; }
277 279
 <INITIAL>{SERVER_SIGNATURE}	{ count(); yylval.strval=yytext; return SERVER_SIGNATURE; }
... ...
@@ -37,6 +37,7 @@
37 37
  * 2003-04-01  added dst_port, proto , af (andrei)
38 38
  * 2003-04-05  s/reply_route/failure_route, onreply_route introduced (jiri)
39 39
  * 2003-04-12  added force_rport, chroot and wdir (andrei)
40
+ * 2003-04-15  added tcp_children, disable_tcp (andrei)
40 41
  */
41 42
 
42 43
 
... ...
@@ -168,6 +169,9 @@ int rt;  /* Type of route block for find_export */
168 168
 %token CHROOT
169 169
 %token WDIR
170 170
 %token MHOMED
171
+%token DISABLE_TCP
172
+%token TCP_CHILDREN
173
+
171 174
 
172 175
 
173 176
 
... ...
@@ -344,6 +348,24 @@ assign_stm:	DEBUG EQUAL NUMBER { debug=$3; }
344 344
 		| WDIR EQUAL error      { yyerror("string value expected"); }
345 345
 		| MHOMED EQUAL NUMBER { mhomed=$3; }
346 346
 		| MHOMED EQUAL error { yyerror("boolean value expected"); }
347
+		| DISABLE_TCP EQUAL NUMBER {
348
+									#ifdef USE_TCP
349
+										tcp_disable=$3;
350
+									#else
351
+										fprintf(stderr, "WARNING: tcp support"
352
+												"not compiled in\n");
353
+									#endif
354
+									}
355
+		| DISABLE_TCP EQUAL error { yyerror("boolean value expected"); }
356
+		| TCP_CHILDREN EQUAL NUMBER {
357
+									#ifdef USE_TCP
358
+										tcp_children_no=$3;
359
+									#else
360
+										fprintf(stderr, "WARNING: tcp support"
361
+												"not compiled in\n");
362
+									#endif
363
+									}
364
+		| TCP_CHILDREN EQUAL error { yyerror("number expected"); }
347 365
 		| SERVER_SIGNATURE EQUAL NUMBER { server_signature=$3; }
348 366
 		| SERVER_SIGNATURE EQUAL error { yyerror("boolean value expected"); }
349 367
 		| REPLY_TO_VIA EQUAL NUMBER { reply_to_via=$3; }
... ...
@@ -289,8 +289,8 @@ int forward_request( struct sip_msg* msg, struct proxy_l * p, int proto)
289 289
 
290 290
 	send_sock=get_send_socket(to, proto);
291 291
 	if (send_sock==0){
292
-		LOG(L_ERR, "forward_req: ERROR: cannot forward to af %d "
293
-				"no coresponding listening socket\n", to->s.sa_family);
292
+		LOG(L_ERR, "forward_req: ERROR: cannot forward to af %d, proto %d "
293
+				"no coresponding listening socket\n", to->s.sa_family, proto);
294 294
 		ser_error=E_NO_SOCKET;
295 295
 		goto error1;
296 296
 	}
... ...
@@ -32,6 +32,7 @@
32 32
  *  2003-02-11 added inline msg_send (andrei)
33 33
  *  2003-04-07 changed all ports to host byte order (andrei)
34 34
  *  2003-04-12  FORCE_RPORT_T added (andrei)
35
+ *  2003-04-15  added tcp_disable support (andrei)
35 36
  */
36 37
 
37 38
 
... ...
@@ -39,6 +40,7 @@
39 39
 #ifndef forward_h
40 40
 #define forward_h
41 41
 
42
+#include "globals.h"
42 43
 #include "parser/msg_parser.h"
43 44
 #include "route.h"
44 45
 #include "proxy.h"
... ...
@@ -98,10 +100,17 @@ static inline int msg_send(	struct socket_info* send_sock, int proto,
98 98
 	}
99 99
 #ifdef USE_TCP
100 100
 	else if (proto==PROTO_TCP){
101
-		if (tcp_send(buf, len, to, id)<0){
101
+		if (tcp_disable){
102 102
 			STATS_TX_DROPS;
103
-			LOG(L_ERR, "msg_send: ERROR: tcp_send failed\n");
103
+			LOG(L_WARN, "msg_send: WARNING: attempt to send on tcp and tcp"
104
+					" support is disabled\n");
104 105
 			goto error;
106
+		}else{
107
+			if (tcp_send(buf, len, to, id)<0){
108
+				STATS_TX_DROPS;
109
+				LOG(L_ERR, "msg_send: ERROR: tcp_send failed\n");
110
+				goto error;
111
+			}
105 112
 		}
106 113
 	}
107 114
 #endif
... ...
@@ -67,6 +67,7 @@ extern unsigned int maxbuffer;
67 67
 extern int children_no;
68 68
 #ifdef USE_TCP
69 69
 extern int tcp_children_no;
70
+extern int tcp_disable;
70 71
 #endif
71 72
 extern int dont_fork;
72 73
 extern int check_via;
... ...
@@ -34,6 +34,7 @@
34 34
  *  2003-04-06  child_init called in all processes (janakj)
35 35
  *  2003-04-08  init_mallocs split into init_{pkg,shm}_mallocs and 
36 36
  *               init_shm_mallocs called after cmd. line parsing (andrei)
37
+ *  2003-04-15  added tcp_disable support (andrei)
37 38
  *
38 39
  */
39 40
 
... ...
@@ -180,35 +181,36 @@ Usage: " NAME " -l address [-p port] [-l address [-p port]...] [options]\n\
180 180
 Options:\n\
181 181
     -f file      Configuration file (default " CFG_FILE ")\n\
182 182
     -p port      Listen on the specified port (default: 5060)\n\
183
-                 applies to the last address in -l and to all \n\
184
-                 following that do not have a corespponding -p\n\
185
-    -l address   Listen on the specified address (multiple -l mean\n\
186
-                 listening on more addresses). The default behaviour\n\
187
-                 is to listen on the addresses returned by uname(2)\n\
188
-\n\
183
+                  applies to the last address in -l and to all \n\
184
+                  following that do not have a corespponding -p\n\
185
+    -l address   Listen on the specified address/interface (multiple -l\n\
186
+                  mean listening on more addresses). The default behaviour\n\
187
+                  is to listen on all the interfaces\n\
189 188
     -n processes Number of child processes to fork per interface\n\
190
-                 (default: 8)\n\
191
-\n\
189
+                  (default: 8)\n\
192 190
     -r           Use dns to check if is necessary to add a \"received=\"\n\
193
-                 field to a via\n\
191
+                  field to a via\n\
194 192
     -R           Same as `-r` but use reverse dns;\n\
195
-                 (to use both use `-rR`)\n\
196
-\n\
193
+                  (to use both use `-rR`)\n\
197 194
     -v           Turn on \"via:\" host checking when forwarding replies\n\
198 195
     -d           Debugging mode (multiple -d increase the level)\n\
199 196
     -D           Do not fork into daemon mode\n\
200
-    -E           Log to stderr\n\
201
-    -V           Version number\n\
197
+    -E           Log to stderr\n"
198
+#ifdef USE_TCP
199
+"    -T           Disable tcp\n\
200
+    -N           Number of tcp child processes (default: equal to `-n`)\n"
201
+#endif
202
+"    -V           Version number\n\
202 203
     -h           This help message\n\
203 204
     -b nr        Maximum receive buffer size which will not be exceeded by\n\
204
-                 auto-probing procedure even if  OS allows\n\
205
+                  auto-probing procedure even if  OS allows\n\
205 206
     -m nr        Size of shared memory allocated in Megabytes\n\
206
-    -w  dir      change the working directory to \"dir\" (default \"/\")\n\
207
-    -t  dir      chroot to \"dir\"\n\
208
-    -u uid       change uid \n\
209
-    -g gid       change gid \n\
210
-    -P file      create a pid file\n\
211
-    -i fifo_path create a fifo (usefull for monitoring " NAME ") \n"
207
+    -w  dir      Change the working directory to \"dir\" (default \"/\")\n\
208
+    -t  dir      Chroot to \"dir\"\n\
209
+    -u uid       Change uid \n\
210
+    -g gid       Change gid \n\
211
+    -P file      Create a pid file\n\
212
+    -i fifo_path Create a fifo (usefull for monitoring " NAME ") \n"
212 213
 #ifdef STATS
213 214
 "    -s file     File to which statistics is dumped (disabled otherwise)\n"
214 215
 #endif
... ...
@@ -258,6 +260,7 @@ unsigned int maxbuffer = MAX_RECV_BUFFER_SIZE; /* maximum buffer size we do
258 258
 int children_no = 0;			/* number of children processing requests */
259 259
 #ifdef USE_TCP
260 260
 int tcp_children_no = 0;
261
+int tcp_disable = 0; /* 1 if tcp is disabled */
261 262
 #endif
262 263
 struct process_table *pt=0;		/*array with childrens pids, 0= main proc,
263 264
 									alloc'ed in shared mem if possible*/
... ...
@@ -518,10 +521,6 @@ void handle_sigs()
518 518
 			/* we end the program in all these cases */
519 519
 			if (sig_flag==SIGINT)
520 520
 				DBG("INT received, program terminates\n");
521
-#ifdef OBSOLETED
522
-			else if (sig_flag==SIGPIPE) 
523
-				DBG("SIGPIPE received, program terminates\n");
524
-#endif
525 521
 			else
526 522
 				DBG("SIGTERM received, program terminates\n");
527 523
 				
... ...
@@ -627,11 +626,13 @@ int main_loop()
627 627
 		*/
628 628
 
629 629
 		/* we need another process to act as the timer*/
630
-#ifndef USE_TCP
630
+#ifdef USE_TCP
631 631
 		/* if we are using tcp we always need a timer process,
632 632
 		 * we cannot count on select timeout to measure time
633 633
 		 * (it works only on linux)
634 634
 		 */
635
+		if ((!tcp_disable)||(timer_list))
636
+#else
635 637
 		if (timer_list)
636 638
 #endif
637 639
 		{
... ...
@@ -703,17 +704,19 @@ int main_loop()
703 703
 				sendipv6=&sock_info[r];
704 704
 	#endif
705 705
 #ifdef USE_TCP
706
-			tcp_info[r]=sock_info[r]; /* copy the sockets */
707
-			/* same thing for tcp */
708
-			if (tcp_init(&tcp_info[r])==-1)  goto error;
709
-			/* get first ipv4/ipv6 socket*/
710
-			if ((tcp_info[r].address.af==AF_INET)&&
711
-					((sendipv4_tcp==0)||(sendipv4_tcp->is_lo)))
712
-				sendipv4_tcp=&tcp_info[r];
713
-	#ifdef USE_IPV6
714
-			if((sendipv6_tcp==0)&&(tcp_info[r].address.af==AF_INET6))
715
-				sendipv6_tcp=&tcp_info[r];
716
-	#endif
706
+			if (!tcp_disable){
707
+				tcp_info[r]=sock_info[r]; /* copy the sockets */
708
+				/* same thing for tcp */
709
+				if (tcp_init(&tcp_info[r])==-1)  goto error;
710
+				/* get first ipv4/ipv6 socket*/
711
+				if ((tcp_info[r].address.af==AF_INET)&&
712
+						((sendipv4_tcp==0)||(sendipv4_tcp->is_lo)))
713
+					sendipv4_tcp=&tcp_info[r];
714
+		#ifdef USE_IPV6
715
+				if((sendipv6_tcp==0)&&(tcp_info[r].address.af==AF_INET6))
716
+					sendipv6_tcp=&tcp_info[r];
717
+		#endif
718
+			}
717 719
 #endif
718 720
 			/* all procs should have access to all the sockets (for sending)
719 721
 			 * so we open all first*/
... ...
@@ -722,10 +725,12 @@ int main_loop()
722 722
 			for(i=0;i<children_no;i++){
723 723
 				process_no++;
724 724
 #ifdef USE_TCP
725
-		 		if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd)<0){
726
-					LOG(L_ERR, "ERROR: main_loop: socketpair failed: %s\n",
727
-						strerror(errno));
728
-					goto error;
725
+				if(!tcp_disable){
726
+		 			if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd)<0){
727
+						LOG(L_ERR, "ERROR: main_loop: socketpair failed: %s\n",
728
+							strerror(errno));
729
+						goto error;
730
+					}
729 731
 				}
730 732
 #endif
731 733
 				if ((pid=fork())<0){
... ...
@@ -734,8 +739,10 @@ int main_loop()
734 734
 				}else if (pid==0){
735 735
 					     /* child */
736 736
 #ifdef USE_TCP
737
-					close(sockfd[0]);
738
-					unix_tcp_sock=sockfd[1];
737
+					if (!tcp_disable){
738
+						close(sockfd[0]);
739
+						unix_tcp_sock=sockfd[1];
740
+					}
739 741
 #endif
740 742
 					bind_address=&sock_info[r]; /* shortcut */
741 743
 					bind_idx=r;
... ...
@@ -753,9 +760,12 @@ int main_loop()
753 753
 							"receiver child=%d sock=%d @ %s:%s", i, r, 	
754 754
 							sock_info[r].name.s, sock_info[r].port_no_str.s );
755 755
 #ifdef USE_TCP
756
-						close(sockfd[1]);
757
-						pt[process_no].unix_sock=sockfd[0];
758
-						pt[process_no].idx=-1; /* this is not "tcp" process*/
756
+						if (!tcp_disable){
757
+							close(sockfd[1]);
758
+							pt[process_no].unix_sock=sockfd[0];
759
+							pt[process_no].idx=-1; /* this is not a "tcp"
760
+													  process*/
761
+						}
759 762
 #endif
760 763
 				}
761 764
 			}
... ...
@@ -775,16 +785,20 @@ int main_loop()
775 775
 		goto error;
776 776
 	}
777 777
 
778
-#ifndef USE_TCP
778
+#ifdef USE_TCP
779 779
 	/* if we are using tcp we always need the timer */
780
+	if ((!tcp_disable)||(timer_list))
781
+#else
780 782
 	if (timer_list)
781 783
 #endif
782 784
 	{
783 785
 #ifdef USE_TCP
784
- 		if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd)<0){
785
-			LOG(L_ERR, "ERROR: main_loop: socketpair failed: %s\n",
786
-				strerror(errno));
787
-			goto error;
786
+		if (!tcp_disable){
787
+ 			if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd)<0){
788
+				LOG(L_ERR, "ERROR: main_loop: socketpair failed: %s\n",
789
+					strerror(errno));
790
+				goto error;
791
+			}
788 792
 		}
789 793
 #endif
790 794
 		/* fork again for the attendant process*/
... ...
@@ -796,8 +810,10 @@ int main_loop()
796 796
 			/* child */
797 797
 			/* is_main=0; */
798 798
 #ifdef USE_TCP
799
-			close(sockfd[0]);
800
-			unix_tcp_sock=sockfd[1];
799
+			if (!tcp_disable){
800
+				close(sockfd[0]);
801
+				unix_tcp_sock=sockfd[1];
802
+			}
801 803
 #endif
802 804
 			if (init_child(PROC_TIMER) < 0) {
803 805
 				LOG(L_ERR, "timer: init_child failed\n");
... ...
@@ -815,43 +831,49 @@ int main_loop()
815 815
 			pt[process_no].pid=pid;
816 816
 			strncpy(pt[process_no].desc, "timer", MAX_PT_DESC );
817 817
 #ifdef USE_TCP
818
+			if(!tcp_disable){
818 819
 						close(sockfd[1]);
819 820
 						pt[process_no].unix_sock=sockfd[0];
820 821
 						pt[process_no].idx=-1; /* this is not a "tcp" process*/
822
+			}
821 823
 #endif
822 824
 		}
823 825
 	}
824 826
 #ifdef USE_TCP
825
-			/* start tcp receivers */
826
-		if (tcp_init_children()<0) goto error;
827
-			/* start tcp master proc */
828
-		process_no++;
829
-		if ((pid=fork())<0){
830
-			LOG(L_CRIT, "main_loop: cannot fork tcp main process\n");
831
-			goto error;
832
-		}else if (pid==0){
833
-			/* child */
834
-			/* is_main=0; */
835
-			if (init_child(PROC_TCP_MAIN) < 0) {
836
-				LOG(L_ERR, "tcp_main: error in init_child\n");
827
+		if (!tcp_disable){
828
+				/* start tcp receivers */
829
+			if (tcp_init_children()<0) goto error;
830
+				/* start tcp master proc */
831
+			process_no++;
832
+			if ((pid=fork())<0){
833
+				LOG(L_CRIT, "main_loop: cannot fork tcp main process\n");
837 834
 				goto error;
835
+			}else if (pid==0){
836
+				/* child */
837
+				/* is_main=0; */
838
+				if (init_child(PROC_TCP_MAIN) < 0) {
839
+					LOG(L_ERR, "tcp_main: error in init_child\n");
840
+					goto error;
841
+				}
842
+				tcp_main_loop();
843
+			}else{
844
+				pt[process_no].pid=pid;
845
+				strncpy(pt[process_no].desc, "tcp main process", MAX_PT_DESC );
846
+				pt[process_no].unix_sock=-1;
847
+				pt[process_no].idx=-1; /* this is not a "tcp" process*/
848
+				unix_tcp_sock=-1;
838 849
 			}
839
-			tcp_main_loop();
840
-		}else{
841
-			pt[process_no].pid=pid;
842
-			strncpy(pt[process_no].desc, "tcp main process", MAX_PT_DESC );
843
-			pt[process_no].unix_sock=-1;
844
-			pt[process_no].idx=-1; /* this is not a "tcp" process*/
845
-			unix_tcp_sock=-1;
846 850
 		}
847 851
 #endif
848 852
 	/* main */
849 853
 	pt[0].pid=getpid();
850 854
 	strncpy(pt[0].desc, "attendant", MAX_PT_DESC );
851 855
 #ifdef USE_TCP
852
-	pt[process_no].unix_sock=-1;
853
-	pt[process_no].idx=-1; /* this is not a "tcp" process*/
854
-	unix_tcp_sock=-1;
856
+	if(!tcp_disable){
857
+		pt[process_no].unix_sock=-1;
858
+		pt[process_no].idx=-1; /* this is not a "tcp" process*/
859
+		unix_tcp_sock=-1;
860
+	}
855 861
 #endif
856 862
 	/*DEBUG- remove it*/
857 863
 #ifdef DEBUG
... ...
@@ -1140,7 +1162,7 @@ int main(int argc, char** argv)
1140 1140
 #ifdef STATS
1141 1141
 	"s:"
1142 1142
 #endif
1143
-	"f:p:m:b:l:n:rRvdDEVhw:t:u:g:P:i:";
1143
+	"f:p:m:b:l:n:N:rRvdDETVhw:t:u:g:P:i:";
1144 1144
 	
1145 1145
 	while((c=getopt(argc,argv,options))!=-1){
1146 1146
 		switch(c){
... ...
@@ -1227,6 +1249,25 @@ int main(int argc, char** argv)
1227 1227
 			case 'E':
1228 1228
 					log_stderr=1;
1229 1229
 					break;
1230
+			case 'T':
1231
+#ifdef USE_TCP
1232
+					tcp_disable=1;
1233
+#else
1234
+					fprintf(stderr,"WARNING: tcp support not compiled in\n");
1235
+#endif
1236
+					break;
1237
+			case 'N':
1238
+#ifdef USE_TCP
1239
+					tcp_children_no=strtol(optarg, &tmp, 10);
1240
+					if ((tmp==0) ||(*tmp)){
1241
+						fprintf(stderr, "bad process number: -N %s\n",
1242
+									optarg);
1243
+						goto error;
1244
+					}
1245
+#else
1246
+					fprintf(stderr,"WARNING: tcp support not compiled in\n");
1247
+#endif
1248
+					break;
1230 1249
 			case 'V':
1231 1250
 					printf("version: %s\n", version);
1232 1251
 					printf("flags: %s\n", flags );
... ...
@@ -1324,13 +1365,6 @@ try_again:
1324 1324
 		LOG(L_CRIT, "could not initialize timer, exiting...\n");
1325 1325
 		goto error;
1326 1326
 	}
1327
-#ifdef USE_TCP
1328
-	/*init tcp*/
1329
-	if (init_tcp()<0){
1330
-		LOG(L_CRIT, "could not initialize tcp, exiting...\n");
1331
-		goto error;
1332
-	}
1333
-#endif
1334 1327
 	
1335 1328
 	/* register a diagnostic FIFO command */
1336 1329
 	if (register_core_fifo()<0) {
... ...
@@ -1357,14 +1391,8 @@ try_again:
1357 1357
 	
1358 1358
 	if (children_no<=0) children_no=CHILD_NO;
1359 1359
 #ifdef USE_TCP
1360
-	tcp_children_no=children_no;
1361
-#endif
1362
-#ifdef _OBSOLETED
1363
-	else if (children_no >= MAX_PROCESSES ) {
1364
-		fprintf(stderr, "ERROR: too many children processes configured;"
1365
-				" maximum is %d\n",
1366
-			MAX_PROCESSES-1 );
1367
-		goto error;
1360
+	if (!tcp_disable){
1361
+		if (tcp_children_no<=0) tcp_children_no=children_no;
1368 1362
 	}
1369 1363
 #endif
1370 1364
 	
... ...
@@ -1592,6 +1620,15 @@ try_again:
1592 1592
 							" use only the the first one)":"");
1593 1593
 	}
1594 1594
 	
1595
+#ifdef USE_TCP
1596
+	if (!tcp_disable){
1597
+		/*init tcp*/
1598
+		if (init_tcp()<0){
1599
+			LOG(L_CRIT, "could not initialize tcp, exiting...\n");
1600
+			goto error;
1601
+		}
1602
+	}
1603
+#endif
1595 1604
 	/* init_daemon? */
1596 1605
 	if (!dont_fork){
1597 1606
 		if ( daemonize(argv[0]) <0 ) goto error;
... ...
@@ -210,9 +210,9 @@ int add_uac( struct cell *t, struct sip_msg *request, str *uri, str* next_hop,
210 210
 
211 211
 	send_sock=get_send_socket( &to , proxy->proto);
212 212
 	if (send_sock==0) {
213
-		LOG(L_ERR, "ERROR: add_uac: can't fwd to af %d "
213
+		LOG(L_ERR, "ERROR: add_uac: can't fwd to af %d, proto %d "
214 214
 			" (no corresponding listening socket)\n",
215
-			to.s.sa_family );
215
+			to.s.sa_family, proxy->proto );
216 216
 		ret=ser_error=E_NO_SOCKET;
217 217
 		goto error01;
218 218
 	}
... ...
@@ -908,8 +908,8 @@ int init_rb( struct retr_buf *rb, struct sip_msg *msg)
908 908
 	rb->dst.proto_reserved1=msg->rcv.proto_reserved1;
909 909
 	send_sock=get_send_socket(&rb->dst.to, proto);
910 910
 	if (send_sock==0) {
911
-		LOG(L_ERR, "ERROR: init_rb: cannot fwd to af %d "
912
-			"no socket\n", rb->dst.to.s.sa_family);
911
+		LOG(L_ERR, "ERROR: init_rb: cannot fwd to af %d, proto %d "
912
+			"no socket\n", rb->dst.to.s.sa_family, proto);
913 913
 		ser_error=E_BAD_VIA;
914 914
 		return 0;
915 915
 	}
... ...
@@ -54,6 +54,9 @@
54 54
  *  2003-03-01  kr set through a function now (jiri)
55 55
  *  2003-03-19  replaced all mallocs/frees w/ pkg_malloc/pkg_free (andrei)
56 56
  *  2003-04-02  port_no_str does not contain a leading ':' anymore (andrei)
57
+ *  2003-04-15  t_uac_dlg now uses get_send_socket(get_out_socket doesn't
58
+ *               work for tcp) (andrei)
59
+ *  
57 60
  */
58 61
 
59 62
 
... ...
@@ -218,10 +221,10 @@ static struct socket_info *uri2sock( str *uri, union sockaddr_union *to_su,
218 218
 
219 219
 	hostent2su(to_su, &proxy->host, proxy->addr_idx, 
220 220
 			(proxy->port) ? proxy->port : SIP_PORT);
221
-	send_sock=get_out_socket(to_su, proto);
221
+	send_sock=get_send_socket(to_su, proxy->proto);
222 222
 	if (send_sock == 0) {
223
-		LOG(L_ERR, "ERROR: uri2sock: no corresponding socket for af %d\n", 
224
-						to_su->s.sa_family );
223
+		LOG(L_ERR, "ERROR: uri2sock: no corresponding socket for af %d,"
224
+				"proto %d\n", to_su->s.sa_family , proto);
225 225
 		ser_error = E_NO_SOCKET;
226 226
 	}
227 227
 
... ...
@@ -370,7 +373,7 @@ int t_uac_dlg(str* msg,                     /* Type of the message - MESSAGE, OP
370 370
 	request = &new_cell->uac[branch].request;
371 371
 	request->dst.to = to_su;
372 372
 	request->dst.send_sock = send_sock;
373
-	request->dst.proto = proto;
373
+	request->dst.proto = send_sock->proto;
374 374
 	request->dst.proto_reserved1 = 0;
375 375
 
376 376
 	/* need to put in table to calculate label which is needed for printing */
... ...
@@ -28,6 +28,11 @@
28 28
  * along with this program; if not, write to the Free Software 
29 29
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
30 30
  */
31
+/*
32
+ * History:
33
+ * --------
34
+ *  2003-04-15  added tcp_disable support (andrei)
35
+ */
31 36
 
32 37
 
33 38
 #ifndef _PT_H
... ...
@@ -66,9 +71,10 @@ inline static int process_count()
66 66
 		/* fifo server */
67 67
 		+((fifo==NULL || strlen(fifo)==0) ? 0 : 1 )
68 68
 #ifdef USE_TCP
69
-		+ 1/* tcp main */ + tcp_children_no + 
70
-		(timer_list ? 0: 1) /* add the timer proc. if not already taken
71
-							   into account */
69
+		+ (!tcp_disable)?( 1/* tcp main */ + tcp_children_no + 
70
+							(timer_list ? 0: 1)):0 /* add the timer proc.
71
+													  if not already taken
72
+													  into account */
72 73
 #endif
73 74
 		
74 75
 		;
... ...
@@ -8,7 +8,7 @@ ser \- very fast and configurable sip proxy
8 8
 .SH SYNOPSIS
9 9
 .B ser
10 10
 [
11
-.B \-hcrRvdDEV
11
+.B \-hcrRvdDEVT
12 12
 ] [
13 13
 .BI \-f " config\-file"
14 14
 ] [
... ...
@@ -19,6 +19,8 @@ ser \- very fast and configurable sip proxy
19 19
 ] [
20 20
 .BI \-n " processes\-no"
21 21
 ] [
22
+.BI \-N " tcp processes\-no"
23
+] [
22 24
 .BI \-b " max_rcv_buf_size"
23 25
 ] [
24 26
 .BI \-m " shared_mem_size"
... ...
@@ -74,6 +76,9 @@ Runs ser in the foreground (it doesn't fork into daemon mode).
74 74
 .BI \-E
75 75
 Sends all the log messages to stderr.
76 76
 .TP
77
+.BI \-T
78
+Disables TCP support.
79
+.TP
77 80
 .BI \-V
78 81
 Displays the version number.
79 82
 .TP
... ...
@@ -98,6 +103,11 @@ and to all the following that do not have a corresponding
98 98
 .BI \-n " processes\-no"
99 99
 Specifies the number of children processes forked per interface (default 8).
100 100
 .TP
101
+.BI \-N " tcp processes\-no"
102
+Specifies the number of children processes forked to handle tcp incoming connections (by default is equal to
103
+.BI \-n
104
+).
105
+.TP
101 106
 .BI \-b " max_rcv_buf_size"
102 107
 Maximum receive buffer size which will not be exceeded by the auto-probing procedure even if the OS allows.
103 108
 .TP
... ...
@@ -171,4 +181,4 @@ Report bugs at
171 171
 .nf
172 172
 https://developer.berlios.de/bugs/?func=addbug&group_id=480 .
173 173
 .br
174
-For help/support, write an email to <serhelp@iptel.org>. 
174
+For help/support, write an email to <serhelp@iptel.org> or <seruser@iptel.org>.
... ...
@@ -21,7 +21,9 @@ or enclosed in
21 21
 are interpreted as comments.
22 22
 .PP
23 23
 This manual page is incomplete. For further information please read
24
-.I /usr/share/doc/ser/README.cfg.
24
+.I /usr/share/doc/ser/README.cfg
25
+and
26
+.I Ser User Guide.
25 27
 
26 28
 .SH FILES
27 29
 .bL