make isdnctrl independent of the version of installed kernel headers,

we have our own copy now.
This commit is contained in:
kai 2001-05-23 14:48:23 +00:00
parent 2e115c28a2
commit 0748132381
9 changed files with 369 additions and 577 deletions

34
isdnctrl/aclocal.m4 vendored
View File

@ -1,38 +1,6 @@
sinclude(../etc/ackernel.m4)dnl
dnl
dnl Check for definition of triggercps
dnl in struct isdn_net_ioctl_cfg in linux/isdn.h
dnl
AC_DEFUN(AC_CHECK_TRIGGERCPS, [
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-nostdinc -I${CONFIG_KERNELDIR}/include"
have_triggercps="no"
AC_MSG_CHECKING([for triggercps in ${CONFIG_KERNELDIR}/include/linux/isdn.h])
AC_TRY_COMPILE([#include <linux/isdn.h>],isdn_net_ioctl_cfg x; int i = x.triggercps;,have_triggercps="yes",)
AC_MSG_RESULT("${have_triggercps}")
CPPFLAGS="$OLD_CPPFLAGS"
if test "$have_triggercps" != "no" ; then
AC_DEFINE(HAVE_TRIGGERCPS)
AC_SUBST(HAVE_TRIGGERCPS)
fi
])
AC_DEFUN(AC_CHECK_CISCOK, [
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-nostdinc -I${CONFIG_KERNELDIR}/include"
have_ciscokeepalive="no"
AC_MSG_CHECKING([for Cisco-Keepalive in ${CONFIG_KERNELDIR}/include/linux/isdn.h])
AC_TRY_COMPILE([#include <linux/isdn.h>],int x = ISDN_NET_ENCAP_CISCOHDLCK;,have_ciscokeepalive="yes",)
AC_MSG_RESULT("${have_ciscokeepalive}")
CPPFLAGS="$OLD_CPPFLAGS"
if test "$have_ciscokeepalive" != "no" ; then
AC_DEFINE(HAVE_CISCOKEEPALIVE)
AC_SUBST(HAVE_CISCOKEEPALIVE)
fi
])
AC_DEFUN(AC_CHECK_TIMRU, [
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-nostdinc -I${CONFIG_KERNELDIR}/include"

408
isdnctrl/configure vendored
View File

@ -1,7 +1,7 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.12
# Generated automatically using autoconf version 2.13
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
@ -12,8 +12,6 @@ ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_default_prefix=/usr
ac_help="$ac_help
--with-kernel=DIR Set kernel source directory [/usr/src/linux]"
ac_help="$ac_help
--with-sbin=DIR Set dir where binary is istalled. [/sbin]"
ac_help="$ac_help
@ -60,6 +58,7 @@ mandir='${prefix}/man'
# Initialize some other variables.
subdirs=
MFLAGS= MAKEFLAGS=
SHELL=${CONFIG_SHELL-/bin/sh}
# Maximum number of lines to put in a shell here document.
ac_max_here_lines=12
@ -343,7 +342,7 @@ EOF
verbose=yes ;;
-version | --version | --versio | --versi | --vers)
echo "configure generated by autoconf version 2.12"
echo "configure generated by autoconf version 2.13"
exit 0 ;;
-with-* | --with-*)
@ -513,9 +512,11 @@ ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
ac_exeext=
ac_objext=o
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
@ -568,28 +569,30 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# 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:576: checking for a BSD compatible install" >&5
echo "configure:578: 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
else
IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
for ac_dir in $PATH; do
# Account for people who put trailing slashes in PATH elements.
case "$ac_dir/" in
/|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
for ac_prog in ginstall installbsd scoinst install; do
# Don't use installbsd from OSF since it installs stuff as root
# by default.
for ac_prog in ginstall scoinst install; do
if test -f $ac_dir/$ac_prog; then
if test $ac_prog = install &&
grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
# OSF/1 installbsd also uses dspmsg, but is usable.
:
else
ac_cv_path_install="$ac_dir/$ac_prog -c"
@ -619,20 +622,23 @@ echo "$ac_t""$INSTALL" 1>&6
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
# 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:628: checking for $ac_word" >&5
echo "configure:633: 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
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in $PATH; do
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_dummy="$PATH"
for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_CC="gcc"
@ -653,16 +659,17 @@ 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:657: checking for $ac_word" >&5
echo "configure:663: 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
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_prog_rejected=no
for ac_dir in $PATH; do
ac_dummy="$PATH"
for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
@ -697,25 +704,61 @@ else
echo "$ac_t""no" 1>&6
fi
if test -z "$CC"; then
case "`uname -s`" in
*win32* | *WIN32*)
# 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:714: 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
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_dummy="$PATH"
for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_CC="cl"
break
fi
done
IFS="$ac_save_ifs"
fi
fi
CC="$ac_cv_prog_CC"
if test -n "$CC"; then
echo "$ac_t""$CC" 1>&6
else
echo "$ac_t""no" 1>&6
fi
;;
esac
fi
test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:705: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
echo "configure:746: 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.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
#line 715 "configure"
cat > conftest.$ac_ext << EOF
#line 757 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
if { (eval echo configure:719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:762: \"$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
@ -729,18 +772,24 @@ else
ac_cv_prog_cc_works=no
fi
rm -fr conftest*
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
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:739: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "configure:788: 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:744: checking whether we are using GNU C" >&5
echo "configure:793: 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
@ -749,7 +798,7 @@ else
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:753: \"$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:802: \"$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
@ -760,11 +809,15 @@ echo "$ac_t""$ac_cv_prog_gcc" 1>&6
if test $ac_cv_prog_gcc = yes; then
GCC=yes
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:768: checking whether ${CC-cc} accepts -g" >&5
else
GCC=
fi
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:821: 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
@ -779,26 +832,30 @@ rm -f conftest*
fi
echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
if test "$ac_test_CFLAGS" = set; then
CFLAGS="$ac_save_CFLAGS"
elif test $ac_cv_prog_cc_g = yes; then
if test "$ac_test_CFLAGS" = set; then
CFLAGS="$ac_save_CFLAGS"
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-O2"
CFLAGS="-g"
fi
else
GCC=
test "${CFLAGS+set}" = set || CFLAGS="-g"
if test "$GCC" = yes; then
CFLAGS="-O2"
else
CFLAGS=
fi
fi
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
echo "configure:797: checking return type of signal handlers" >&5
echo "configure:854: 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 <<EOF
#line 802 "configure"
#line 859 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@ -815,7 +872,7 @@ int main() {
int i;
; return 0; }
EOF
if { (eval echo configure:819: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:876: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@ -835,7 +892,7 @@ EOF
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:839: checking how to run the C preprocessor" >&5
echo "configure:896: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@ -850,14 +907,14 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 854 "configure"
#line 911 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:860: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
{ (eval echo configure:917: \"$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
:
else
@ -867,14 +924,31 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 871 "configure"
#line 928 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:877: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
{ (eval echo configure:934: \"$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
:
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
#line 945 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:951: \"$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
:
else
@ -886,6 +960,8 @@ else
fi
rm -f conftest*
fi
rm -f conftest*
fi
rm -f conftest*
ac_cv_prog_CPP="$CPP"
fi
@ -896,12 +972,12 @@ fi
echo "$ac_t""$CPP" 1>&6
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
echo "configure:900: checking for ANSI C header files" >&5
echo "configure:976: 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 <<EOF
#line 905 "configure"
#line 981 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@ -909,8 +985,8 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:913: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
{ (eval echo configure:989: \"$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*
ac_cv_header_stdc=yes
@ -926,7 +1002,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
#line 930 "configure"
#line 1006 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@ -944,7 +1020,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
#line 948 "configure"
#line 1024 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@ -965,7 +1041,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
#line 969 "configure"
#line 1045 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@ -976,7 +1052,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
if { (eval echo configure:980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1056: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@ -1003,18 +1079,18 @@ for ac_hdr in sys/ioctl.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:1007: checking for $ac_hdr" >&5
echo "configure:1083: 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
#line 1012 "configure"
#line 1088 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1017: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
{ (eval echo configure:1093: \"$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*
eval "ac_cv_header_$ac_safe=yes"
@ -1041,223 +1117,20 @@ done
OLD_CPPFLAGS="$CPPFLAGS"
lxdir="no"
eval tst_kerneldir=$CONFIG_KERNELDIR
# Check whether --with-kernel or --without-kernel was given.
if test "${with_kernel+set}" = set; then
withval="$with_kernel"
DOTEST="y"; tst_kerneldir="${withval}"
fi
if test "$DOTEST" = "y" || test "$CONFIG_KERNELDIR" != "" ; then
echo $ac_n "checking for linux kernel source in ${tst_kerneldir}""... $ac_c" 1>&6
echo "configure:1058: checking for linux kernel source in ${tst_kerneldir}" >&5
CPPFLAGS="-nostdinc -I${tst_kerneldir}/include -I${tst_kerneldir}/drivers/isdn"
cat > conftest.$ac_ext <<EOF
#line 1061 "configure"
#include "confdefs.h"
#include <isdn_common.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1066: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
lxdir=${tst_kerneldir}
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
echo "$ac_t"""no"" 1>&6
fi
rm -f conftest*
fi
if test "$lxdir" = "no" ; then
echo $ac_n "checking for linux kernel source in /usr/src/linux""... $ac_c" 1>&6
echo "configure:1082: checking for linux kernel source in /usr/src/linux" >&5
CPPFLAGS="-nostdinc -I/usr/src/linux/include -I/usr/src/linux/drivers/isdn"
cat > conftest.$ac_ext <<EOF
#line 1085 "configure"
#include "confdefs.h"
#include <isdn_common.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1090: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
lxdir=/usr/src/linux
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest*
fi
if test "$lxdir" = "no" ; then
echo "$ac_t"""$lxdir"" 1>&6
echo $ac_n "checking for linux kernel source in /usr/local/src/linux""... $ac_c" 1>&6
echo "configure:1105: checking for linux kernel source in /usr/local/src/linux" >&5
CPPFLAGS="-nostdinc -I/usr/local/src/linux/include -I/usr/local/src/linux/drivers/isdn"
cat > conftest.$ac_ext <<EOF
#line 1108 "configure"
#include "confdefs.h"
#include <isdn_common.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1113: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
lxdir=/usr/local/src/linux
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest*
fi
if test "$lxdir" != "no" ; then
echo "$ac_t"""yes"" 1>&6
else
lxdir=""
{ echo "configure: error: "Kernel source not found. You MUST specify a correct path to the linux source in the configuration."" 1>&2; exit 1; }
fi
CONFIG_KERNELDIR="$lxdir"
CPPFLAGS="$OLD_CPPFLAGS"
cat >> confdefs.h <<EOF
#define CONFIG_KERNELDIR "$lxdir"
EOF
for ac_hdr in $CONFIG_KERNELDIR/include/linux/isdn.h $CONFIG_KERNELDIR/include/linux/isdnif.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1145: 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
#line 1150 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1155: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
else
echo "$ac_t""no" 1>&6
{ echo "configure: error: Isdn header files not found. Kernel installed?" 1>&2; exit 1; }
fi
done
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-nostdinc -I${CONFIG_KERNELDIR}/include"
have_triggercps="no"
echo $ac_n "checking for triggercps in ${CONFIG_KERNELDIR}/include/linux/isdn.h""... $ac_c" 1>&6
echo "configure:1188: checking for triggercps in ${CONFIG_KERNELDIR}/include/linux/isdn.h" >&5
cat > conftest.$ac_ext <<EOF
#line 1190 "configure"
#include "confdefs.h"
#include <linux/isdn.h>
int main() {
isdn_net_ioctl_cfg x; int i = x.triggercps;
; return 0; }
EOF
if { (eval echo configure:1197: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
have_triggercps="yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest*
echo "$ac_t"""${have_triggercps}"" 1>&6
CPPFLAGS="$OLD_CPPFLAGS"
if test "$have_triggercps" != "no" ; then
cat >> confdefs.h <<\EOF
#define HAVE_TRIGGERCPS 1
EOF
fi
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-nostdinc -I${CONFIG_KERNELDIR}/include"
have_ciscokeepalive="no"
echo $ac_n "checking for Cisco-Keepalive in ${CONFIG_KERNELDIR}/include/linux/isdn.h""... $ac_c" 1>&6
echo "configure:1220: checking for Cisco-Keepalive in ${CONFIG_KERNELDIR}/include/linux/isdn.h" >&5
cat > conftest.$ac_ext <<EOF
#line 1222 "configure"
#include "confdefs.h"
#include <linux/isdn.h>
int main() {
int x = ISDN_NET_ENCAP_CISCOHDLCK;
; return 0; }
EOF
if { (eval echo configure:1229: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
have_ciscokeepalive="yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest*
echo "$ac_t"""${have_ciscokeepalive}"" 1>&6
CPPFLAGS="$OLD_CPPFLAGS"
if test "$have_ciscokeepalive" != "no" ; then
cat >> confdefs.h <<\EOF
#define HAVE_CISCOKEEPALIVE 1
EOF
fi
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-nostdinc -I${CONFIG_KERNELDIR}/include"
have_timru="no"
echo $ac_n "checking for TIMRU in ${CONFIG_KERNELDIR}/include/linux/isdn.h""... $ac_c" 1>&6
echo "configure:1252: checking for TIMRU in ${CONFIG_KERNELDIR}/include/linux/isdn.h" >&5
echo "configure:1125: checking for TIMRU in ${CONFIG_KERNELDIR}/include/linux/isdn.h" >&5
cat > conftest.$ac_ext <<EOF
#line 1254 "configure"
#line 1127 "configure"
#include "confdefs.h"
#include <linux/isdn.h>
int main() {
int x = IIOCNETARU;
; return 0; }
EOF
if { (eval echo configure:1261: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1134: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
have_timru="yes"
else
@ -1357,7 +1230,7 @@ EOF
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(set) 2>&1 |
case `(ac_space=' '; set) 2>&1` in
case `(ac_space=' '; set | grep ac_space) 2>&1` in
*ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote substitution
# turns \\\\ into \\, and sed turns \\ into \).
@ -1424,7 +1297,7 @@ do
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
echo "$CONFIG_STATUS generated by autoconf version 2.12"
echo "$CONFIG_STATUS generated by autoconf version 2.13"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;;
@ -1444,9 +1317,11 @@ sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
$ac_vpsub
$extrasub
s%@SHELL@%$SHELL%g
s%@CFLAGS@%$CFLAGS%g
s%@CPPFLAGS@%$CPPFLAGS%g
s%@CXXFLAGS@%$CXXFLAGS%g
s%@FFLAGS@%$FFLAGS%g
s%@DEFS@%$DEFS%g
s%@LDFLAGS@%$LDFLAGS%g
s%@LIBS@%$LIBS%g
@ -1466,12 +1341,10 @@ s%@oldincludedir@%$oldincludedir%g
s%@infodir@%$infodir%g
s%@mandir@%$mandir%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@CC@%$CC%g
s%@CPP@%$CPP%g
s%@CONFIG_KERNELDIR@%$CONFIG_KERNELDIR%g
s%@HAVE_TRIGGERCPS@%$HAVE_TRIGGERCPS%g
s%@HAVE_CISCOKEEPALIVE@%$HAVE_CISCOKEEPALIVE%g
s%@HAVE_TIMRU@%$HAVE_TIMRU%g
s%@INSTALL@%$INSTALL%g
s%@MANDATE@%$MANDATE%g
@ -1481,6 +1354,7 @@ s%@I4LVERSION@%$I4LVERSION%g
s%@CONFIG_ISDNCTRL_CONF@%$CONFIG_ISDNCTRL_CONF%g
s%@CONFIG_ISDNCTRL_TIMRU@%$CONFIG_ISDNCTRL_TIMRU%g
s%@CONFIG_ISDNCTRL_DWABC_UDP_INFO@%$CONFIG_ISDNCTRL_DWABC_UDP_INFO%g
s%@CONFIG_KERNELDIR@%$CONFIG_KERNELDIR%g
s%@CONFIG_SBINDIR@%$CONFIG_SBINDIR%g
s%@CONFIG_MANDIR@%$CONFIG_MANDIR%g

View File

@ -24,31 +24,6 @@ dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/ioctl.h unistd.h)
dnl Find current kernel source
AC_FIND_KERNEL
dnl
dnl AC_CHECK_FILE is not defined in my autoconf 2.12.
dnl If my autoconf is too old, let me know -lt <lt@toetsch.at>
dnl but AC_CHECK_HEADERS is known so I take this
dnl
dnl AC_CHECK_FILE($CONFIG_KERNELDIR/include/linux/isdn.h,,
dnl AC_MSG_ERROR("$CONFIG_KERNELDIR/include/linux/isdn.h missing. Kernel installed?")
dnl )
dnl AC_CHECK_FILE($CONFIG_KERNELDIR/include/linux/isdnif.h,,
dnl AC_MSG_ERROR("$CONFIG_KERNELDIR/include/linux/isdnif.h missing. Kernel installed?")
dnl )
dnl
dnl Check for triggercps and ciscok depend on CONFIG_KERNELDIR,
dnl so AC_FIND_KERNEL must be called before.
dnl
AC_CHECK_HEADERS($CONFIG_KERNELDIR/include/linux/isdn.h $CONFIG_KERNELDIR/include/linux/isdnif.h,
,
AC_MSG_ERROR(Isdn header files not found. Kernel installed?))
AC_CHECK_TRIGGERCPS
AC_CHECK_CISCOK
AC_CHECK_TIMRU
dnl Checks for typedefs, structures, and compiler characteristics.

View File

@ -1,4 +1,4 @@
/* $Id: ctrlconf.c,v 1.10 1999/11/02 20:41:21 keil Exp $
/* $Id: ctrlconf.c,v 1.11 2001/05/23 14:48:23 kai Exp $
*
* ISDN accounting for isdn4linux. (Utilities)
*
@ -19,6 +19,10 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: ctrlconf.c,v $
* Revision 1.11 2001/05/23 14:48:23 kai
* make isdnctrl independent of the version of installed kernel headers,
* we have our own copy now.
*
* Revision 1.10 1999/11/02 20:41:21 keil
* make phonenumber ioctl compatible for ctrlconf too
*
@ -59,14 +63,6 @@
#include <ctype.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <linux/isdn.h>
/* fix version skew between 2.0 and 2.1 kernels (structs are identical) */
#if (NET_DV == 0x04)
# undef NET_DV
# define NET_DV 0x05
#endif
#include <linux/isdnif.h>
#include "isdnctrl.h"
#include "ctrlconf.h"
@ -170,15 +166,11 @@ static char* readoptions(int fd, char *name, int is_master, section *CSec, secti
if (ioctl(fd, IIOCNETGCF, &cfg) < 0)
return NULL;
strcpy(PHONE(inphone)->name, name);
do_phonenumber(inphone, "", 0);
set_isdn_net_ioctl_phone(PHONE(inphone), name, "", 0);
if (ioctl(fd, IIOCNETGNM, PHONE(inphone)) < 0)
return NULL;
strcpy(PHONE(outphone)->name, name);
do_phonenumber(outphone, "", 1);
set_isdn_net_ioctl_phone(PHONE(outphone), name, "", 1);
if (ioctl(fd, IIOCNETGNM, PHONE(outphone)) < 0)
return NULL;
@ -203,10 +195,8 @@ static char* readoptions(int fd, char *name, int is_master, section *CSec, secti
if (Set_Entry(SubSec,interface,CONF_ENT_SECURE, cfg.secure?"on":"off", C_OVERWRITE | C_WARN) == NULL)
return NULL;
#ifdef ISDN_NET_DM_OFF
if (Set_Entry(SubSec,interface,CONF_ENT_DIALMODE, cfg.dialmode == ISDN_NET_DM_MANUAL?"manual":cfg.dialmode == ISDN_NET_DM_AUTO?"auto":"off", C_OVERWRITE | C_WARN) == NULL)
return NULL;
#endif
if (cfg.callback)
{
@ -408,7 +398,6 @@ int readconfig(int fd, char *file)
exec_args(fd,3,argv);
}
else
#ifdef ISDN_NET_DM_OFF
if (!strcmp(Entry->name,CONF_ENT_DIALMODE))
{
argv[0] = cmds[DIALMODE].cmd;
@ -418,7 +407,6 @@ int readconfig(int fd, char *file)
exec_args(fd,3,argv);
}
else
#endif
if (!strcmp(Entry->name,CONF_ENT_CALLBACK))
{
argv[0] = cmds[CALLBACK].cmd;
@ -647,11 +635,7 @@ static int create_interface(int fd, char *name)
static int set_all_numbers(int fd, char *name, int direction, char *numbers)
{
#if (NET_DV == 5)
isdn_net_ioctl_phone_new phone;
#else
isdn_net_ioctl_phone phone;
#endif
char phonestr[BUFSIZ];
char *ptr = phonestr;
char *ptr2;
@ -661,8 +645,6 @@ static int set_all_numbers(int fd, char *name, int direction, char *numbers)
if (*phonestr != '\0')
{
strcpy(phone.name, name);
do
{
if ((ptr = strrchr(phonestr,' ')) == NULL)
@ -673,8 +655,7 @@ static int set_all_numbers(int fd, char *name, int direction, char *numbers)
while (isspace(*ptr2) && ptr2 != phonestr) *ptr2-- = '\0';
}
do_phonenumber(&phone, ptr, direction);
set_isdn_net_ioctl_phone(&phone, name, ptr, direction);
if (*ptr != '\0')
{
if (ioctl(fd, IIOCNETANM, &phone) < 0)
@ -694,11 +675,7 @@ static int set_all_numbers(int fd, char *name, int direction, char *numbers)
static int del_all_numbers(int fd, char *name, int direction)
{
#if (NET_DV == 5)
isdn_net_ioctl_phone_new phone;
#else
isdn_net_ioctl_phone phone;
#endif
char phonestr[BUFSIZ];
char *ptr = phonestr;
char *ptr2;
@ -707,9 +684,7 @@ static int del_all_numbers(int fd, char *name, int direction)
if (name == NULL)
return -1;
strcpy(PHONE(phonestr)->name, name);
do_phonenumber(phonestr, "", direction);
set_isdn_net_ioctl_phone(PHONE(phonestr), name, "", direction);
if (ioctl(fd, IIOCNETGNM, PHONE(phonestr)) < 0)
{
perror(name);
@ -718,7 +693,6 @@ static int del_all_numbers(int fd, char *name, int direction)
if (*phonestr != '\0')
{
strcpy(phone.name, name);
do
{
if ((ptr = strrchr(phonestr,' ')) == NULL)
@ -731,7 +705,7 @@ static int del_all_numbers(int fd, char *name, int direction)
if (*ptr != '\0')
{
do_phonenumber(&phone, ptr, direction);
set_isdn_net_ioctl_phone(&phone, name, ptr, direction);
if (ioctl(fd, IIOCNETDNM, &phone) < 0)
{
perror(name);

View File

@ -30,7 +30,6 @@
#include <linux/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <linux/isdn.h>
#include <netdb.h>
#include "config.h"
#ifdef HAVE_TIMRU

98
isdnctrl/isdn.h Normal file
View File

@ -0,0 +1,98 @@
/* */
/* New ioctl-codes */
#define IIOCNETAIF _IO('I',1)
#define IIOCNETDIF _IO('I',2)
#define IIOCNETSCF _IO('I',3)
#define IIOCNETGCF _IO('I',4)
#define IIOCNETANM _IO('I',5)
#define IIOCNETDNM _IO('I',6)
#define IIOCNETGNM _IO('I',7)
#define IIOCGETSET _IO('I',8) /* no longer supported */
#define IIOCSETSET _IO('I',9) /* no longer supported */
#define IIOCSETVER _IO('I',10)
#define IIOCNETHUP _IO('I',11)
#define IIOCSETGST _IO('I',12)
#define IIOCSETBRJ _IO('I',13)
#define IIOCSIGPRF _IO('I',14)
#define IIOCGETPRF _IO('I',15)
#define IIOCSETPRF _IO('I',16)
#define IIOCGETMAP _IO('I',17)
#define IIOCSETMAP _IO('I',18)
#define IIOCNETASL _IO('I',19)
#define IIOCNETDIL _IO('I',20)
#define IIOCGETCPS _IO('I',21)
#define IIOCGETDVR _IO('I',22)
#define IIOCNETLCR _IO('I',23) /* dwabc ioctl for LCR from isdnlog */
#define IIOCNETDWRSET _IO('I',24) /* dwabc ioctl to reset abc-values to default on a net-interface */
#define IIOCNETALN _IO('I',32)
#define IIOCNETDLN _IO('I',33)
#define IIOCNETGPN _IO('I',34)
#define IIOCDBGVAR _IO('I',127)
#define IIOCDRVCTL _IO('I',128)
/* Packet encapsulations for net-interfaces */
#define ISDN_NET_ENCAP_ETHER 0
#define ISDN_NET_ENCAP_RAWIP 1
#define ISDN_NET_ENCAP_IPTYP 2
#define ISDN_NET_ENCAP_CISCOHDLC 3 /* Without SLARP and keepalive */
#define ISDN_NET_ENCAP_SYNCPPP 4
#define ISDN_NET_ENCAP_UIHDLC 5
#define ISDN_NET_ENCAP_CISCOHDLCK 6 /* With SLARP and keepalive */
#define ISDN_NET_ENCAP_X25IFACE 7 /* Documentation/networking/x25-iface.txt*/
#define ISDN_NET_ENCAP_MAX_ENCAP ISDN_NET_ENCAP_X25IFACE
#define ISDN_NET_DIALMODE_MASK 0xC0 /* bits for status */
#define ISDN_NET_DM_OFF 0x00 /* this interface is stopped */
#define ISDN_NET_DM_MANUAL 0x40 /* this interface is on (manual) */
#define ISDN_NET_DM_AUTO 0x80 /* this interface is autodial */
#define ISDN_NET_DIALMODE(x) ((&(x))->flags & ISDN_NET_DIALMODE_MASK)
typedef struct {
char drvid[25];
unsigned long arg;
} isdn_ioctl_struct;
/* kernels 2.2 and below */
typedef struct {
char name[10];
char phone[20];
int outgoing;
} isdn_net_ioctl_phone_5;
/* kernels 2.4 and above */
typedef struct {
char name[10];
char phone[32];
int outgoing;
} isdn_net_ioctl_phone_6;
typedef struct {
char name[10]; /* Name of interface */
char master[10]; /* Name of Master for Bundling */
char slave[10]; /* Name of Slave for Bundling */
char eaz[256]; /* EAZ/MSN */
char drvid[25]; /* DriverId for Bindings */
int onhtime; /* Hangup-Timeout */
int charge; /* Charge-Units */
int l2_proto; /* Layer-2 protocol */
int l3_proto; /* Layer-3 protocol */
int p_encap; /* Encapsulation */
int exclusive; /* Channel, if bound exclusive */
int dialmax; /* Dial Retry-Counter */
int slavedelay; /* Delay until slave starts up */
int cbdelay; /* Delay before Callback */
int chargehup; /* Flag: Charge-Hangup */
int ihup; /* Flag: Hangup-Timeout on incoming line */
int secure; /* Flag: Secure */
int callback; /* Flag: Callback */
int cbhup; /* Flag: Reject Call before Callback */
int pppbind; /* ippp device for bindings */
int chargeint; /* Use fixed charge interval length */
int triggercps; /* BogoCPS needed for triggering slave */
int dialtimeout; /* Dial-Timeout */
int dialwait; /* Time to wait after failed dial */
int dialmode; /* Flag: off / on / auto */
} isdn_net_ioctl_cfg;

View File

@ -1,4 +1,4 @@
/* $Id: isdnctrl.c,v 1.46 2001/03/15 22:02:44 kai Exp $
/* $Id: isdnctrl.c,v 1.47 2001/05/23 14:48:23 kai Exp $
* ISDN driver for Linux. (Control-Utility)
*
* Copyright 1994,95 by Fritz Elfert (fritz@isdn4linux.de)
@ -21,6 +21,10 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdnctrl.c,v $
* Revision 1.47 2001/05/23 14:48:23 kai
* make isdnctrl independent of the version of installed kernel headers,
* we have our own copy now.
*
* Revision 1.46 2001/03/15 22:02:44 kai
* fixed a stack overflow when using isdnctrl status
*
@ -262,23 +266,12 @@
#include <ctype.h>
#include <errno.h>
#include <linux/isdn.h>
#ifdef I4L_DWABC_UDPINFO
#include <isdn_dwabclib.h>
#endif
/* fix version skew between 2.0 and 2.1 kernels (structs are identical) */
#if (NET_DV == 0x04)
# undef NET_DV
# define NET_DV 0x05
#endif
#include <linux/isdnif.h>
#include "config.h"
#define _ISDNCTRL_C_
#include "isdnctrl.h"
#ifndef INF_DV
#define INF_DV 0
#ifdef I4L_DWABC_UDPINFO
#include <isdn_dwabclib.h>
#endif
#ifdef I4L_CTRL_CONF
@ -308,45 +301,33 @@ defs_fcn_t defs_fcns [] = {
NULL
};
int MSNLEN_COMPATIBILITY = 0;
char nextslaveif[10];
/*
* do_phonenumber handle back/forward compatibility between
* version 5 and version 6 of isdn_net_ioctl_phone
*
*/
int do_phonenumber(void *p, char *number, int outflag) {
isdn_net_ioctl_phone_old *phone_old = (isdn_net_ioctl_phone_old *) p;
isdn_net_ioctl_phone_new *phone_new = (isdn_net_ioctl_phone_new *) p;
isdn_net_ioctl_phone *phone = (isdn_net_ioctl_phone *) p;
int maxlen = ISDN_MSNLEN;
if (MSNLEN_COMPATIBILITY)
maxlen = 20;
if (strlen(number) > maxlen) {
fprintf(stderr, "phone-number must not exceed %d characters\n", maxlen);
return -1;
int set_isdn_net_ioctl_phone(isdn_net_ioctl_phone *ph, char *name,
char *phone, int outflag)
{
switch (data_version) {
case 0x04:
case 0x05:
if (strlen(phone) > 19) {
fprintf(stderr, "phone-number must not exceed %d characters\n", 19);
return -1;
}
strncpy(ph->phone_5.name, name, sizeof(ph->phone_5.name)-1);
strncpy(ph->phone_5.phone, phone, sizeof(ph->phone_5.phone)-1);
ph->phone_5.outgoing = outflag;
case 0x06:
if (strlen(phone) > 31) {
fprintf(stderr, "phone-number must not exceed %d characters\n", 31);
return -1;
}
strncpy(ph->phone_6.name, name, sizeof(ph->phone_6.name)-1);
strncpy(ph->phone_6.phone, phone, sizeof(ph->phone_6.phone)-1);
ph->phone_6.outgoing = outflag;
}
switch(MSNLEN_COMPATIBILITY) {
case 1:
strcpy(phone_old->phone, number);
phone_old->outgoing = outflag;
break;
case 2:
strcpy(phone_new->phone, number);
phone_new->outgoing = outflag;
break;
default:
strcpy(phone->phone, number);
phone->outgoing = outflag;
break;
}
return(0);
return 0;
}
int exec_args(int fd, int argc, char **argv);
void usage(void)
@ -359,9 +340,7 @@ void usage(void)
fprintf(stderr, " addif [name] add net-interface\n");
fprintf(stderr, " delif name [force] remove net-interface\n");
fprintf(stderr, " reset [force] remove all net-interfaces\n");
#ifdef ISDN_NET_DM_OFF
fprintf(stderr, " dialmode name [off|manual|auto] set the dial mode\n");
#endif
fprintf(stderr, " addphone name in|out num add phone-number to interface\n");
fprintf(stderr, " delphone name in|out num remove phone-number from interface\n");
fprintf(stderr, " eaz name [eaz|msn] get/set eaz for interface\n");
@ -512,20 +491,10 @@ static void listbind(char *s, int e)
static void listif(int isdnctrl, char *name, int errexit)
{
isdn_net_ioctl_cfg cfg;
union p {
#if (NET_DV == 5)
isdn_net_ioctl_phone_new phone;
#else
isdn_net_ioctl_phone phone;
#endif
char n[1024];
} ph;
char nn[1024];
char ph_in[1024], ph_out[1024];
memset(&cfg, 0, sizeof cfg); /* clear in case of older kernel */
#ifdef ISDN_NET_DM_OFF
cfg.dialmode = 0xDEADBEEF;
#endif
strcpy(cfg.name, name);
if (ioctl(isdnctrl, IIOCNETGCF, &cfg) < 0) {
if (errexit) {
@ -534,19 +503,18 @@ static void listif(int isdnctrl, char *name, int errexit)
} else
return;
}
strcpy(ph.phone.name, name);
do_phonenumber(&ph.phone, "", 0);
if (ioctl(isdnctrl, IIOCNETGNM, &ph.phone) < 0) {
set_isdn_net_ioctl_phone((isdn_net_ioctl_phone *) ph_in,
name, "", 0);
if (ioctl(isdnctrl, IIOCNETGNM, &ph_in) < 0) {
if (errexit) {
perror(name);
exit(-1);
} else
return;
}
strcpy(nn, ph.n);
strcpy(ph.phone.name, name);
do_phonenumber(&ph.phone, "", 1);
if (ioctl(isdnctrl, IIOCNETGNM, &ph.phone) < 0) {
set_isdn_net_ioctl_phone((isdn_net_ioctl_phone *) ph_out,
name, "", 1);
if (ioctl(isdnctrl, IIOCNETGNM, &ph_out) < 0) {
if (errexit) {
perror(name);
exit(-1);
@ -556,9 +524,8 @@ static void listif(int isdnctrl, char *name, int errexit)
printf("\nCurrent setup of interface '%s':\n\n", cfg.name);
printf("EAZ/MSN: %s\n", cfg.eaz);
printf("Phone number(s):\n");
printf(" Outgoing: %s\n", ph.n);
printf(" Incoming: %s\n", nn);
#ifdef ISDN_NET_DM_OFF
printf(" Outgoing: %s\n", ph_out);
printf(" Incoming: %s\n", ph_in);
printf("Dial mode: ");
if (cfg.dialmode == ISDN_NET_DM_OFF)
puts("off");
@ -570,10 +537,6 @@ static void listif(int isdnctrl, char *name, int errexit)
puts("not in kernel (please upgrade your kernel)");
else
printf("unknown value (0x%x)\n", cfg.dialmode);
#else
#warning ISDN_NET_DM_OFF not defined? Old isdn4kernel?
printf("Dial mode: not available at compilation\n");
#endif
printf("Secure: %s\n", cfg.secure ? "on" : "off");
printf("Callback: %s\n", num2callb[cfg.callback]);
if (cfg.callback == 2)
@ -623,11 +586,9 @@ static void listif(int isdnctrl, char *name, int errexit)
}
#ifdef IIOCNETGPN
static void statusif(int isdnctrl, char *name, int errexit)
{
isdn_net_ioctl_phone_new phone_new;
isdn_net_ioctl_phone_old phone_old;
isdn_net_ioctl_phone phone;
int rc;
static int isdninfo = -1;
@ -641,47 +602,33 @@ static void statusif(int isdnctrl, char *name, int errexit)
}
}
switch (data_version) {
case 5:
memset(&phone_old, 0, sizeof phone_old);
strncpy(phone_old.name, name, sizeof phone_old.name);
rc = ioctl(isdninfo, IIOCNETGPN, &phone_old);
if (rc == 0) {
printf("%s connected %s %s\n",
name, phone_old.outgoing?"to":"from", phone_old.phone);
set_isdn_net_ioctl_phone(&phone, name, "", 0);
rc = ioctl(isdninfo, IIOCNETGPN, &phone);
if (rc < 0) {
if (errno == ENOTCONN) {
printf("%s is not connected\n", name);
if (errexit) {
exit(1); /* exit 1 if interface specified & not conn. */
}
return;
}
break;
case 6:
memset(&phone_new, 0, sizeof phone_new);
strncpy(phone_new.name, name, sizeof phone_new.name);
rc = ioctl(isdninfo, IIOCNETGPN, &phone_new);
if (rc == 0) {
printf("%s connected %s %s\n",
name, phone_new.outgoing?"to":"from", phone_new.phone);
return;
}
break;
default:
puts("Sorry, not available in your kernel (2.2.12 or higher is required)");
exit(-1);
}
if (errno == ENOTCONN) {
printf("%s is not connected\n", name);
if (errexit) {
exit(1); /* exit 1 if interface specified & not conn. */
perror(name);
exit(-1);
}
}
switch (data_version) {
case 0x04:
case 0x05:
printf("%s connected %s %s\n",
name, phone.phone_5.outgoing?"to":"from", phone.phone_5.phone);
return;
case 0x06:
printf("%s connected %s %s\n",
name, phone.phone_6.outgoing?"to":"from", phone.phone_6.phone);
return;
}
if (errexit) {
perror(name);
exit(-1);
}
}
#else
#warning IIOCNETGPN not defined? Old isdn4kernel? Or 2.0.x kernel...
#endif
int findcmd(char *str)
{
@ -696,7 +643,6 @@ int findcmd(char *str)
}
#ifdef ISDN_NET_DM_OFF
/*
* do_dialmode() - handle dialmode settings
* parameters:
@ -763,7 +709,6 @@ do_dialmode(int args, int dialmode, int fd, char *id, int errexit)
else
puts("illegal value (wrong kernel version?)");
}
#endif /* dialmode in kernel source */
int exec_args(int fd, int argc, char **argv)
{
@ -774,11 +719,7 @@ int exec_args(int fd, int argc, char **argv)
FILE *iflst;
char *p;
char s[255], dummy[255];
#if (NET_DV == 5)
isdn_net_ioctl_phone_new phone;
#else
isdn_net_ioctl_phone phone;
#endif
isdn_net_ioctl_cfg cfg;
isdn_ioctl_struct iocts;
unsigned long j;
@ -839,21 +780,16 @@ int exec_args(int fd, int argc, char **argv)
argv += args;
memset(&cfg, 0, sizeof cfg); /* clear in case of older kernel */
switch (i) {
#ifdef I4L_DWABC_UDPINFO
case ABCCLEAR:
#ifdef IIOCNETDWRSET
if ((result = ioctl(fd, IIOCNETDWRSET, id)) < 0) {
perror(id);
return -1;
}
printf("ABC secure-counter for %s now clear\n", id);
break;
#else
fprintf(stderr,
"OOPS: IOCTL IIOCNETDWRSET not in kernel ! (Please install)\n");
return -1;
#endif
#endif
case ADDIF:
strcpy(s, args?id:"");
@ -1052,8 +988,7 @@ int exec_args(int fd, int argc, char **argv)
return -1;
}
outflag = strcmp(arg1, "out") ? 0 : 1;
strcpy(phone.name, id);
if (do_phonenumber(&phone, arg2, outflag))
if (set_isdn_net_ioctl_phone(&phone, id, arg2, outflag))
return -1;
if ((result = ioctl(fd, IIOCNETANM, &phone)) < 0) {
perror(id);
@ -1067,8 +1002,7 @@ int exec_args(int fd, int argc, char **argv)
return -1;
}
outflag = strcmp(arg1, "out") ? 0 : 1;
strcpy(phone.name, id);
if (do_phonenumber(&phone, arg2, outflag))
if (set_isdn_net_ioctl_phone(&phone, id, arg2, outflag))
return -1;
if ((result = ioctl(fd, IIOCNETDNM, &phone)) < 0) {
perror(id);
@ -1076,7 +1010,7 @@ int exec_args(int fd, int argc, char **argv)
}
break;
case LIST:
case LIST:
if (!strcmp(id, "all")) {
char name[10];
if ((iflst = fopen(FILE_PROC, "r")) == NULL) {
@ -1099,7 +1033,6 @@ int exec_args(int fd, int argc, char **argv)
break;
case STATUS:
#ifdef IIOCNETGPN
if (!strcmp(id, "all")) {
char name[10];
if ((iflst = fopen(FILE_PROC, "r")) == NULL) {
@ -1120,9 +1053,6 @@ int exec_args(int fd, int argc, char **argv)
} else {
statusif(fd, id, 1);
}
#else
puts("Sorry, not configured into isdnctrl");
#endif /* defined IIOCNETGPN */
break;
case EAZ:
@ -1283,21 +1213,17 @@ int exec_args(int fd, int argc, char **argv)
fprintf(stderr, "Slave triggerlevel must be >= 0 (%s)\n", arg1);
exit(-1);
}
#if HAVE_TRIGGERCPS
cfg.triggercps = i;
if ((result = ioctl(fd, IIOCNETSCF, &cfg)) < 0) {
perror(id);
exit(-1);
}
#endif
}
if (data_version < 3)
printf("Option 'trigger' IGNORED!\n");
#if HAVE_TRIGGERCPS
else
printf("Slave triggerlevel for %s is %d cps.\n",
cfg.name, cfg.triggercps);
#endif
break;
case CHARGEHUP:
@ -1393,7 +1319,7 @@ int exec_args(int fd, int argc, char **argv)
if (args == 2) {
i = -1;
if (strcmp(arg1, "on") && strcmp(arg1, "off") &&
strcmp(arg1, "in") && strcmp(arg1, "out")) {
strcmp(arg1, "in") && strcmp(arg1, "out")) {
fprintf(stderr, "Callback-parameter must be 'on', 'in', 'out' or 'off'\n");
return -1;
}
@ -1534,7 +1460,6 @@ int exec_args(int fd, int argc, char **argv)
break;
case DIALMODE:
#ifdef ISDN_NET_DM_OFF
if(args == 2) {
if (!strcmp(arg1, "on") || !strcmp(arg1, "manual"))
cfg.dialmode = ISDN_NET_DM_MANUAL;
@ -1571,10 +1496,6 @@ int exec_args(int fd, int argc, char **argv)
do_dialmode(args, cfg.dialmode, fd, id, 1);
}
#else /* not in kernel include file */
fprintf(stderr, "No 'dialmode' field in kernel source when compiled, old isdn4kernel?\n");
exit(-1);
#endif
break;
@ -1752,6 +1673,8 @@ int exec_args(int fd, int argc, char **argv)
}
break;
default:
printf("here %d\n",i);
}
#if DEBUG
@ -1780,8 +1703,6 @@ void check_version(int report) {
if (report) {
printf("isdnctrl version %s\n", VERSION);
printf("isdnctrl's view of API-versions:\n");
printf("ttyI: %d, net: %d, info: %d\n", TTY_DV, NET_DV, INF_DV);
}
fd = open("/dev/isdn/isdninfo", O_RDWR);
if (fd < 0)
@ -1807,42 +1728,16 @@ void check_version(int report) {
return;
}
data_version = (data_version >> 8) & 0xff;
/* consider NET_DV 0x04 and 0x05 to be the same */
if (data_version == 0x04)
data_version = 0x05;
if (data_version != NET_DV) {
if ((data_version == 5) && (NET_DV == 6)) {
MSNLEN_COMPATIBILITY = 1;
return;
}
if ((data_version == 6) && (NET_DV == 5)) {
MSNLEN_COMPATIBILITY = 2;
return;
}
fprintf(stderr, "Version of kernel ioctl structs (%d) does NOT match\n",
data_version);
fprintf(stderr, "version of isdnctrl (%d)!\n", NET_DV);
if (data_version < 1) {
fprintf(stderr, "Kernel-version too old, terminating.\n");
fprintf(stderr, "UPDATE YOUR KERNEL.\n");
exit(-1);
}
if (data_version > NET_DV) {
fprintf(stderr, "Kernel-version newer than isdnctrl-version, terminating.\n");
fprintf(stderr, "GET A NEW VERSION OF isdn4k-utils.\n");
exit(-1);
}
if ((NET_DV == 3) || (data_version == 3)) {
fprintf(stderr, "Version 3 is an interim NOT compatible to others, terminating\n");
fprintf(stderr, "RECOMPILE isdnctrl!\n");
exit(-1);
}
if (data_version < 3)
fprintf(stderr, "- Option 'trigger' disabled.\n");
if (data_version < 2)
fprintf(stderr, "- Option 'chargeint' disabled.\n");
fprintf(stderr, "Make sure that you are using the correct version.\n");
fprintf(stderr, "Recompiling of isdnctrl is STRONGLY RECOMMENDED.\n");
if (data_version < 4) {
fprintf(stderr, "Kernel-version too old, terminating.\n");
fprintf(stderr, "UPDATE YOUR KERNEL.\n");
exit(-1);
}
if (data_version > 6) {
fprintf(stderr, "Kernel-version newer than isdnctrl-version, terminating.\n");
fprintf(stderr, "GET A NEW VERSION OF isdn4k-utils.\n");
exit(-1);
}
}

View File

@ -1,4 +1,4 @@
/* $Id: isdnctrl.h,v 1.17 1999/11/20 22:23:53 detabc Exp $
/* $Id: isdnctrl.h,v 1.18 2001/05/23 14:48:23 kai Exp $
* ISDN driver for Linux. (Control-Utility)
*
* Copyright 1994,95 by Fritz Elfert (fritz@isdn4linux.de)
@ -21,6 +21,10 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdnctrl.h,v $
* Revision 1.18 2001/05/23 14:48:23 kai
* make isdnctrl independent of the version of installed kernel headers,
* we have our own copy now.
*
* Revision 1.17 1999/11/20 22:23:53 detabc
* added netinterface abc-secure-counter reset (clear) support.
*
@ -99,6 +103,9 @@
*
*/
#include "isdn.h"
#include "isdnif.h"
/*****************************************************************************/
#define FILE_PROC "/proc/net/dev"
@ -208,30 +215,18 @@ cmd_struct cmds[] =
char *l2protostr[] = {
"x75i", "x75ui", "x75bui", "hdlc",
#ifdef ISDN_PROTO_L2_X25DTE
"x25dte", "x25dce",
#endif
#ifdef ISDN_PROTO_L2_V11096
"v110_9600", "v110_19200", "v110_38400",
#endif
#ifdef ISDN_PROTO_L2_MODEM
"modem",
#endif
"\0"
};
int l2protoval[] = {
ISDN_PROTO_L2_X75I, ISDN_PROTO_L2_X75UI,
ISDN_PROTO_L2_X75BUI, ISDN_PROTO_L2_HDLC,
#ifdef ISDN_PROTO_L2_X25DTE
ISDN_PROTO_L2_X25DTE, ISDN_PROTO_L2_X25DCE,
#endif
#ifdef ISDN_PROTO_L2_V11096
ISDN_PROTO_L2_V11096, ISDN_PROTO_L2_V11019, ISDN_PROTO_L2_V11038,
#endif
#ifdef ISDN_PROTO_L2_MODEM
ISDN_PROTO_L2_MODEM,
#endif
-1
};
@ -250,12 +245,8 @@ char *pencapstr[] = {
"cisco-h",
"syncppp",
"uihdlc",
#if HAVE_CISCOKEEPALIVE
"cisco-hk",
#endif
#ifdef ISDN_NET_ENCAP_X25IFACE
"x25iface",
#endif
"\0"
};
@ -266,12 +257,8 @@ int pencapval[] = {
ISDN_NET_ENCAP_CISCOHDLC,
ISDN_NET_ENCAP_SYNCPPP,
ISDN_NET_ENCAP_UIHDLC,
#if HAVE_CISCOKEEPALIVE
ISDN_NET_ENCAP_CISCOHDLCK,
#endif
#ifdef ISDN_NET_ENCAP_X25IFACE
ISDN_NET_ENCAP_X25IFACE,
#endif
-1
};
@ -306,24 +293,19 @@ _EXTERN char * defs_basic(char *id);
_EXTERN int MSNLEN_COMPATIBILITY;
/*
* do_phonenumber handle back/forward compatibility between
* version 5 and version 6 of isdn_net_ioctl_phone
* set_isdn_net_ioctl_phone handles back/forward compatibility between
* version 4, 5 and 6 of isdn_net_ioctl_phone
*
*/
typedef struct {
char name[10];
char phone[20];
int outgoing;
} isdn_net_ioctl_phone_old;
typedef union {
isdn_net_ioctl_phone_6 phone_6;
isdn_net_ioctl_phone_5 phone_5;
} isdn_net_ioctl_phone;
typedef struct {
char name[10];
char phone[32];
int outgoing;
} isdn_net_ioctl_phone_new;
extern int set_isdn_net_ioctl_phone(isdn_net_ioctl_phone *ph, char *name,
char *phone, int outflag);
_EXTERN int do_phonenumber(void *p, char *number, int outflag);
#undef _EXTERN

27
isdnctrl/isdnif.h Normal file
View File

@ -0,0 +1,27 @@
/*
* Values for Layer-2-protocol-selection
*/
#define ISDN_PROTO_L2_X75I 0 /* X75/LAPB with I-Frames */
#define ISDN_PROTO_L2_X75UI 1 /* X75/LAPB with UI-Frames */
#define ISDN_PROTO_L2_X75BUI 2 /* X75/LAPB with UI-Frames */
#define ISDN_PROTO_L2_HDLC 3 /* HDLC */
#define ISDN_PROTO_L2_TRANS 4 /* Transparent (Voice) */
#define ISDN_PROTO_L2_X25DTE 5 /* X25/LAPB DTE mode */
#define ISDN_PROTO_L2_X25DCE 6 /* X25/LAPB DCE mode */
#define ISDN_PROTO_L2_V11096 7 /* V.110 bitrate adaption 9600 Baud */
#define ISDN_PROTO_L2_V11019 8 /* V.110 bitrate adaption 19200 Baud */
#define ISDN_PROTO_L2_V11038 9 /* V.110 bitrate adaption 38400 Baud */
#define ISDN_PROTO_L2_MODEM 10 /* Analog Modem on Board */
#define ISDN_PROTO_L2_FAX 11 /* Fax Group 2/3 */
#define ISDN_PROTO_L2_HDLC_56K 12 /* HDLC 56k */
#define ISDN_PROTO_L2_MAX 15 /* Max. 16 Protocols */
/*
* Values for Layer-3-protocol-selection
*/
#define ISDN_PROTO_L3_TRANS 0 /* Transparent */
#define ISDN_PROTO_L3_TRANSDSP 1 /* Transparent with DSP */
#define ISDN_PROTO_L3_FCLASS2 2 /* Fax Group 2/3 CLASS 2 */
#define ISDN_PROTO_L3_FCLASS1 3 /* Fax Group 2/3 CLASS 1 */
#define ISDN_PROTO_L3_MAX 7 /* Max. 8 Protocols */