* Limits (-n and -s) now configurable

* Preparation for 6.0
Initial
Stephane Bortzmeyer 21 years ago
parent 5ee48de072
commit 225dfc2d82

@ -31,6 +31,9 @@ may not be available on your platform).
--disable-ttcp (suppress the T/TCP support which is enabled only if --disable-ttcp (suppress the T/TCP support which is enabled only if
your system supports it - FreeBSD does. See your system supports it - FreeBSD does. See
<http://www.kohala.com/start/ttcp.html>) <http://www.kohala.com/start/ttcp.html>)
--enable-max-iterations=MAX (limit the number of iterations (-n option for
repeated tests) to MAX)
--enable-max-request-size=MAX (limit the size of the request (-s option) to MAX)
There is no option to disable IPv6. echoping now uses the new (RFC There is no option to disable IPv6. echoping now uses the new (RFC
3493, but first specified in RFC 2133 in september 1997) socket 3493, but first specified in RFC 2133 in september 1997) socket

@ -78,6 +78,12 @@
/* Internationalized Domain Names support */ /* Internationalized Domain Names support */
#undef LIBIDN #undef LIBIDN
/* Maximum number of iterations */
#undef MAX_ITERATIONS
/* Maximum size of a request */
#undef MAX_LINE
/* Crypto (SSL) support */ /* Crypto (SSL) support */
#undef OPENSSL #undef OPENSSL

46
SRC/configure vendored

@ -849,6 +849,8 @@ if test -n "$ac_init_help"; then
Optional Features: Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-max-iterations=MAX limit the number of iterations (-n option) to MAX
--enable-max-request-size=MAX limit the size of a request to MAX
--enable-http HTTP (Web's main protocol) support --enable-http HTTP (Web's main protocol) support
--enable-icp ICP (for testing Web proxies/caches) support --enable-icp ICP (for testing Web proxies/caches) support
--enable-smtp SMTP (Mail's main protocol) support --enable-smtp SMTP (Mail's main protocol) support
@ -2265,7 +2267,7 @@ fi
PACKAGE=echoping PACKAGE=echoping
VERSION=5.2.0 VERSION=6.0-BETA
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
{ { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
@ -2367,6 +2369,48 @@ fi
ac_config_commands="$ac_config_commands default-1" ac_config_commands="$ac_config_commands default-1"
max_iterations_specified=0
# Check whether --enable-max-iterations or --disable-max-iterations was given.
if test "${enable_max_iterations+set}" = set; then
enableval="$enable_max_iterations"
if test "$enableval" != "no"; then
max_iterations_specified=1
fi
fi;
if test "$max_iterations_specified" = 0; then
cat >>confdefs.h <<\_ACEOF
#define MAX_ITERATIONS 20
_ACEOF
else
cat >>confdefs.h <<_ACEOF
#define MAX_ITERATIONS $enableval
_ACEOF
fi
max_line_specified=0
# Check whether --enable-max-request-size or --disable-max-request-size was given.
if test "${enable_max_request_size+set}" = set; then
enableval="$enable_max_request_size"
if test "$enableval" != "no"; then
max_line_specified=1
fi
fi;
if test "$max_line_specified" = 0; then
cat >>confdefs.h <<\_ACEOF
#define MAX_LINE 65535
_ACEOF
else
cat >>confdefs.h <<_ACEOF
#define MAX_LINE $enableval
_ACEOF
fi
# Check whether --enable-http or --disable-http was given. # Check whether --enable-http or --disable-http was given.
if test "${enable_http+set}" = set; then if test "${enable_http+set}" = set; then
enableval="$enable_http" enableval="$enable_http"

@ -4,10 +4,33 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(echoping.h) AC_INIT(echoping.h)
AC_CANONICAL_HOST AC_CANONICAL_HOST
AC_PROG_CC(cc gcc) AC_PROG_CC(cc gcc)
AM_INIT_AUTOMAKE(echoping, 5.2.0) AM_INIT_AUTOMAKE(echoping, 6.0-BETA)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
dnl User options dnl User options
dnl http://sources.redhat.com/ml/automake-prs/2001-q3/msg00033.html
max_iterations_specified=0
AC_ARG_ENABLE(max-iterations,
[--enable-max-iterations=MAX limit the number of iterations (-n option) to MAX],
[if test "$enableval" != "no"; then
max_iterations_specified=1
fi])
if test "$max_iterations_specified" = 0; then
AC_DEFINE(MAX_ITERATIONS, 20, Maximum number of iterations)
else
AC_DEFINE_UNQUOTED(MAX_ITERATIONS, $enableval, Maximum number of iterations)
fi
max_line_specified=0
AC_ARG_ENABLE(max-request-size,
[--enable-max-request-size=MAX limit the size of a request to MAX],
[if test "$enableval" != "no"; then
max_line_specified=1
fi])
if test "$max_line_specified" = 0; then
AC_DEFINE(MAX_LINE, 65535, Maximum size of a request)
else
AC_DEFINE_UNQUOTED(MAX_LINE, $enableval, Maximum size of a request)
fi
AC_ARG_ENABLE(http, AC_ARG_ENABLE(http,
[--enable-http HTTP (Web's main protocol) support],dnl [--enable-http HTTP (Web's main protocol) support],dnl
[if test "$enableval" = "yes"; then [if test "$enableval" = "yes"; then

@ -20,7 +20,7 @@ unsigned short timeout_flag;
* process. Useless but harmless otherwise. In practice, while OSF/1 is happy * process. Useless but harmless otherwise. In practice, while OSF/1 is happy
* with it, SunOS refuses to use fflush on a NULL and Linux fails. * with it, SunOS refuses to use fflush on a NULL and Linux fails.
*/ */
#undef FLUSH_OUTPUT #undef FLUSH_OUTPUT /* Not really supported, see the TODO */
/* Global variables for main and printstats */ /* Global variables for main and printstats */
@ -35,8 +35,8 @@ unsigned int j = 0;
int family = PF_UNSPEC; int family = PF_UNSPEC;
struct result results[MAXNUMBER]; struct result results[MAX_ITERATIONS];
struct timeval good_results[MAXNUMBER]; struct timeval good_results[MAX_ITERATIONS];
extern int tvcmp (); extern int tvcmp ();
int int
@ -65,9 +65,9 @@ main (argc, argv)
int n, nr = 0; int n, nr = 0;
#ifdef OPENSSL #ifdef OPENSSL
int sslcode; int sslcode;
char rand_file[MAXLINE]; char rand_file[MAX_LINE];
#endif #endif
char *sendline, recvline[MAXLINE + 1]; char *sendline, recvline[MAX_LINE + 1];
#ifdef ICP #ifdef ICP
char retcode[DEFLINE]; char retcode[DEFLINE];
int length; int length;
@ -148,7 +148,7 @@ main (argc, argv)
stddev = null_timeval; stddev = null_timeval;
strcpy (port_name, ECHO_TCP_PORT); strcpy (port_name, ECHO_TCP_PORT);
for (i = 0; i <= MAXNUMBER; i++) for (i = 0; i <= MAX_ITERATIONS; i++)
{ {
results[i].valid = 0; results[i].valid = 0;
} }
@ -238,11 +238,11 @@ main (argc, argv)
break; break;
case 's': case 's':
size = atoi (optarg); size = atoi (optarg);
if (size > MAXLINE) if (size > MAX_LINE)
{ {
(void) fprintf (stderr, (void) fprintf (stderr,
"%s: packet size too large, max is %d.\n", "%s: packet size too large, max is %d.\n",
progname, MAXLINE); progname, MAX_LINE);
exit (1); exit (1);
} }
if (size <= 0) if (size <= 0)
@ -263,11 +263,11 @@ main (argc, argv)
break; break;
case 'n': case 'n':
number = atoi (optarg); number = atoi (optarg);
if (number > MAXNUMBER) if (number > MAX_ITERATIONS)
{ {
(void) fprintf (stderr, (void) fprintf (stderr,
"%s: number of iterations too large, max is %d.\n", "%s: number of iterations too large, max is %d.\n",
progname, MAXNUMBER); progname, MAX_ITERATIONS);
exit (1); exit (1);
} }
if (number <= 0) if (number <= 0)
@ -538,9 +538,9 @@ main (argc, argv)
idna_to_ascii_8z (utf8_server, &ace_server, idna_to_ascii_8z (utf8_server, &ace_server,
IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS) IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS)
{ {
if (result == IDNA_CONTAINS_LDH) if (result == IDNA_CONTAINS_LDH)
err_quit ("Illegal name for host: %s", server); /* foo@bar or err_quit ("Illegal name for host: %s", server); /* foo@bar or
similar errors */ similar errors */
else else
err_quit ("IDN error for host: %s %d", server, result); err_quit ("IDN error for host: %s %d", server, result);
} }

@ -9,7 +9,6 @@
/* Settings you can change */ /* Settings you can change */
#define DEFLINE 256 #define DEFLINE 256
#define MAXLINE 65535
#define UDPMAX 65535 #define UDPMAX 65535
#ifdef HTTP #ifdef HTTP
#define MAXTOREAD 150000 #define MAXTOREAD 150000
@ -18,7 +17,6 @@
#define MAXSMTP 1024 #define MAXSMTP 1024
#define MAXSMTPLINES 30 #define MAXSMTPLINES 30
#endif #endif
#define MAXNUMBER 20
/* Probably too many inclusions but this is to keep 'gcc -Wall' happy... */ /* Probably too many inclusions but this is to keep 'gcc -Wall' happy... */
#include <stdio.h> #include <stdio.h>

Loading…
Cancel
Save