diff --git a/SRC/AUTHORS b/SRC/AUTHORS index 8f880ce..0972872 100644 --- a/SRC/AUTHORS +++ b/SRC/AUTHORS @@ -12,6 +12,8 @@ and beta-testing. Christian Grimm for the ICP code. +Glen Turner for the Type Of Service code. + The Pasteur Institute because the work was done when working on the French national Web cache project, while being an employee of the Institute. diff --git a/SRC/acconfig.h b/SRC/acconfig.h index 0e1b709..7f646c8 100644 --- a/SRC/acconfig.h +++ b/SRC/acconfig.h @@ -6,6 +6,9 @@ /* Do we have T/TCP? */ #undef HAVE_TTCP +/* Do we have TOS? */ +#undef HAVE_TOS + /* Is sys_errlist declared? */ #undef DECL_SYS_ERRLIST diff --git a/SRC/config.h.in b/SRC/config.h.in index 8c964c6..7aa8bd1 100644 --- a/SRC/config.h.in +++ b/SRC/config.h.in @@ -49,6 +49,9 @@ /* Do we have T/TCP? */ #undef HAVE_TTCP +/* Do we have TOS? */ +#undef HAVE_TOS + /* Is sys_errlist declared? */ #undef DECL_SYS_ERRLIST diff --git a/SRC/configure b/SRC/configure index d9d5c03..928ea4f 100755 --- a/SRC/configure +++ b/SRC/configure @@ -17,6 +17,8 @@ ac_help="$ac_help --enable-icp ICP (for testing Web proxies/caches) support" ac_help="$ac_help --enable-ttcp T/TCP (Transaction TCP) support" +ac_help="$ac_help +--enable-tos TOS (Type Of Service - and socket priority) support" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -558,7 +560,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:562: checking for a BSD compatible install" >&5 +echo "configure:564: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -611,7 +613,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:615: checking whether build environment is sane" >&5 +echo "configure:617: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -668,7 +670,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:672: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:674: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -714,7 +716,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:718: checking for working aclocal" >&5 +echo "configure:720: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -727,7 +729,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:731: checking for working autoconf" >&5 +echo "configure:733: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -740,7 +742,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:744: checking for working automake" >&5 +echo "configure:746: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -753,7 +755,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:757: checking for working autoheader" >&5 +echo "configure:759: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -766,7 +768,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:770: checking for working makeinfo" >&5 +echo "configure:772: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -814,7 +816,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:818: checking for $ac_word" >&5 +echo "configure:820: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -844,7 +846,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:848: checking for $ac_word" >&5 +echo "configure:850: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -895,7 +897,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:899: checking for $ac_word" >&5 +echo "configure:901: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -927,7 +929,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:931: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:933: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -938,12 +940,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 942 "configure" +#line 944 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:949: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -969,12 +971,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:973: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:975: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:978: checking whether we are using GNU C" >&5 +echo "configure:980: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -983,7 +985,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:987: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:989: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1002,7 +1004,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1006: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1008: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1048,7 +1050,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1052: checking for a BSD compatible install" >&5 +echo "configure:1054: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1103,7 +1105,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1107: checking how to run the C preprocessor" >&5 +echo "configure:1109: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1118,13 +1120,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1128: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1130: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1135,13 +1137,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1145: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1147: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1152,13 +1154,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1162: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1164: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1183,12 +1185,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1187: checking for ANSI C header files" >&5 +echo "configure:1189: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1196,7 +1198,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1200: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1202: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1213,7 +1215,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1231,7 +1233,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1252,7 +1254,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1263,7 +1265,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1290,17 +1292,17 @@ for ac_hdr in sys/time.h unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1294: checking for $ac_hdr" >&5 +echo "configure:1296: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1304: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1306: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1331,13 +1333,13 @@ for cf_name in sys_nerr sys_errlist do echo $ac_n "checking if external $cf_name is declared""... $ac_c" 1>&6 -echo "configure:1335: checking if external $cf_name is declared" >&5 +echo "configure:1337: checking if external $cf_name is declared" >&5 if eval "test \"`echo '$''{'cf_cv_dcl_$cf_name'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1356: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval 'cf_cv_dcl_'$cf_name'=yes' else @@ -1380,13 +1382,13 @@ fi # It's possible (for near-UNIX clones) that the data doesn't exist echo $ac_n "checking if external $cf_name exists""... $ac_c" 1>&6 -echo "configure:1384: checking if external $cf_name exists" >&5 +echo "configure:1386: checking if external $cf_name exists" >&5 if eval "test \"`echo '$''{'cf_cv_have_$cf_name'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval 'cf_cv_have_'$cf_name'=yes' else @@ -1429,12 +1431,12 @@ done echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1433: checking for working const" >&5 +echo "configure:1435: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1489: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1504,12 +1506,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1508: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1510: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1518,7 +1520,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1522: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1524: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1541,7 +1543,7 @@ fi echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:1545: checking for socket in -lsocket" >&5 +echo "configure:1547: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1549,7 +1551,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1566: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1577,9 +1579,9 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking if libsocket is mandatory""... $ac_c" 1>&6 -echo "configure:1581: checking if libsocket is mandatory" >&5 +echo "configure:1583: checking if libsocket is mandatory" >&5 cat > conftest.$ac_ext < #include @@ -1595,7 +1597,7 @@ int main() { socket (AF_INET, SOCK_STREAM, 0) ; return 0; } EOF -if { (eval echo configure:1599: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1601: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""no" 1>&6 else @@ -1613,7 +1615,7 @@ fi echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:1617: checking for gethostbyname in -lnsl" >&5 +echo "configure:1619: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1621,7 +1623,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1638: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1649,9 +1651,9 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking if libnsl is mandatory""... $ac_c" 1>&6 -echo "configure:1653: checking if libnsl is mandatory" >&5 +echo "configure:1655: checking if libnsl is mandatory" >&5 cat > conftest.$ac_ext < #include @@ -1660,7 +1662,7 @@ int main() { gethostbyname(domain) ; return 0; } EOF -if { (eval echo configure:1664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1666: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""no" 1>&6 else @@ -1677,12 +1679,12 @@ fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1681: checking return type of signal handlers" >&5 +echo "configure:1683: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1699,7 +1701,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1703: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1705: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1718,12 +1720,12 @@ EOF echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:1722: checking for vprintf" >&5 +echo "configure:1724: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1752: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -1770,12 +1772,12 @@ fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:1774: checking for _doprnt" >&5 +echo "configure:1776: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -1825,12 +1827,12 @@ fi for ac_func in gettimeofday socket gethostbyname sigaction do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1829: checking for $ac_func" >&5 +echo "configure:1831: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1859: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1880,9 +1882,9 @@ done echo $ac_n "checking T/TCP""... $ac_c" 1>&6 -echo "configure:1884: checking T/TCP" >&5 +echo "configure:1886: checking T/TCP" >&5 cat > conftest.$ac_ext < #include @@ -1891,7 +1893,7 @@ int main() { int foobar = MSG_EOF; ; return 0; } EOF -if { (eval echo configure:1895: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1897: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define TTCP 1 @@ -1929,6 +1931,56 @@ EOF fi +echo $ac_n "checking Type Of Service""... $ac_c" 1>&6 +echo "configure:1936: checking Type Of Service" >&5 +cat > conftest.$ac_ext < + #include + +int main() { +int foobar = SO_PRIORITY; +; return 0; } +EOF +if { (eval echo configure:1947: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define TOS 1 +EOF + + ac_have_tos="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_have_tos=no +fi +rm -f conftest* +echo "$ac_t""$ac_have_tos" 1>&6 +# Check whether --enable-tos or --disable-tos was given. +if test "${enable_tos+set}" = set; then + enableval="$enable_tos" + if test "$enableval" = "yes"; then + if test $ac_have_tos = "yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_TOS 1 +EOF + + else + echo "configure: warning: No TOS support on this system, request ignored" 1>&2 + fi + fi +else + if test $ac_have_tos = "yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_TOS 1 +EOF + + fi +fi + + trap '' 1 2 15 cat > confcache <<\EOF diff --git a/SRC/configure.in b/SRC/configure.in index 2296570..7e582aa 100644 --- a/SRC/configure.in +++ b/SRC/configure.in @@ -70,5 +70,30 @@ AC_ARG_ENABLE(ttcp, AC_DEFINE(HAVE_TTCP) fi) +dnl Type Of Service +AC_MSG_CHECKING([Type Of Service]) +AC_TRY_COMPILE( + [#include + #include + ], + [int foobar = SO_PRIORITY;], + [AC_DEFINE(TOS) + ac_have_tos="yes"], + ac_have_tos=no) +AC_MSG_RESULT($ac_have_tos) +AC_ARG_ENABLE(tos, + [--enable-tos TOS (Type Of Service - and socket priority) support], + [if test "$enableval" = "yes"; then + if test $ac_have_tos = "yes"; then + AC_DEFINE(HAVE_TOS) + else + AC_MSG_WARN([No TOS support on this system, request ignored]) + fi + fi], + dnl Default: enable it if supported + if test $ac_have_tos = "yes"; then + AC_DEFINE(HAVE_TOS) + fi) + AC_OUTPUT(Makefile) diff --git a/SRC/echoping.c b/SRC/echoping.c index a8db519..4148133 100644 --- a/SRC/echoping.c +++ b/SRC/echoping.c @@ -30,10 +30,10 @@ unsigned int successes, attempts = 0; unsigned int size = DEFLINE; unsigned int j = 0; struct result - { - unsigned short valid; - struct timeval timevalue; - }; +{ + unsigned short valid; + struct timeval timevalue; +}; struct result results[MAXNUMBER]; struct timeval good_results[MAXNUMBER]; extern int tvcmp (); @@ -104,7 +104,6 @@ main (argc, argv) int tos_requested = 0; char *arg_end; - null_timeval.tv_sec = 0; null_timeval.tv_usec = 0; max_timeval.tv_sec = 1000000000; @@ -161,10 +160,8 @@ main (argc, argv) fill = *optarg; fill_requested = 1; break; - case 'p': - priority = (int)strtol( optarg, - &arg_end, - 0); + case 'p': + priority = (int) strtol (optarg, &arg_end, 0); if (arg_end == optarg || arg_end == '\0') { (void) fprintf (stderr, @@ -177,16 +174,13 @@ main (argc, argv) priority_requested = 1; } break; - case 'P': - tos = (int)strtol( optarg, - &arg_end, - 0); + case 'P': + tos = (int) strtol (optarg, &arg_end, 0); if (arg_end == optarg || arg_end == '\0') { (void) fprintf (stderr, "%s: IP type of service (-P) should be " - "numeric.\n", - progname); + "numeric.\n", progname); exit (1); } else @@ -205,8 +199,7 @@ main (argc, argv) } if (size <= 0) { - (void) fprintf (stderr, - "%s: illegal packet size.\n", progname); + (void) fprintf (stderr, "%s: illegal packet size.\n", progname); exit (1); } size_requested = 1; @@ -216,8 +209,7 @@ main (argc, argv) timeout_requested = 1; if (size <= 0) { - (void) fprintf (stderr, - "%s: illegal timeout.\n", progname); + (void) fprintf (stderr, "%s: illegal timeout.\n", progname); exit (1); } break; @@ -226,14 +218,15 @@ main (argc, argv) if (number > MAXNUMBER) { (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); exit (1); } if (number <= 0) { (void) fprintf (stderr, - "%s: illegal number of iterations.\n", progname); + "%s: illegal number of iterations.\n", + progname); exit (1); } break; @@ -255,7 +248,8 @@ main (argc, argv) if (udp && ((port_to_use == USE_CHARGEN) || (port_to_use == USE_HTTP))) { (void) fprintf (stderr, - "%s: I don't know how to use this port with UDP.\n", progname); + "%s: I don't know how to use this port with UDP.\n", + progname); exit (1); } /* @@ -271,7 +265,8 @@ main (argc, argv) if (http && (fill_requested)) { (void) fprintf (stderr, - "%s: Filling incompatible with HTTP connections.\n", progname); + "%s: Filling incompatible with HTTP connections.\n", + progname); exit (1); } #ifndef USE_TTCP @@ -297,11 +292,21 @@ main (argc, argv) "%s: Not compiled with ICP support.\n", progname); exit (1); } +#endif +#ifndef USE_TOS + if (priority_requested || tos_requested) + { + (void) fprintf (stderr, + "%s: Not compiled with Type Of Service support.\n", + progname); + exit (1); + } #endif if (http && size_requested) { (void) fprintf (stderr, - "%s: HTTP and message size specification are incompatible.\n", progname); + "%s: HTTP and message size specification are incompatible.\n", + progname); exit (1); } if (udp && ttcp) @@ -352,8 +357,8 @@ main (argc, argv) err_quit ("gethostbyname error for host: %s %s", server, sys_err_str ()); } - server_address = *(hostptr->h_addr_list); /* First item of the - * list */ + server_address = *(hostptr->h_addr_list); /* First item of the + * list */ /* * addr = (u_long) *server_address; */ @@ -368,7 +373,7 @@ main (argc, argv) ptr = (struct in_addr *) malloc (sizeof (struct in_addr)); ptr->s_addr = addr; } - if (!http && !icp) /* Already find */ + if (!http && !icp) /* Already find */ { if (!udp) { @@ -377,7 +382,7 @@ main (argc, argv) err_quit ("tcp_open: unknown service: %s/tcp", port_name); } } - else + else { if ((sp = getservbyname (port_name, "udp")) == NULL) { @@ -456,21 +461,20 @@ main (argc, argv) err_sys ("bind error"); } } +#ifdef USE_TOS if (priority_requested) { if (verbose) { printf ("Setting socket priority to %d (0x%02x)\n", - priority, - (unsigned int)priority); + priority, (unsigned int) priority); } - if (setsockopt(sockfd, - SOL_SOCKET, - SO_PRIORITY, - (void *)&priority, - (socklen_t)sizeof(priority))) + if (setsockopt (sockfd, + SOL_SOCKET, + SO_PRIORITY, + (void *) &priority, (socklen_t) sizeof (priority))) { - err_sys("Failed setting socket priority"); + err_sys ("Failed setting socket priority"); } } if (tos_requested) @@ -478,30 +482,30 @@ main (argc, argv) if (verbose) { printf ("Setting IP type of service octet to %d (0x%02x)\n", - tos, - (unsigned int)tos); + tos, (unsigned int) tos); } - if (setsockopt(sockfd, - SOL_IP, - IP_TOS, - (void *)&tos, - (socklen_t)sizeof(tos))) + if (setsockopt (sockfd, + SOL_IP, + IP_TOS, (void *) &tos, (socklen_t) sizeof (tos))) { - err_sys("Failed setting IP type of service octet"); + err_sys ("Failed setting IP type of service octet"); } } +#endif if (verbose) { if (tcp) { - printf ("Trying to connect to internet address %s %s to transmit %u bytes...\n", - inet_ntoa (*ptr), (port == 0 ? "" : text_port), n); + printf + ("Trying to connect to internet address %s %s to transmit %u bytes...\n", + inet_ntoa (*ptr), (port == 0 ? "" : text_port), n); } #ifdef ICP if (icp) { - printf ("Trying to send an ICP packet of %u bytes to the internet address %s...\n", - length, inet_ntoa (*ptr)); + printf + ("Trying to send an ICP packet of %u bytes to the internet address %s...\n", + length, inet_ntoa (*ptr)); } #endif else @@ -582,7 +586,8 @@ main (argc, argv) if (ttcp) { if (sendto (sockfd, sendline, n, MSG_EOF, - (struct sockaddr *) &serv_addr, sizeof (serv_addr)) != n) + (struct sockaddr *) &serv_addr, + sizeof (serv_addr)) != n) err_sys ("sendto error on socket"); if (verbose) { @@ -594,16 +599,17 @@ main (argc, argv) if (!udp) { /* Write something to the server */ - if (writen (sockfd, sendline, n) != n) { - if ((nr < 0 || nr != n) && timeout_flag) - { - nr = n; - printf ("Timeout while writing\n"); - continue; - } - else - err_sys ("writen error on socket"); - } + if (writen (sockfd, sendline, n) != n) + { + if ((nr < 0 || nr != n) && timeout_flag) + { + nr = n; + printf ("Timeout while writing\n"); + continue; + } + else + err_sys ("writen error on socket"); + } } else { @@ -719,7 +725,8 @@ main (argc, argv) if ((nr < 0 || nr != n) && timeout_flag) /* if ((nr < 0 || nr != n) && (errno == EINTR) && timeout_flag) */ { - printf ("Timeout while reading (%d byte(s) read)\n", (nr == -1) ? 0 : nr); + printf ("Timeout while reading (%d byte(s) read)\n", + (nr == -1) ? 0 : nr); nr = n; #ifdef FLUSH_OUTPUT if (fflush ((FILE *) NULL) != 0) @@ -730,14 +737,16 @@ main (argc, argv) continue; } if (nr < 0 || nr != n) - err_sys ("readline error: %d bytes read, %d bytes requested", nr, n); + err_sys ("readline error: %d bytes read, %d bytes requested", + nr, n); } else /* This is HTTP */ { if ((nr < 0) && (errno == EINTR) && (timeout_flag)) { - printf ("Timeout while reading (%d byte(s) read)\n", (nr == -1) ? 0 : nr); + printf ("Timeout while reading (%d byte(s) read)\n", + (nr == -1) ? 0 : nr); #ifdef FLUSH_OUTPUT if (fflush ((FILE *) NULL) != 0) { @@ -841,12 +850,15 @@ printstats () printf ("Warning: %d message(s) lost (%d %%)\n", attempts - successes, ((attempts - successes) * 100) / attempts); printf ("Minimum time: %d.%06d seconds (%.0f bytes per sec.)\n", - (int) min.tv_sec, (int) min.tv_usec, (double) size / tv2double (min)); + (int) min.tv_sec, (int) min.tv_usec, + (double) size / tv2double (min)); printf ("Maximum time: %d.%06d seconds (%.0f bytes per sec.)\n", - (int) max.tv_sec, (int) max.tv_usec, (double) size / tv2double (max)); + (int) max.tv_sec, (int) max.tv_usec, + (double) size / tv2double (max)); tvavg (&total, successes); printf ("Average time: %d.%06d seconds (%.0f bytes per sec.)\n", - (int) total.tv_sec, (int) total.tv_usec, (double) size / tv2double (total)); + (int) total.tv_sec, (int) total.tv_usec, + (double) size / tv2double (total)); /* The number of bytes/second, as printed above, is not really meaningful: size does not reflect the number of bytes exchanged. With echo, N = 2*size, with discard, N = size, with http, N = size + (response)... */ @@ -882,7 +894,8 @@ printstats () tvavg (&median, 2); } printf ("Median time: %d.%06d seconds (%.0f bytes per sec.)\n", - (int) median.tv_sec, (int) median.tv_usec, (double) size / tv2double (median)); + (int) median.tv_sec, (int) median.tv_usec, + (double) size / tv2double (median)); } } diff --git a/SRC/echoping.h b/SRC/echoping.h index 9afcfe2..13514d2 100644 --- a/SRC/echoping.h +++ b/SRC/echoping.h @@ -63,6 +63,9 @@ extern int sys_nerr; #ifdef HAVE_TTCP #define USE_TTCP 1 #endif +#ifdef HAVE_TOS +#define USE_TOS 1 +#endif struct timeval null_timeval; struct timeval max_timeval;