Browse code

added configuraqble maxbuffer option

Jiri Kuthan authored on 12/11/2001 21:45:10
Showing 4 changed files
... ...
@@ -81,6 +81,7 @@ LISTEN		listen
81 81
 DNS		 dns
82 82
 REV_DNS	 rev_dns
83 83
 PORT	port
84
+MAXBUFFER maxbuffer
84 85
 CHILDREN children
85 86
 CHECK_VIA	check_via
86 87
 
... ...
@@ -153,6 +154,7 @@ EAT_ABLE	[\ \t\b\r]
153 153
 <INITIAL>{DNS}	{ count(); yylval.strval=yytext; return DNS; }
154 154
 <INITIAL>{REV_DNS}	{ count(); yylval.strval=yytext; return REV_DNS; }
155 155
 <INITIAL>{PORT}	{ count(); yylval.strval=yytext; return PORT; }
156
+<INITIAL>{MAXBUFFER}	{ count(); yylval.strval=yytext; return MAXBUFFER; }
156 157
 <INITIAL>{CHILDREN}	{ count(); yylval.strval=yytext; return CHILDREN; }
157 158
 <INITIAL>{CHECK_VIA}	{ count(); yylval.strval=yytext; return CHECK_VIA; }
158 159
 <INITIAL>{LOADMODULE}	{ count(); yylval.strval=yytext; return LOADMODULE; }
... ...
@@ -76,6 +76,7 @@ void* f_tmp;
76 76
 %token CHILDREN
77 77
 %token CHECK_VIA
78 78
 %token LOADMODULE
79
+%token MAXBUFFER
79 80
 
80 81
 
81 82
 
... ...
@@ -146,6 +147,8 @@ assign_stm:	DEBUG EQUAL NUMBER { debug=$3; }
146 146
 		| REV_DNS EQUAL NUMBER { received_dns|= ($3)?DO_REV_DNS:0; }
147 147
 		| REV_DNS EQUAL error { yyerror("boolean value expected"); }
148 148
 		| PORT EQUAL NUMBER   { port_no=$3; }
149
+		| MAXBUFFER EQUAL NUMBER { maxbuffer=$3; }
150
+		| MAXBUFFER EQUAL error { yyerror("number expected"); }
149 151
 		| PORT EQUAL error    { yyerror("number expected"); } 
150 152
 		| CHILDREN EQUAL NUMBER { children_no=$3; }
151 153
 		| CHILDREN EQUAL error { yyerror("number expected"); } 
... ...
@@ -16,6 +16,7 @@
16 16
 
17 17
 extern char * cfg_file;
18 18
 extern unsigned short port_no;
19
+extern unsigned int maxbuffer;
19 20
 extern char * names[];
20 21
 extern unsigned long addresses[];
21 22
 extern int addresses_no;
... ...
@@ -72,6 +72,8 @@ Options:\n\
72 72
     -E           Log to stderr\n\
73 73
     -V           Version number\n\
74 74
     -h           This help message\n\
75
+    -b nr        Maximum receive buffer size which will not be exceeded by\n\
76
+                 auto-probing procedure even if  OS allows\n\
75 77
 ";
76 78
 
77 79
 
... ...
@@ -96,6 +98,9 @@ void receive_stdin_loop()
96 96
 
97 97
 char* cfg_file = 0;
98 98
 unsigned short port_no = 0; /* port on which we listen */
99
+unsigned int maxbuffer = 128*1024; /* maximum buffer size we do not want to exceed
100
+				      durig the auto-probing procedure; may be
101
+				      re-configured */
99 102
 int children_no = 0;           /* number of children processing requests */
100 103
 int debug = 0;
101 104
 int dont_fork = 0;
... ...
@@ -260,7 +265,7 @@ int main(int argc, char** argv)
260 260
 
261 261
 	/* process command line (get port no, cfg. file path etc) */
262 262
 	opterr=0;
263
-	while((c=getopt(argc,argv,"f:p:l:n:rRvdDEVh"))!=-1){
263
+	while((c=getopt(argc,argv,"f:p:b:l:n:rRvdDEVh"))!=-1){
264 264
 		switch(c){
265 265
 			case 'f':
266 266
 					cfg_file=optarg;
... ...
@@ -272,6 +277,14 @@ int main(int argc, char** argv)
272 272
 						goto error;
273 273
 					}
274 274
 					break;
275
+
276
+			case 'b':
277
+					maxbuffer=strtol(optarg, &tmp, 10);
278
+					if (tmp &&(*tmp)){
279
+                                                fprintf(stderr, "bad max buffer size number: -p %s\n", optarg);
280
+                                                goto error;
281
+                                        }
282
+                                        break;
275 283
 			case 'l':
276 284
 					/* add a new addr. to out address list */
277 285
 					if (addresses_no < MAX_LISTEN){