diff cli-runopts.c @ 449:3e6c536bc023

Add -W <windowsize> argument and document it.
author Matt Johnston <matt@ucc.asn.au>
date Wed, 25 Jul 2007 15:44:25 +0000
parents 2cd2edfa11ee
children 7e43f5e473b9
line wrap: on
line diff
--- a/cli-runopts.c	Tue Jul 24 15:40:23 2007 +0000
+++ b/cli-runopts.c	Wed Jul 25 15:44:25 2007 +0000
@@ -63,10 +63,11 @@
 #ifdef ENABLE_CLI_REMOTETCPFWD
 					"-R <listenport:remotehost:remoteport> Remote port forwarding\n"
 #endif
+					"-W <receive_window_buffer> (default %d, larger may be faster)\n"
 #ifdef DEBUG_TRACE
 					"-v    verbose\n"
 #endif
-					,DROPBEAR_VERSION, cli_opts.progname);
+					,DROPBEAR_VERSION, cli_opts.progname, DEFAULT_RECV_WINDOW);
 }
 
 void cli_getopts(int argc, char ** argv) {
@@ -109,6 +110,8 @@
 	opts.ipv4 = 1;
 	opts.ipv6 = 1;
 	*/
+	opts.recv_window = DEFAULT_RECV_WINDOW;
+	char* recv_window_arg = NULL;
 
 	/* Iterate all the arguments */
 	for (i = 1; i < (unsigned int)argc; i++) {
@@ -201,6 +204,9 @@
 				case 'u':
 					/* backwards compatibility with old urandom option */
 					break;
+				case 'W':
+					next = &recv_window_arg;
+					break;
 #ifdef DEBUG_TRACE
 				case 'v':
 					debug_trace = 1;
@@ -292,6 +298,15 @@
 			&& cli_opts.no_cmd == 0) {
 		dropbear_exit("command required for -f");
 	}
+	
+	if (recv_window_arg)
+	{
+		opts.recv_window = atol(recv_window_arg);
+		if (opts.recv_window == 0)
+		{
+			dropbear_exit("Bad recv window '%s'", recv_window_arg);
+		}
+	}
 }
 
 #ifdef ENABLE_CLI_PUBKEY_AUTH