From ebec90347e4c538ea294bd055e5b2eb81a525abe Mon Sep 17 00:00:00 2001 From: maxv Date: Sun, 23 Sep 2018 09:20:57 +0000 Subject: [PATCH] Remove ISDN from the kernel. It has remained unmaintained for a long time, is of poor quality, and is now an obstacle to MP-ification. It was removed ten years ago from FreeBSD for the same reason. This retires a big user of the mbuf API, and will ease maintenance of the kernel. --- distrib/sets/lists/base/mi | 4 +- distrib/sets/lists/comp/mi | 16 +- distrib/sets/lists/man/mi | 50 +- etc/MAKEDEV.tmpl | 43 +- etc/etc.aarch64/MAKEDEV.conf | 4 +- etc/etc.acorn32/MAKEDEV.conf | 3 +- etc/etc.algor/MAKEDEV.conf | 4 +- etc/etc.alpha/MAKEDEV.conf | 4 +- etc/etc.amd64/MAKEDEV.conf | 3 +- etc/etc.amiga/MAKEDEV.conf | 3 +- etc/etc.amigappc/MAKEDEV.conf | 3 +- etc/etc.arc/MAKEDEV.conf | 3 +- etc/etc.atari/MAKEDEV.conf | 3 +- etc/etc.bebox/MAKEDEV.conf | 3 +- etc/etc.cats/MAKEDEV.conf | 4 +- etc/etc.cobalt/MAKEDEV.conf | 3 +- etc/etc.epoc32/MAKEDEV.conf | 4 +- etc/etc.evbarm/MAKEDEV.conf | 4 +- etc/etc.evbmips/MAKEDEV.conf | 4 +- etc/etc.evbppc/MAKEDEV.conf | 3 +- etc/etc.hpcmips/MAKEDEV.conf | 4 +- etc/etc.i386/MAKEDEV.conf | 3 +- etc/etc.ia64/MAKEDEV.conf | 3 +- etc/etc.iyonix/MAKEDEV.conf | 4 +- etc/etc.macppc/MAKEDEV.conf | 3 +- etc/etc.mvmeppc/MAKEDEV.conf | 3 +- etc/etc.netwinder/MAKEDEV.conf | 4 +- etc/etc.ofppc/MAKEDEV.conf | 3 +- etc/etc.or1k/MAKEDEV.conf | 4 +- etc/etc.prep/MAKEDEV.conf | 3 +- etc/etc.rs6000/MAKEDEV.conf | 3 +- etc/etc.sbmips/MAKEDEV.conf | 4 +- etc/etc.sgimips/MAKEDEV.conf | 3 +- etc/etc.sparc/MAKEDEV.conf | 3 +- etc/etc.sparc64/MAKEDEV.conf | 3 +- etc/etc.x68k/MAKEDEV.conf | 3 +- etc/etc.zaurus/MAKEDEV.conf | 4 +- etc/mtree/NetBSD.dist.base | 3 +- share/man/man4/Makefile | 6 +- share/man/man4/ippp.4 | 139 -- share/man/man4/irip.4 | 99 -- share/man/man4/isdn.4 | 109 -- share/man/man4/isdnbchan.4 | 51 - share/man/man4/isdncapi.4 | 62 - share/man/man4/isdnctl.4 | 52 - share/man/man4/isdntel.4 | 135 -- share/man/man4/isdntrc.4 | 57 - share/man/man5/rc.conf.5 | 6 +- share/man/man7/src.7 | 7 +- share/man/man9/ioctl.9 | 12 +- sys/Makefile | 4 +- sys/arch/aarch64/conf/majors.aarch64 | 8 +- sys/arch/acorn32/conf/majors.acorn32 | 7 +- sys/arch/algor/conf/majors.algor | 7 +- sys/arch/alpha/conf/majors.alpha | 7 +- sys/arch/amd64/conf/ALL | 8 +- sys/arch/amd64/conf/majors.amd64 | 7 +- sys/arch/amiga/conf/majors.amiga | 7 +- sys/arch/amigappc/conf/majors.amigappc | 7 +- sys/arch/arc/conf/majors.arc | 7 +- sys/arch/arm/conf/majors.arm32 | 8 +- sys/arch/atari/conf/majors.atari | 7 +- sys/arch/bebox/conf/majors.bebox | 7 +- sys/arch/cobalt/conf/majors.cobalt | 7 +- sys/arch/epoc32/conf/majors.epoc32 | 8 +- sys/arch/evbmips/conf/majors.evbmips | 7 +- sys/arch/evbppc/conf/majors.evbppc | 7 +- sys/arch/hpcarm/conf/majors.hpcarm | 8 +- sys/arch/hpcmips/conf/majors.hpcmips | 7 +- sys/arch/i386/conf/ALL | 8 +- sys/arch/i386/conf/majors.i386 | 7 +- sys/arch/ia64/conf/majors.ia64 | 7 +- sys/arch/ibmnws/conf/majors.ibmnws | 7 +- sys/arch/mvmeppc/conf/majors.mvmeppc | 7 +- sys/arch/powerpc/conf/majors.powerpc | 7 +- sys/arch/prep/conf/majors.prep | 7 +- sys/arch/riscv/conf/majors.riscv | 7 +- sys/arch/sgimips/conf/majors.sgimips | 7 +- sys/arch/sparc/conf/majors.sparc | 7 +- sys/arch/sparc64/conf/majors.sparc64 | 7 +- sys/arch/x68k/conf/majors.x68k | 7 +- sys/arch/zaurus/conf/majors.zaurus | 8 +- sys/conf/files | 22 +- sys/dev/DEVNAMES | 9 +- sys/net/files.net | 4 +- sys/netisdn/Makefile | 8 - sys/netisdn/files.i4b | 35 - sys/netisdn/i4b_capi.h | 134 -- sys/netisdn/i4b_capi_l4if.c | 427 ----- sys/netisdn/i4b_capi_llif.c | 164 -- sys/netisdn/i4b_capi_msgs.c | 982 ------------ sys/netisdn/i4b_capi_msgs.h | 382 ----- sys/netisdn/i4b_cause.h | 149 -- sys/netisdn/i4b_ctl.c | 383 ----- sys/netisdn/i4b_debug.h | 311 ---- sys/netisdn/i4b_global.h | 157 -- sys/netisdn/i4b_i4bdrv.c | 1137 ------------- sys/netisdn/i4b_iframe.c | 292 ---- sys/netisdn/i4b_ioctl.h | 630 -------- sys/netisdn/i4b_ipr.c | 1202 -------------- sys/netisdn/i4b_isdnq931.h | 173 -- sys/netisdn/i4b_isppp.c | 751 --------- sys/netisdn/i4b_isppp.h | 253 --- sys/netisdn/i4b_l1l2.h | 85 - sys/netisdn/i4b_l2.c | 403 ----- sys/netisdn/i4b_l2.h | 367 ----- sys/netisdn/i4b_l2fsm.c | 1602 ------------------- sys/netisdn/i4b_l2fsm.h | 83 - sys/netisdn/i4b_l2if.c | 607 ------- sys/netisdn/i4b_l2timer.c | 259 --- sys/netisdn/i4b_l3.h | 75 - sys/netisdn/i4b_l3fsm.c | 1055 ------------ sys/netisdn/i4b_l3fsm.h | 107 -- sys/netisdn/i4b_l3l4.h | 298 ---- sys/netisdn/i4b_l3timer.c | 355 ---- sys/netisdn/i4b_l4.c | 1237 -------------- sys/netisdn/i4b_l4.h | 75 - sys/netisdn/i4b_l4if.c | 333 ---- sys/netisdn/i4b_l4mgmt.c | 380 ----- sys/netisdn/i4b_l4timer.c | 112 -- sys/netisdn/i4b_lme.c | 166 -- sys/netisdn/i4b_mbuf.c | 247 --- sys/netisdn/i4b_mbuf.h | 57 - sys/netisdn/i4b_q931.c | 726 --------- sys/netisdn/i4b_q931.h | 120 -- sys/netisdn/i4b_q932fac.c | 572 ------- sys/netisdn/i4b_q932fac.h | 173 -- sys/netisdn/i4b_rbch.c | 1225 -------------- sys/netisdn/i4b_rbch_ioctl.h | 57 - sys/netisdn/i4b_sframe.c | 231 --- sys/netisdn/i4b_tei.c | 337 ---- sys/netisdn/i4b_tel.c | 2045 ------------------------ sys/netisdn/i4b_tel_ioctl.h | 96 -- sys/netisdn/i4b_trace.c | 442 ----- sys/netisdn/i4b_trace.h | 94 -- sys/netisdn/i4b_uframe.c | 300 ---- sys/netisdn/i4b_util.c | 332 ---- 137 files changed, 128 insertions(+), 23321 deletions(-) delete mode 100644 share/man/man4/ippp.4 delete mode 100644 share/man/man4/irip.4 delete mode 100644 share/man/man4/isdn.4 delete mode 100644 share/man/man4/isdnbchan.4 delete mode 100644 share/man/man4/isdncapi.4 delete mode 100644 share/man/man4/isdnctl.4 delete mode 100644 share/man/man4/isdntel.4 delete mode 100644 share/man/man4/isdntrc.4 delete mode 100644 sys/netisdn/Makefile delete mode 100644 sys/netisdn/files.i4b delete mode 100644 sys/netisdn/i4b_capi.h delete mode 100644 sys/netisdn/i4b_capi_l4if.c delete mode 100644 sys/netisdn/i4b_capi_llif.c delete mode 100644 sys/netisdn/i4b_capi_msgs.c delete mode 100644 sys/netisdn/i4b_capi_msgs.h delete mode 100644 sys/netisdn/i4b_cause.h delete mode 100644 sys/netisdn/i4b_ctl.c delete mode 100644 sys/netisdn/i4b_debug.h delete mode 100644 sys/netisdn/i4b_global.h delete mode 100644 sys/netisdn/i4b_i4bdrv.c delete mode 100644 sys/netisdn/i4b_iframe.c delete mode 100644 sys/netisdn/i4b_ioctl.h delete mode 100644 sys/netisdn/i4b_ipr.c delete mode 100644 sys/netisdn/i4b_isdnq931.h delete mode 100644 sys/netisdn/i4b_isppp.c delete mode 100644 sys/netisdn/i4b_isppp.h delete mode 100644 sys/netisdn/i4b_l1l2.h delete mode 100644 sys/netisdn/i4b_l2.c delete mode 100644 sys/netisdn/i4b_l2.h delete mode 100644 sys/netisdn/i4b_l2fsm.c delete mode 100644 sys/netisdn/i4b_l2fsm.h delete mode 100644 sys/netisdn/i4b_l2if.c delete mode 100644 sys/netisdn/i4b_l2timer.c delete mode 100644 sys/netisdn/i4b_l3.h delete mode 100644 sys/netisdn/i4b_l3fsm.c delete mode 100644 sys/netisdn/i4b_l3fsm.h delete mode 100644 sys/netisdn/i4b_l3l4.h delete mode 100644 sys/netisdn/i4b_l3timer.c delete mode 100644 sys/netisdn/i4b_l4.c delete mode 100644 sys/netisdn/i4b_l4.h delete mode 100644 sys/netisdn/i4b_l4if.c delete mode 100644 sys/netisdn/i4b_l4mgmt.c delete mode 100644 sys/netisdn/i4b_l4timer.c delete mode 100644 sys/netisdn/i4b_lme.c delete mode 100644 sys/netisdn/i4b_mbuf.c delete mode 100644 sys/netisdn/i4b_mbuf.h delete mode 100644 sys/netisdn/i4b_q931.c delete mode 100644 sys/netisdn/i4b_q931.h delete mode 100644 sys/netisdn/i4b_q932fac.c delete mode 100644 sys/netisdn/i4b_q932fac.h delete mode 100644 sys/netisdn/i4b_rbch.c delete mode 100644 sys/netisdn/i4b_rbch_ioctl.h delete mode 100644 sys/netisdn/i4b_sframe.c delete mode 100644 sys/netisdn/i4b_tei.c delete mode 100644 sys/netisdn/i4b_tel.c delete mode 100644 sys/netisdn/i4b_tel_ioctl.h delete mode 100644 sys/netisdn/i4b_trace.c delete mode 100644 sys/netisdn/i4b_trace.h delete mode 100644 sys/netisdn/i4b_uframe.c delete mode 100644 sys/netisdn/i4b_util.c diff --git a/distrib/sets/lists/base/mi b/distrib/sets/lists/base/mi index 620ba38ca49e..17ffb839bb7a 100644 --- a/distrib/sets/lists/base/mi +++ b/distrib/sets/lists/base/mi @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1189 2018/09/23 07:24:19 maxv Exp $ +# $NetBSD: mi,v 1.1190 2018/09/23 09:20:57 maxv Exp $ # # Note: Don't delete entries from here - mark them as "obsolete" instead, # unless otherwise stated below. @@ -1213,7 +1213,7 @@ ./usr/include/netinet base-c-usr ./usr/include/netinet6 base-c-usr ./usr/include/netipsec base-c-usr -./usr/include/netisdn base-c-usr +./usr/include/netisdn base-obsolete obsolete ./usr/include/netiso base-obsolete obsolete ./usr/include/netkey base-obsolete obsolete ./usr/include/netmpls base-c-usr diff --git a/distrib/sets/lists/comp/mi b/distrib/sets/lists/comp/mi index 3f54ae8d1993..80ad98f6e706 100644 --- a/distrib/sets/lists/comp/mi +++ b/distrib/sets/lists/comp/mi @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.2229 2018/09/22 12:54:34 rmind Exp $ +# $NetBSD: mi,v 1.2230 2018/09/23 09:20:57 maxv Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. ./etc/mtree/set.comp comp-sys-root @@ -2469,13 +2469,13 @@ ./usr/include/netipsec/ipsec_var.h comp-c-include ./usr/include/netipsec/ipsecif.h comp-c-include ./usr/include/netipsec/keydb.h comp-obsolete obsolete -./usr/include/netipsec/keysock.h comp-c-include -./usr/include/netisdn/i4b_cause.h comp-c-include -./usr/include/netisdn/i4b_debug.h comp-c-include -./usr/include/netisdn/i4b_ioctl.h comp-c-include -./usr/include/netisdn/i4b_rbch_ioctl.h comp-c-include -./usr/include/netisdn/i4b_tel_ioctl.h comp-c-include -./usr/include/netisdn/i4b_trace.h comp-c-include +./usr/include/netipsec/keysock.h comp-obsolete obsolete +./usr/include/netisdn/i4b_cause.h comp-obsolete obsolete +./usr/include/netisdn/i4b_debug.h comp-obsolete obsolete +./usr/include/netisdn/i4b_ioctl.h comp-obsolete obsolete +./usr/include/netisdn/i4b_rbch_ioctl.h comp-obsolete obsolete +./usr/include/netisdn/i4b_tel_ioctl.h comp-obsolete obsolete +./usr/include/netisdn/i4b_trace.h comp-obsolete obsolete ./usr/include/netiso/argo_debug.h comp-obsolete obsolete ./usr/include/netiso/clnl.h comp-obsolete obsolete ./usr/include/netiso/clnp.h comp-obsolete obsolete diff --git a/distrib/sets/lists/man/mi b/distrib/sets/lists/man/mi index 1e191a8aeda4..44f71a0b8e64 100644 --- a/distrib/sets/lists/man/mi +++ b/distrib/sets/lists/man/mi @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1624 2018/09/23 07:24:19 maxv Exp $ +# $NetBSD: mi,v 1.1625 2018/09/23 09:20:57 maxv Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -1332,24 +1332,24 @@ ./usr/share/man/cat4/ipl.0 man-ipf-catman ipfilter,.cat ./usr/share/man/cat4/ipmi.0 man-sys-catman .cat ./usr/share/man/cat4/ipnat.0 man-ipf-catman ipfilter,.cat -./usr/share/man/cat4/ippp.0 man-sys-catman .cat +./usr/share/man/cat4/ippp.0 man-obsolete obsolete ./usr/share/man/cat4/ipsec.0 man-sys-catman .cat ./usr/share/man/cat4/ipsecif.0 man-sys-catman .cat ./usr/share/man/cat4/ipw.0 man-sys-catman .cat ./usr/share/man/cat4/irda.0 man-sys-catman .cat ./usr/share/man/cat4/irframe.0 man-sys-catman .cat ./usr/share/man/cat4/irframetty.0 man-sys-catman .cat -./usr/share/man/cat4/irip.0 man-sys-catman .cat +./usr/share/man/cat4/irip.0 man-obsolete obsolete ./usr/share/man/cat4/irmce.0 man-sys-catman .cat ./usr/share/man/cat4/isa.0 man-sys-catman .cat ./usr/share/man/cat4/isabeep.0 man-sys-catman .cat ./usr/share/man/cat4/isapnp.0 man-sys-catman .cat -./usr/share/man/cat4/isdn.0 man-sys-catman .cat -./usr/share/man/cat4/isdnbchan.0 man-sys-catman .cat -./usr/share/man/cat4/isdncapi.0 man-sys-catman .cat -./usr/share/man/cat4/isdnctl.0 man-sys-catman .cat -./usr/share/man/cat4/isdntel.0 man-sys-catman .cat -./usr/share/man/cat4/isdntrc.0 man-sys-catman .cat +./usr/share/man/cat4/isdn.0 man-obsolete obsolete +./usr/share/man/cat4/isdnbchan.0 man-obsolete obsolete +./usr/share/man/cat4/isdncapi.0 man-obsolete obsolete +./usr/share/man/cat4/isdnctl.0 man-obsolete obsolete +./usr/share/man/cat4/isdntel.0 man-obsolete obsolete +./usr/share/man/cat4/isdntrc.0 man-obsolete obsolete ./usr/share/man/cat4/isic.0 man-obsolete obsolete ./usr/share/man/cat4/ismt.0 man-sys-catman .cat ./usr/share/man/cat4/iso.0 man-obsolete obsolete @@ -4450,24 +4450,24 @@ ./usr/share/man/html4/ipl.html man-ipf-htmlman ipfilter,html ./usr/share/man/html4/ipmi.html man-sys-htmlman html ./usr/share/man/html4/ipnat.html man-ipf-htmlman ipfilter,html -./usr/share/man/html4/ippp.html man-sys-htmlman html +./usr/share/man/html4/ippp.html man-obsolete obsolete ./usr/share/man/html4/ipsec.html man-sys-htmlman html ./usr/share/man/html4/ipsecif.html man-sys-htmlman html ./usr/share/man/html4/ipw.html man-sys-htmlman html ./usr/share/man/html4/irda.html man-sys-htmlman html ./usr/share/man/html4/irframe.html man-sys-htmlman html ./usr/share/man/html4/irframetty.html man-sys-htmlman html -./usr/share/man/html4/irip.html man-sys-htmlman html +./usr/share/man/html4/irip.html man-obsolete obsolete ./usr/share/man/html4/irmce.html man-sys-htmlman html ./usr/share/man/html4/isa.html man-sys-htmlman html ./usr/share/man/html4/isabeep.html man-sys-htmlman html ./usr/share/man/html4/isapnp.html man-sys-htmlman html -./usr/share/man/html4/isdn.html man-sys-htmlman html -./usr/share/man/html4/isdnbchan.html man-sys-htmlman html -./usr/share/man/html4/isdncapi.html man-sys-htmlman html -./usr/share/man/html4/isdnctl.html man-sys-htmlman html -./usr/share/man/html4/isdntel.html man-sys-htmlman html -./usr/share/man/html4/isdntrc.html man-sys-htmlman html +./usr/share/man/html4/isdn.html man-obsolete obsolete +./usr/share/man/html4/isdnbchan.html man-obsolete obsolete +./usr/share/man/html4/isdncapi.html man-obsolete obsolete +./usr/share/man/html4/isdnctl.html man-obsolete obsolete +./usr/share/man/html4/isdntel.html man-obsolete obsolete +./usr/share/man/html4/isdntrc.html man-obsolete obsolete ./usr/share/man/html4/isic.html man-obsolete obsolete ./usr/share/man/html4/ismt.html man-sys-htmlman html ./usr/share/man/html4/iso.html man-obsolete obsolete @@ -7406,24 +7406,24 @@ ./usr/share/man/man4/ipl.4 man-sys-man ipfilter,.man ./usr/share/man/man4/ipmi.4 man-sys-man .man ./usr/share/man/man4/ipnat.4 man-sys-man ipfilter,.man -./usr/share/man/man4/ippp.4 man-sys-man .man +./usr/share/man/man4/ippp.4 man-obsolete obsolete ./usr/share/man/man4/ipsec.4 man-sys-man .man ./usr/share/man/man4/ipsecif.4 man-sys-man .man ./usr/share/man/man4/ipw.4 man-sys-man .man ./usr/share/man/man4/irda.4 man-sys-man .man ./usr/share/man/man4/irframe.4 man-sys-man .man ./usr/share/man/man4/irframetty.4 man-sys-man .man -./usr/share/man/man4/irip.4 man-sys-man .man +./usr/share/man/man4/irip.4 man-obsolete obsolete ./usr/share/man/man4/irmce.4 man-sys-man .man ./usr/share/man/man4/isa.4 man-sys-man .man ./usr/share/man/man4/isabeep.4 man-sys-man .man ./usr/share/man/man4/isapnp.4 man-sys-man .man -./usr/share/man/man4/isdn.4 man-sys-man .man -./usr/share/man/man4/isdnbchan.4 man-sys-man .man -./usr/share/man/man4/isdncapi.4 man-sys-man .man -./usr/share/man/man4/isdnctl.4 man-sys-man .man -./usr/share/man/man4/isdntel.4 man-sys-man .man -./usr/share/man/man4/isdntrc.4 man-sys-man .man +./usr/share/man/man4/isdn.4 man-obsolete obsolete +./usr/share/man/man4/isdnbchan.4 man-obsolete obsolete +./usr/share/man/man4/isdncapi.4 man-obsolete obsolete +./usr/share/man/man4/isdnctl.4 man-obsolete obsolete +./usr/share/man/man4/isdntel.4 man-obsolete obsolete +./usr/share/man/man4/isdntrc.4 man-obsolete obsolete ./usr/share/man/man4/isic.4 man-obsolete obsolete ./usr/share/man/man4/ismt.4 man-sys-man .man ./usr/share/man/man4/iso.4 man-obsolete obsolete diff --git a/etc/MAKEDEV.tmpl b/etc/MAKEDEV.tmpl index 961d506cc641..2b1148eb20c4 100644 --- a/etc/MAKEDEV.tmpl +++ b/etc/MAKEDEV.tmpl @@ -1,5 +1,5 @@ #!/bin/sh - -# $NetBSD: MAKEDEV.tmpl,v 1.193 2018/09/22 13:48:22 kre Exp $ +# $NetBSD: MAKEDEV.tmpl,v 1.194 2018/09/23 09:20:57 maxv Exp $ # # Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -45,7 +45,6 @@ # lua Lua device # wscons make wscons devices # usbs make USB devices -# isdns make ISDN devices # # Tapes: # st* SCSI tapes @@ -187,14 +186,6 @@ # ttyU* USB modems # ttyY* USB serial adapters # -# ISDN devices: -# isdn communication between userland isdnd and kernel -# isdnctl control device -# isdnbchan* raw b-channel access -# isdntel* telephony device -# isdnteld* telephony dialout device -# isdntrc* trace device -# # Video devices: # bwtwo* monochromatic frame buffer # cgtwo* 8-bit color frame buffer @@ -927,10 +918,6 @@ usbs) makedev ugen0 ugen1 ugen2 ugen3 ;; -isdns) - makedev isdn isdnctl isdnbchan0 isdnbchan1 isdntel0 isdntel1 isdnteld0 isdnteld1 isdntrc0 isdntrc1 - ;; - std) mkdev console c %cons_chr% 0 600 mkdev constty c %cons_chr% 1 600 @@ -1724,34 +1711,6 @@ altq) done ;; -isdn) - mkdev isdn c %isdn_chr% 0 - ;; - -isdnctl) - mkdev isdnctl c %isdnctl_chr% 0 - ;; - -isdnbchan[0-9]*) - unit=${i#isdnbchan} - mkdev isdnbchan$unit c %isdnbchan_chr% $unit - ;; - -isdnteld[0-9]*) - unit=${i#isdnteld} - mkdev isdnteld$unit c %isdntel_chr% $(($unit + 64)) - ;; - -isdntel[0-9]*) - unit=${i#isdntel} - mkdev isdntel$unit c %isdntel_chr% $unit - ;; - -isdntrc[0-9]*) - unit=${i#isdntrc} - mkdev isdntrc$unit c %isdntrc_chr% $unit - ;; - wsfont) mkdev wsfont c %wsfont_chr% 0 ;; diff --git a/etc/etc.aarch64/MAKEDEV.conf b/etc/etc.aarch64/MAKEDEV.conf index 6c4a1015cfac..2251d4d0b262 100644 --- a/etc/etc.aarch64/MAKEDEV.conf +++ b/etc/etc.aarch64/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.4 2018/04/28 12:45:03 jmcneill Exp $ +# $NetBSD: MAKEDEV.conf,v 1.5 2018/09/23 09:20:57 maxv Exp $ all_md) makedev wscons fd0 fd1 wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3 @@ -7,7 +7,7 @@ all_md) makedev tty0 tty1 plcom0 st0 st1 ch0 cd0 cd1 makedev uk0 uk1 ss0 makedev lpa0 lpt0 - makedev usbs isdns + makedev usbs makedev music rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev sysmon diff --git a/etc/etc.acorn32/MAKEDEV.conf b/etc/etc.acorn32/MAKEDEV.conf index 407b094105ee..19f5f5109788 100644 --- a/etc/etc.acorn32/MAKEDEV.conf +++ b/etc/etc.acorn32/MAKEDEV.conf @@ -1,11 +1,10 @@ -# $NetBSD: MAKEDEV.conf,v 1.10 2012/08/16 13:31:24 abs Exp $ +# $NetBSD: MAKEDEV.conf,v 1.11 2018/09/23 09:20:57 maxv Exp $ all_md) makedev wscons fd0 fd1 wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3 makedev tty0 tty1 st0 st1 ch0 cd0 cd1 makedev uk0 uk1 ss0 makedev lpa0 lpt0 - makedev isdns makedev music rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 diff --git a/etc/etc.algor/MAKEDEV.conf b/etc/etc.algor/MAKEDEV.conf index c6dc76301b4c..09f37d3a0c7e 100644 --- a/etc/etc.algor/MAKEDEV.conf +++ b/etc/etc.algor/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.5 2016/12/08 11:31:13 nat Exp $ +# $NetBSD: MAKEDEV.conf,v 1.6 2018/09/23 09:20:57 maxv Exp $ all_md) makedev wscons sd0 sd1 sd2 sd3 sd4 @@ -10,7 +10,7 @@ all_md) makedev satlink0 speaker mlx0 makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 - makedev usbs isdns + makedev usbs makedev music rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 makedev ttyCZ0 ttyCY0 makedev altq diff --git a/etc/etc.alpha/MAKEDEV.conf b/etc/etc.alpha/MAKEDEV.conf index fa5023c4fc6b..722f0e7154ea 100644 --- a/etc/etc.alpha/MAKEDEV.conf +++ b/etc/etc.alpha/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.11 2014/01/24 23:59:12 martin Exp $ +# $NetBSD: MAKEDEV.conf,v 1.12 2018/09/23 09:20:57 maxv Exp $ all_md) makedev wscons stic0 sd0 sd1 sd2 sd3 sd4 @@ -11,7 +11,7 @@ all_md) makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 makedev sysmon - makedev usbs isdns + makedev usbs makedev music rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 makedev ttyCZ0 ttyCY0 makedev agp0 diff --git a/etc/etc.amd64/MAKEDEV.conf b/etc/etc.amd64/MAKEDEV.conf index c38bc5828af0..41c3d2785a38 100644 --- a/etc/etc.amd64/MAKEDEV.conf +++ b/etc/etc.amd64/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.23 2016/09/08 14:44:44 nonaka Exp $ +# $NetBSD: MAKEDEV.conf,v 1.24 2018/09/23 09:20:58 maxv Exp $ # As of 2003-04-17, the "init" case must not create more than 890 entries. all_md) @@ -29,7 +29,6 @@ all_md) makedev satlink0 makedev audio makedev radio - makedev isdns makedev music rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 diff --git a/etc/etc.amiga/MAKEDEV.conf b/etc/etc.amiga/MAKEDEV.conf index 4ec51648794c..c0be697deacb 100644 --- a/etc/etc.amiga/MAKEDEV.conf +++ b/etc/etc.amiga/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.12 2016/12/08 11:31:13 nat Exp $ +# $NetBSD: MAKEDEV.conf,v 1.13 2018/09/23 09:20:58 maxv Exp $ all_md) makedev wscons std_amiga fd0 fd1 fd2 fd3 kbd mouse0 mouse1 par0 @@ -15,7 +15,6 @@ all_md) makedev vnd4 vnd5 vnd6 makedev audio speaker makedev scsibus0 scsibus1 scsibus2 scsibus3 - makedev isdns makedev nsmb ;; diff --git a/etc/etc.amigappc/MAKEDEV.conf b/etc/etc.amigappc/MAKEDEV.conf index b7d46013664b..5c3588f4a48f 100644 --- a/etc/etc.amigappc/MAKEDEV.conf +++ b/etc/etc.amigappc/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.3 2016/12/08 11:31:13 nat Exp $ +# $NetBSD: MAKEDEV.conf,v 1.4 2018/09/23 09:20:58 maxv Exp $ all_md) makedev wscons std_amiga fd0 fd1 fd2 fd3 kbd mouse0 mouse1 par0 @@ -14,7 +14,6 @@ all_md) makedev vnd4 vnd5 vnd6 makedev audio speaker makedev scsibus0 scsibus1 scsibus2 scsibus3 - makedev isdns makedev nsmb ;; diff --git a/etc/etc.arc/MAKEDEV.conf b/etc/etc.arc/MAKEDEV.conf index 19783b11d705..928fcceecee5 100644 --- a/etc/etc.arc/MAKEDEV.conf +++ b/etc/etc.arc/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.6 2007/01/15 23:35:11 hubertf Exp $ +# $NetBSD: MAKEDEV.conf,v 1.7 2018/09/23 09:20:58 maxv Exp $ all_md) makedev wscons sd0 sd1 sd2 sd3 sd4 @@ -9,7 +9,6 @@ all_md) makedev ttyv0 pms0 joy0 makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 - makedev isdns ;; minimal) diff --git a/etc/etc.atari/MAKEDEV.conf b/etc/etc.atari/MAKEDEV.conf index 57fecde251ba..e1ac69bbbbde 100644 --- a/etc/etc.atari/MAKEDEV.conf +++ b/etc/etc.atari/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.11 2016/12/08 11:31:13 nat Exp $ +# $NetBSD: MAKEDEV.conf,v 1.12 2018/09/23 09:20:58 maxv Exp $ all_md) makedev std_atari st0 ttye0 ttye1 ttye2 ttye3 ttye4 ttye5 grf0 grf1 @@ -11,7 +11,6 @@ all_md) makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 makedev audio speaker - makedev isdns makedev wscons ;; diff --git a/etc/etc.bebox/MAKEDEV.conf b/etc/etc.bebox/MAKEDEV.conf index be25d713279c..c54aa7a63a8a 100644 --- a/etc/etc.bebox/MAKEDEV.conf +++ b/etc/etc.bebox/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.8 2012/08/16 13:31:24 abs Exp $ +# $NetBSD: MAKEDEV.conf,v 1.9 2018/09/23 09:20:58 maxv Exp $ all_md) makedev wt0 fd0 fd1 wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3 sd4 @@ -10,7 +10,6 @@ all_md) makedev ttyv0 wscons makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 - makedev isdns makedev pci0 pci1 pci2 pci3 pci4 pci5 pci6 pci7 makedev bktr ;; diff --git a/etc/etc.cats/MAKEDEV.conf b/etc/etc.cats/MAKEDEV.conf index 986fc3fc4c9a..3fc083f012ba 100644 --- a/etc/etc.cats/MAKEDEV.conf +++ b/etc/etc.cats/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.9 2016/12/08 11:31:13 nat Exp $ +# $NetBSD: MAKEDEV.conf,v 1.10 2018/09/23 09:20:58 maxv Exp $ all_md) makedev wscons std_cats fd0 fd1 wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3 @@ -6,7 +6,7 @@ all_md) makedev uk0 uk1 ss0 makedev ttyv0 makedev lpa0 lpt0 - makedev usbs isdns + makedev usbs makedev music rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev pci0 pci1 diff --git a/etc/etc.cobalt/MAKEDEV.conf b/etc/etc.cobalt/MAKEDEV.conf index 7514c525cfc4..06fa8e2ec9ff 100644 --- a/etc/etc.cobalt/MAKEDEV.conf +++ b/etc/etc.cobalt/MAKEDEV.conf @@ -1,11 +1,10 @@ -# $NetBSD: MAKEDEV.conf,v 1.15 2018/04/09 20:17:33 christos Exp $ +# $NetBSD: MAKEDEV.conf,v 1.16 2018/09/23 09:20:58 maxv Exp $ all_md) makedev wd0 wd1 sd0 sd1 sd2 sd3 makedev st0 st1 ch0 cd0 cd1 makedev ss0 ss1 uk0 uk1 makedev tty00 tty01 tty02 tty03 ttyZ0 ttyZ1 - makedev isdns makedev audio speaker makedev music rmidi0 rmidi1 makedev scsibus0 scsibus1 scsibus2 scsibus3 diff --git a/etc/etc.epoc32/MAKEDEV.conf b/etc/etc.epoc32/MAKEDEV.conf index 91c318ddc2f0..b89a46e02d8a 100644 --- a/etc/etc.epoc32/MAKEDEV.conf +++ b/etc/etc.epoc32/MAKEDEV.conf @@ -1,10 +1,10 @@ -# $NetBSD: MAKEDEV.conf,v 1.2 2016/12/08 11:31:13 nat Exp $ +# $NetBSD: MAKEDEV.conf,v 1.3 2018/09/23 09:20:58 maxv Exp $ all_md) makedev wscons wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3 makedev tty0 tty1 st0 st1 ch0 cd0 cd1 makedev uk0 uk1 ss0 - makedev usbs isdns + makedev usbs makedev music rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 makedev scsibus0 makedev ses0 ses1 ses2 ses3 diff --git a/etc/etc.evbarm/MAKEDEV.conf b/etc/etc.evbarm/MAKEDEV.conf index 475654031d6b..b1080a380c47 100644 --- a/etc/etc.evbarm/MAKEDEV.conf +++ b/etc/etc.evbarm/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.17 2017/06/02 22:20:21 jmcneill Exp $ +# $NetBSD: MAKEDEV.conf,v 1.18 2018/09/23 09:20:58 maxv Exp $ all_md) makedev wscons fd0 fd1 wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3 @@ -8,7 +8,7 @@ all_md) makedev st0 st1 ch0 cd0 cd1 makedev uk0 uk1 ss0 makedev lpa0 lpt0 - makedev usbs isdns + makedev usbs makedev music rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev sysmon diff --git a/etc/etc.evbmips/MAKEDEV.conf b/etc/etc.evbmips/MAKEDEV.conf index 119a70ddd457..577d070815e4 100644 --- a/etc/etc.evbmips/MAKEDEV.conf +++ b/etc/etc.evbmips/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.8 2017/08/15 10:11:31 mrg Exp $ +# $NetBSD: MAKEDEV.conf,v 1.9 2018/09/23 09:20:58 maxv Exp $ # When creating a /dev file system on MFS, init makes a FS that leaves # only 890 (or so) inodes free. Therefore the "init" case (used by @@ -28,7 +28,7 @@ all_md) makedev satlink0 speaker mlx0 makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 - makedev usbs isdns + makedev usbs makedev music rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 makedev ttyCZ0 ttyCY0 makedev pci0 pci1 pci2 pci3 pci4 pci5 pci6 pci7 diff --git a/etc/etc.evbppc/MAKEDEV.conf b/etc/etc.evbppc/MAKEDEV.conf index 8b88dd15c342..54ddcc5f4a6b 100644 --- a/etc/etc.evbppc/MAKEDEV.conf +++ b/etc/etc.evbppc/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.10 2016/12/08 11:31:13 nat Exp $ +# $NetBSD: MAKEDEV.conf,v 1.11 2018/09/23 09:20:59 maxv Exp $ all_md) makedev wscons sd0 sd1 sd2 st0 st1 cd0 cd1 wd0 wd1 @@ -11,7 +11,6 @@ all_md) makedev music rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 - makedev isdns makedev pci0 pci1 pci2 pci3 pci4 pci5 pci6 pci7 makedev sysmon makedev bktr diff --git a/etc/etc.hpcmips/MAKEDEV.conf b/etc/etc.hpcmips/MAKEDEV.conf index 79bae9abd5ba..d255b8d59c3c 100644 --- a/etc/etc.hpcmips/MAKEDEV.conf +++ b/etc/etc.hpcmips/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.7 2016/12/08 11:31:14 nat Exp $ +# $NetBSD: MAKEDEV.conf,v 1.8 2018/09/23 09:20:59 maxv Exp $ all_md) makedev wscons fd0 fd1 wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3 sd4 @@ -6,7 +6,7 @@ all_md) makedev tty0 tty1 tty2 makedev st0 st1 ch0 cd0 cd1 makedev ss0 ch0 uk0 uk1 - makedev usbs isdns + makedev usbs makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 makedev ttyTX0 ttyTX1 ucbsnd diff --git a/etc/etc.i386/MAKEDEV.conf b/etc/etc.i386/MAKEDEV.conf index 003692802d49..1ebc2ea3b21d 100644 --- a/etc/etc.i386/MAKEDEV.conf +++ b/etc/etc.i386/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.26 2018/01/05 10:04:13 msaitoh Exp $ +# $NetBSD: MAKEDEV.conf,v 1.27 2018/09/23 09:20:59 maxv Exp $ # As of 2005-03-15, the "init" case must not create more than 1024 entries. all_md) @@ -31,7 +31,6 @@ all_md) makedev cmos makedev audio makedev radio - makedev isdns makedev music rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 diff --git a/etc/etc.ia64/MAKEDEV.conf b/etc/etc.ia64/MAKEDEV.conf index 89abd8fa861e..c21ac90928d7 100644 --- a/etc/etc.ia64/MAKEDEV.conf +++ b/etc/etc.ia64/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.1 2016/08/05 16:22:08 scole Exp $ +# $NetBSD: MAKEDEV.conf,v 1.2 2018/09/23 09:20:59 maxv Exp $ # As of 2005-03-15, the "init" case must not create more than 1024 entries. all_md) @@ -27,7 +27,6 @@ all_md) makedev cmos makedev audio makedev radio - makedev isdns makedev music rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 diff --git a/etc/etc.iyonix/MAKEDEV.conf b/etc/etc.iyonix/MAKEDEV.conf index 353206e37795..3d5ce72e6699 100644 --- a/etc/etc.iyonix/MAKEDEV.conf +++ b/etc/etc.iyonix/MAKEDEV.conf @@ -1,11 +1,11 @@ -# $NetBSD: MAKEDEV.conf,v 1.3 2012/08/16 13:31:25 abs Exp $ +# $NetBSD: MAKEDEV.conf,v 1.4 2018/09/23 09:20:59 maxv Exp $ all_md) makedev wscons fd0 fd1 wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3 makedev tty0 tty1 st0 st1 ch0 cd0 cd1 makedev uk0 uk1 ss0 makedev lpa0 lpt0 - makedev usbs isdns + makedev usbs makedev music rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev sysmon diff --git a/etc/etc.macppc/MAKEDEV.conf b/etc/etc.macppc/MAKEDEV.conf index 7ee2cc08e9f9..9d7fa6800457 100644 --- a/etc/etc.macppc/MAKEDEV.conf +++ b/etc/etc.macppc/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.11 2017/11/15 04:31:48 macallan Exp $ +# $NetBSD: MAKEDEV.conf,v 1.12 2018/09/23 09:20:59 maxv Exp $ all_md) makedev wscons sd0 sd1 sd2 st0 st1 cd0 cd1 wd0 wd1 wd2 wd3 @@ -10,7 +10,6 @@ all_md) makedev nvram apm adb grf0 openfirm makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 - makedev isdns makedev pci0 pci1 pci2 pci3 pci4 pci5 pci6 pci7 pci8 pci9 pci10 pci11 makedev pci12 pci13 pci14 pci15 pci16 pci17 pci18 pci19 makedev altq diff --git a/etc/etc.mvmeppc/MAKEDEV.conf b/etc/etc.mvmeppc/MAKEDEV.conf index aa55862b2da6..cb69cadb742b 100644 --- a/etc/etc.mvmeppc/MAKEDEV.conf +++ b/etc/etc.mvmeppc/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.7 2012/08/16 13:31:26 abs Exp $ +# $NetBSD: MAKEDEV.conf,v 1.8 2018/09/23 09:20:59 maxv Exp $ all_md) makedev sd0 sd1 sd2 sd3 sd4 @@ -8,7 +8,6 @@ all_md) makedev ss0 ch0 uk0 uk1 makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 - makedev isdns ;; floppy) diff --git a/etc/etc.netwinder/MAKEDEV.conf b/etc/etc.netwinder/MAKEDEV.conf index 00272f314378..555dc33bb5f2 100644 --- a/etc/etc.netwinder/MAKEDEV.conf +++ b/etc/etc.netwinder/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.5 2012/08/16 13:31:26 abs Exp $ +# $NetBSD: MAKEDEV.conf,v 1.6 2018/09/23 09:20:59 maxv Exp $ all_md) makedev wscons fd0 fd1 wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3 @@ -6,7 +6,7 @@ all_md) makedev uk0 uk1 ss0 makedev ttyv0 makedev lpa0 lpt0 - makedev usbs isdns + makedev usbs makedev openfirm makedev music rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 makedev scsibus0 scsibus1 scsibus2 scsibus3 diff --git a/etc/etc.ofppc/MAKEDEV.conf b/etc/etc.ofppc/MAKEDEV.conf index 9330b3a34b09..2b37bf22c841 100644 --- a/etc/etc.ofppc/MAKEDEV.conf +++ b/etc/etc.ofppc/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.9 2012/08/16 13:31:26 abs Exp $ +# $NetBSD: MAKEDEV.conf,v 1.10 2018/09/23 09:20:59 maxv Exp $ all_md) makedev wscons sd0 sd1 sd2 st0 st1 cd0 cd1 wd0 wd1 fd0 fd1 @@ -10,7 +10,6 @@ all_md) makedev nvram apm adb grf0 openfirm makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 - makedev isdns makedev pci0 pci1 pci2 pci3 pci4 pci5 pci6 pci7 makedev altq sysmon bktr radio kttcp makedev lpt0 lpt1 lpt2 tun0 tun1 diff --git a/etc/etc.or1k/MAKEDEV.conf b/etc/etc.or1k/MAKEDEV.conf index 6327e752ac0a..1bdd2028899c 100644 --- a/etc/etc.or1k/MAKEDEV.conf +++ b/etc/etc.or1k/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.2 2016/12/08 11:31:14 nat Exp $ +# $NetBSD: MAKEDEV.conf,v 1.3 2018/09/23 09:20:59 maxv Exp $ all_md) makedev wscons fd0 fd1 wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3 @@ -7,7 +7,7 @@ all_md) makedev tty0 tty1 plcom0 st0 st1 ch0 cd0 cd1 makedev uk0 uk1 ss0 makedev lpa0 lpt0 - makedev usbs isdns + makedev usbs makedev music rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev sysmon diff --git a/etc/etc.prep/MAKEDEV.conf b/etc/etc.prep/MAKEDEV.conf index b0b455ed682f..e9239d2f2ab3 100644 --- a/etc/etc.prep/MAKEDEV.conf +++ b/etc/etc.prep/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.8 2012/08/16 13:31:26 abs Exp $ +# $NetBSD: MAKEDEV.conf,v 1.9 2018/09/23 09:20:59 maxv Exp $ all_md) makedev wscons fd0 fd1 wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3 sd4 @@ -12,7 +12,6 @@ all_md) makedev music rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 - makedev isdns makedev pci0 pci1 pci2 pci3 pci4 pci5 pci6 pci7 makedev nvram makedev residual diff --git a/etc/etc.rs6000/MAKEDEV.conf b/etc/etc.rs6000/MAKEDEV.conf index 1734c4e67f4b..390eba92343b 100644 --- a/etc/etc.rs6000/MAKEDEV.conf +++ b/etc/etc.rs6000/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.3 2012/08/16 13:31:26 abs Exp $ +# $NetBSD: MAKEDEV.conf,v 1.4 2018/09/23 09:20:59 maxv Exp $ all_md) makedev wscons fd0 fd1 sd0 sd1 sd2 sd3 sd4 @@ -12,7 +12,6 @@ all_md) makedev music rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 - makedev isdns # makedev pci0 pci1 pci2 pci3 pci4 pci5 pci6 pci7 # makedev nvram makedev cfs diff --git a/etc/etc.sbmips/MAKEDEV.conf b/etc/etc.sbmips/MAKEDEV.conf index d2e7bba01ee6..2a20af552afe 100644 --- a/etc/etc.sbmips/MAKEDEV.conf +++ b/etc/etc.sbmips/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.4 2004/12/02 16:44:28 christos Exp $ +# $NetBSD: MAKEDEV.conf,v 1.5 2018/09/23 09:21:00 maxv Exp $ # When creating a /dev file system on MFS, init makes a FS that leaves # only 890 (or so) inodes free. Therefore the "init" case (used by @@ -25,7 +25,7 @@ all_md) makedev tty00 tty01 makedev satlink0 mlx0 makedev scsibus0 scsibus1 scsibus2 scsibus3 - makedev usbs isdns + makedev usbs makedev ttyCZ0 ttyCY0 makedev pci0 pci1 pci2 pci3 pci4 pci5 pci6 pci7 makedev altq diff --git a/etc/etc.sgimips/MAKEDEV.conf b/etc/etc.sgimips/MAKEDEV.conf index e53eafc621e3..ca31b0977fd4 100644 --- a/etc/etc.sgimips/MAKEDEV.conf +++ b/etc/etc.sgimips/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.9 2016/12/08 11:31:14 nat Exp $ +# $NetBSD: MAKEDEV.conf,v 1.10 2018/09/23 09:21:00 maxv Exp $ # When creating a /dev file system on MFS, init makes a FS that leaves # only 890 (or so) inodes free. Therefore the "init" case (used by @@ -20,7 +20,6 @@ init) all_md) makedev init - makedev isdns makedev audio speaker makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 diff --git a/etc/etc.sparc/MAKEDEV.conf b/etc/etc.sparc/MAKEDEV.conf index 0d478181f7cb..a1be7e73d11d 100644 --- a/etc/etc.sparc/MAKEDEV.conf +++ b/etc/etc.sparc/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.17 2017/03/26 18:31:52 martin Exp $ +# $NetBSD: MAKEDEV.conf,v 1.18 2018/09/23 09:21:00 maxv Exp $ all_md) makedev std_sparc ttya ttyb ttyc ttyd ttyC00 ttyC01 @@ -14,7 +14,6 @@ all_md) makedev ses0 ses1 ses2 ses3 makedev sysmon makedev apm apmctl tctrl0 - makedev isdns makedev pci0 makedev wscons makedev kttcp diff --git a/etc/etc.sparc64/MAKEDEV.conf b/etc/etc.sparc64/MAKEDEV.conf index f5d042767ce7..28c9880e6724 100644 --- a/etc/etc.sparc64/MAKEDEV.conf +++ b/etc/etc.sparc64/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.18 2017/11/15 04:31:48 macallan Exp $ +# $NetBSD: MAKEDEV.conf,v 1.19 2018/09/23 09:21:00 maxv Exp $ all_md) makedev std_sparc64 ttya ttyb ttyc ttyd ttyC00 ttyC01 @@ -16,7 +16,6 @@ all_md) makedev sysmon makedev usbs makedev radio - makedev isdns makedev pci0 pci1 pci2 pci3 pci4 pci5 pci6 pci7 pci8 pci9 pci10 pci11 makedev pci12 pci13 pci14 pci15 pci16 pci17 pci18 pci19 makedev altq diff --git a/etc/etc.x68k/MAKEDEV.conf b/etc/etc.x68k/MAKEDEV.conf index 000941af2258..98c506ee7c8d 100644 --- a/etc/etc.x68k/MAKEDEV.conf +++ b/etc/etc.x68k/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.15 2016/12/08 11:31:15 nat Exp $ +# $NetBSD: MAKEDEV.conf,v 1.16 2018/09/23 09:21:00 maxv Exp $ all_md) makedev std_x68k st0 st1 ttye0 ttye1 mouse0 mouse1 @@ -13,7 +13,6 @@ all_md) makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 makedev sysmon - makedev isdns makedev usbs ;; diff --git a/etc/etc.zaurus/MAKEDEV.conf b/etc/etc.zaurus/MAKEDEV.conf index 45458842bd67..18dcacabed17 100644 --- a/etc/etc.zaurus/MAKEDEV.conf +++ b/etc/etc.zaurus/MAKEDEV.conf @@ -1,11 +1,11 @@ -# $NetBSD: MAKEDEV.conf,v 1.10 2016/12/08 11:31:15 nat Exp $ +# $NetBSD: MAKEDEV.conf,v 1.11 2018/09/23 09:21:00 maxv Exp $ all_md) makedev wscons wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3 ld0 makedev tty0 tty1 st0 st1 ch0 cd0 cd1 makedev uk0 uk1 ss0 makedev lpa0 lpt0 - makedev usbs isdns + makedev usbs makedev music rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 diff --git a/etc/mtree/NetBSD.dist.base b/etc/mtree/NetBSD.dist.base index ac7a40c87458..3a488bacfc82 100644 --- a/etc/mtree/NetBSD.dist.base +++ b/etc/mtree/NetBSD.dist.base @@ -1,4 +1,4 @@ -# $NetBSD: NetBSD.dist.base,v 1.176 2018/09/23 07:24:19 maxv Exp $ +# $NetBSD: NetBSD.dist.base,v 1.177 2018/09/23 09:21:00 maxv Exp $ # @(#)4.4BSD.dist 8.1 (Berkeley) 6/13/93 # Do not customize this file as it may be overwritten on upgrades. @@ -219,7 +219,6 @@ ./usr/include/net80211 ./usr/include/netinet6 ./usr/include/netipsec -./usr/include/netisdn ./usr/include/netpgp ./usr/include/netsmb ./usr/include/nfs diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 9beeda2c3df6..fee1a6aef87e 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.671 2018/09/22 16:22:22 maxv Exp $ +# $NetBSD: Makefile,v 1.672 2018/09/23 09:21:00 maxv Exp $ # @(#)Makefile 8.1 (Berkeley) 6/18/93 MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \ @@ -144,10 +144,6 @@ MAN += hil.4 hilkbd.4 hilid.4 hilms.4 # IPv6/IPsec MAN+= faith.4 gif.4 inet6.4 icmp6.4 ip6.4 ipsec.4 ipsecif.4 stf.4 -# ISDN devices -MAN+= isdntrc.4 isdntel.4 isdnbchan.4 ippp.4 irip.4 isdnctl.4 isdn.4 \ - isdncapi.4 - # onewire bus and devices MAN+= gpioow.4 onewire.4 owtemp.4 diff --git a/share/man/man4/ippp.4 b/share/man/man4/ippp.4 deleted file mode 100644 index 0dd9fa83ea64..000000000000 --- a/share/man/man4/ippp.4 +++ /dev/null @@ -1,139 +0,0 @@ -.\" $NetBSD: ippp.4,v 1.10 2014/03/18 18:20:39 riastradh Exp $ -.\" -.\" Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: ippp.4,v 1.10 2014/03/18 18:20:39 riastradh Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Thu Aug 31 10:40:17 2000] -.\" -.Dd August 31, 2000 -.Dt IPPP 4 -.Os -.Sh NAME -.Nm ippp -.Nd ISDN synchronous PPP network driver -.Sh SYNOPSIS -.Cd "pseudo-device ippp" Ar count -.Sh DESCRIPTION -The -.Nm -driver interfaces the IP subsystem of the operating system with the -ISDN layer so that a transport of IP packets over an ISDN link -is possible. -.Pp -For configuration of the -.Nm -driver, either the -.Xr ipppctl 8 -utility is used or it is configured via -.Xr isdnd 8 -and its associated -.Xr isdnd.rc 5 -file. -.Pp -In case an IP packet for a remote side arrives in the driver and no -connection is established yet, the driver communicates with the -.Xr isdnd 8 -daemon to establish a connection. -.Pp -The driver has support for interfacing to the -.Xr bpf 4 -subsystem for using -.Xr tcpdump 8 -with the -.Nm -interfaces. -.Pp -The -.Xr ipppctl 8 -utility is used to configure all aspects of PPP required to connect to a -remote site. -.Ss LINK0 and LINK1 -The -.Em link0 -and -.Em link1 -flags given as parameters to -.Xr ifconfig 8 -have the following meaning for the -.Nm -devices: -.Bl -tag -width link0 -.It Li link0 -Wait passively for connection. -The administrative -.Em Open -event to the Link Control Protocol (LCP) layer will be delayed until -after the lower layers signal an -.Em Up -event (rise of -.Dq carrier ) . -This can be used by lower layers to support a dial-in connection where -the physical layer isn't available immediately at startup, but only -after some external event arrives. -Receipt of a -.Em Down -event from the lower layer will not take the interface completely down -in this case. -.It Li link1 -Dial-on-demand mode. -The administrative -.Em Open -event to the LCP layer will be delayed until either an outbound -network packet arrives, or until the lower layer signals an -.Em Up -event, indicating an inbound connection. -As with passive mode, receipt of a -.Em Down -event (loss of carrier) will not automatically take the interface -down, thus it remains available for further connections. -.El -.Pp -The -.Em link0 -flag is set to -.Em off -by default, the -.Em link1 -flag to -.Em on . -.Sh SEE ALSO -.Xr bpf 4 , -.Xr isdnd.rc 5 , -.Xr ipppctl 8 , -.Xr isdnd 8 , -.Xr tcpdump 8 -.Sh AUTHORS -.An -nosplit -The -.Nm -device driver was written by -.An Joerg Wunsch Aq Mt joerg@freebsd.org -and then added to ISDN4BSD by -.An Gary Jennejohn Aq Mt gary@freebsd.org . -.Pp -This man page was written by -.An Hellmuth Michaelis Aq Mt hm@kts.org . diff --git a/share/man/man4/irip.4 b/share/man/man4/irip.4 deleted file mode 100644 index 563a81bf902f..000000000000 --- a/share/man/man4/irip.4 +++ /dev/null @@ -1,99 +0,0 @@ -.\" $NetBSD: irip.4,v 1.5 2014/03/18 18:20:39 riastradh Exp $ -.\" -.\" Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: irip.4,v 1.5 2014/03/18 18:20:39 riastradh Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Mon Dec 13 23:10:25 1999] -.\" -.Dd July 6, 1998 -.Dt IRIP 4 -.Os -.Sh NAME -.Nm irip -.Nd Raw IP over ISDN network driver -.Sh SYNOPSIS -.Cd "pseudo-device irip" Ar count -.Sh DESCRIPTION -The -.Nm -driver interfaces the IP subsystem of the operating system with the -ISDN layer so that transport of IP packets over an ISDN link -is possible. -.Pp -The driver just packs IP packets without anything appended or prepended -into raw HDLC packets on the B channel and transfers them to a remote site. -IP packets received from the remote site are queued into the local IP -protocol stack. -.Pp -The format of the resulting packet on the B channel is: -.Pp -.Dl (HDLC opening flag) (IP-packet) (CRC) (HDLC closing flag) -.Pp -In the case where an IP packet for a remote site arrives in the driver and no -connection has been established yet, the driver communicates with the -.Xr isdnd 8 -daemon to establish a connection. -.Pp -The driver has support for interfacing to the -.Xr bpf 4 -subsystem for using -.Xr tcpdump 8 -with the -.Nm -interfaces. -.Pp -The driver optionally (when compiled with the IRIP_VJ option) provides Van -Jacobson header compression, under control of the link0 and link1 options to -.Xr ifconfig 8 : -.Pp -.Bl -tag -width 15n -offset indent -compact -.It link0 -Apply VJ compression to outgoing packets on this interface, and assume that -incoming packets require decompression. -.It link1 -Check incoming packets for Van Jacobson compression; if they appear to be -compressed, automatically set link0. -.El -.Pp -The default values are -.Em on -for -.Em link1 -and -.Em off -for -.Em link0 . -.Sh SEE ALSO -.Xr bpf 4 , -.Xr isdnd.rc 5 , -.Xr isdnd 8 , -.Xr tcpdump 8 -.Sh AUTHORS -The -.Nm -device driver and this man page were written by -.An Hellmuth Michaelis Aq Mt hm@kts.org . diff --git a/share/man/man4/isdn.4 b/share/man/man4/isdn.4 deleted file mode 100644 index 5c0f3cf3c656..000000000000 --- a/share/man/man4/isdn.4 +++ /dev/null @@ -1,109 +0,0 @@ -.\" $NetBSD: isdn.4,v 1.5 2014/03/18 18:20:39 riastradh Exp $ -.\" -.\" Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: isdn.4,v 1.5 2014/03/18 18:20:39 riastradh Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Mon Dec 13 23:09:12 1999] -.\" -.Dd February 3, 1998 -.Dt ISDN 4 -.Os -.Sh NAME -.Nm isdn -.Nd ISDN kernel to userland master device -.Sh SYNOPSIS -.Cd "pseudo-device isdn" -.Sh DESCRIPTION -The -.Nm -device driver is used by the -.Xr isdnd 8 -daemon to exchange messages with the ISDN kernel part for the purpose -of call establishment, control and disconnection and to access various -control and status information. -.Pp -The messages and message parameters are documented in the include -file -.Pa /usr/include/netisdn/i4b_ioctl.h . -.Pp -The available ioctl's are: -.Pp -.Bl -tag -width Ds -compact -offset indent -.It Ar I4B_CDID_REQ -Request a unique Call Description IDentifier (cdid) which identifies -uniquely a single interaction of the local D channel with the exchange. -.It Ar I4B_CONNECT_REQ -Actively request a call setup to a remote ISDN subscriber. -.It Ar I4B_CONNECT_RESP -Respond to an incoming call, either accept, reject or ignore it. -.It Ar I4B_DISCONNECT_REQ -Actively terminate a connection. -.It Ar I4B_CTRL_INFO_REQ -Request information about an installed ISDN controller card. -.It Ar I4B_DIALOUT_RESP -Give information about call setup to driver who requested dialing out. -.It Ar I4B_TIMEOUT_UPD -Update the kernels timeout value(s) in case of dynamically calculated -shorthold mode timing changes. -.It Ar I4B_UPDOWN_IND -Inform the kernel userland drivers about interface soft up/down status -changes. -.It Ar I4B_CTRL_DOWNLOAD -Download firmware to active card(s). -.It Ar I4B_ACTIVE_DIAGNOSTIC -Return diagnostic information from active cards. -.El -.Pp -Status and event messages available from the kernel are: -.Pp -.Bl -tag -width Ds -compact -offset indent -.It Ar MSG_CONNECT_IND -An incoming call from a remote ISDN user is indicated. -.It Ar MSG_CONNECT_ACTIVE_IND -After an incoming call has been accepted locally or an outgoing call has -been accepted by a remote, the exchange signaled an active connection -and the corresponding B-channel is switched through. -.It Ar MSG_DISCONNECT_IND -A call was terminated. -.It Ar MSG_DIALOUT_IND -A userland interface driver requests the daemon to dial out (typically a -network interface when a packet arrives in its send queue). -.It Ar MSG_IDLE_TIMEOUT_IND -A call was terminated by the isdn4bsd kernel driver because a B-channel -idle timeout occurred. -.It Ar MSG_ACCT_IND -Accounting information from a network driver. -.It Ar MSG_CHARGING_IND -Charging information from the kernel. -.El -.Sh SEE ALSO -.Xr isdnd 8 -.Sh AUTHORS -The -.Nm -device driver and this man page were written by -.An Hellmuth Michaelis Aq Mt hm@kts.org . diff --git a/share/man/man4/isdnbchan.4 b/share/man/man4/isdnbchan.4 deleted file mode 100644 index 1738cb4356da..000000000000 --- a/share/man/man4/isdnbchan.4 +++ /dev/null @@ -1,51 +0,0 @@ -.\" $NetBSD: isdnbchan.4,v 1.4 2014/03/18 18:20:39 riastradh Exp $ -.\" -.\" Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: isdnbchan.4,v 1.4 2014/03/18 18:20:39 riastradh Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Mon Dec 13 23:13:04 1999] -.\" -.Dd February 3, 1998 -.Dt ISDNBCHAN 4 -.Os -.Sh NAME -.Nm isdnbchan -.Nd ISDN Raw B-Channel access driver -.Sh SYNOPSIS -.Cd "pseudo-device isdnbchan" Ar count -.Sh DESCRIPTION -The -.Nm -driver provides an interface to the raw untranslated B-channel. -.Sh SEE ALSO -.Xr isdnd.rc 5 , -.Xr isdnd 8 -.Sh AUTHORS -The -.Nm -device driver and this man page were written by -.An Hellmuth Michaelis Aq Mt hm@kts.org . diff --git a/share/man/man4/isdncapi.4 b/share/man/man4/isdncapi.4 deleted file mode 100644 index 02be79da6f8d..000000000000 --- a/share/man/man4/isdncapi.4 +++ /dev/null @@ -1,62 +0,0 @@ -.\" $NetBSD: isdncapi.4,v 1.5 2014/03/18 18:20:39 riastradh Exp $ -.\" -.\" Copyright (c) 2001 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD: src/usr.sbin/i4b/man/i4bcapi.4,v 1.2 2001/05/25 09:54:38 ru Exp $ -.\" -.\" last edit-date: [Fri May 25 09:38:45 2001] -.\" -.Dd September 25, 2003 -.Dt ISDNCAPI 4 -.Os -.Sh NAME -.Nm isdncapi -.Nd CAPI driver for isdn4bsd -.Sh DESCRIPTION -.Nm -is a CAPI driver for the -.Em isdn4bsd -package. -It sits between layer\~4 of isdn4bsd and a driver for an active -ISDN card; currently only the -.Xr iavc 4 -driver for the AVM B1 and T1 family of active cards is supported. -.Sh SEE ALSO -.Xr iavc 4 -.Sh STANDARDS -.Pq Lk http://www.capi.org/ "CAPI 2.0" -.Sh AUTHORS -.An -nosplit -The -.Nm -device driver was written by -.An Juha-Matti Liukkonen Aq Mt jml@cubical.fi -(Cubical Solutions Ltd, Finland) for -.Fx -and ported to -.Nx -by -.An Antti Kantee Aq Mt pooka@cubical.fi . -This manpage was written by -.An Hellmuth Michaelis Aq Mt hm@FreeBSD.org . diff --git a/share/man/man4/isdnctl.4 b/share/man/man4/isdnctl.4 deleted file mode 100644 index b883bd41fff8..000000000000 --- a/share/man/man4/isdnctl.4 +++ /dev/null @@ -1,52 +0,0 @@ -.\" $NetBSD: isdnctl.4,v 1.4 2014/03/18 18:20:39 riastradh Exp $ -.\" -.\" Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: isdnctl.4,v 1.4 2014/03/18 18:20:39 riastradh Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Mon Dec 13 23:09:46 1999] -.\" -.Dd February 3, 1998 -.Dt ISDNCTL 4 -.Os -.Sh NAME -.Nm isdnctl -.Nd control device for the ISDN kernel part -.Sh SYNOPSIS -.Cd "pseudo-device isdnctl" -.Sh DESCRIPTION -.Nm -is used by the -.Xr isdndebug 8 -utility to get and set the current debugging level and other information -of the kernel ISDN handling layers. -.Sh SEE ALSO -.Xr isdndebug 8 -.Sh AUTHORS -The -.Nm -device driver and this man page were written by -.An Hellmuth Michaelis Aq Mt hm@kts.org . diff --git a/share/man/man4/isdntel.4 b/share/man/man4/isdntel.4 deleted file mode 100644 index 1a8d9ffd5f0b..000000000000 --- a/share/man/man4/isdntel.4 +++ /dev/null @@ -1,135 +0,0 @@ -.\" $NetBSD: isdntel.4,v 1.8 2017/07/03 21:30:58 wiz Exp $ -.\" -.\" Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: isdntel.4,v 1.8 2017/07/03 21:30:58 wiz Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Mon Dec 13 23:13:39 1999] -.\" -.Dd April 21, 1999 -.Dt ISDNTEL 4 -.Os -.Sh NAME -.Nm isdntel -.Nd ISDN B-channel telephony interface driver -.Sh SYNOPSIS -.Cd "pseudo-device isdntel" Ar count -.Sh DESCRIPTION -The -.Nm -driver provides an interface to the B-channel for telephony applications -and is currently used by the -.Xr isdnd 8 -for answering machine support. The driver is part of the isdn4bsd package. -.Pp -The lower six bits of the driver's minor number are used to specify a -unit number, whereas the upper two bits specify a functionality. -.Pp -Functionality zero is the usual telephony data stream i/o driver. -.Pp -Functionality one is used to enable commands to dial out and hang up and -receive responses about the state of the dial out progress and status. -This commands may change in the future, for details see the file -.Pa /usr/include/netisdn/i4b_tel_ioctl.h -and the -.Xr isdntel 8 -utility. -.Pp -The telephony data stream comes out of the line in a bit-reversed format, -so the -.Nm -driver does the bit-reversion process in any case. -.Pp -Additionally, the user can specify to do A-law to mu-law, mu-law to A-law -or no conversion at all in the -.Nm -driver by using the -.Xr isdntelctl 8 -utility. -.Pp -The driver is able to process several ioctl's: -.Pp -.Bl -tag -width Ds -compact -offset indent -.It Ar I4B_TEL_GETAUDIOFMT -get currently used audio format conversion. -.It Ar I4B_TEL_SETAUDIOFMT -set currently used audio format conversion. -.It Ar I4B_TEL_EMPTYINPUTQUEUE -clear the input queue. -.El -.Pp -For the I4B_TEL_GETAUDIOFMT and I4B_TEL_SETAUDIOFMT, the following -parameters are available: -.Pp -.Bl -tag -width Ds -compact -offset indent -.It Ar CVT_NONE -do no A-law/mu-law audio format conversion. The conversion path looks like -this: -.Pp -USER <--> bitreversing <--> ISDN-line -.Pp -.It Ar CVT_ALAW2ULAW -set audio format conversion to do an audio conversion from A-law -(on the ISDN line) to mu-law (in the userland). -The -.Xr read 2 -conversion path looks like this: -.Pp -USER <-- mu-law/A-law <-- bitreversing <-- ISDN-line -.Pp -and the -.Xr write 2 -conversion path looks like this: -.Pp -USER --> mu-law/A-law --> bitreversing --> ISDN-line -.Pp -.It Ar CVT_ULAW2ALAW -set audio format conversion to do an audio conversion from mu-law -(on the ISDN line) to A-law (in the userland). -The -.Xr read 2 -conversion path looks like this: -.Pp -USER <-- A-law/mu-law <-- bitreversing <-- ISDN-line -.Pp -and the -.Xr write 2 -conversion path looks like this: -.Pp -USER --> A-law/mu-law --> bitreversing --> ISDN-line -.El -.Sh SEE ALSO -.Xr isdnd.rc 5 , -.Xr isdnd 8 , -.Xr isdntel 8 , -.Xr isdntelctl 8 -.Sh STANDARDS -A-law and mu-law are specified in ITU Recommendation G.711. -.Sh AUTHORS -The -.Nm -device driver and this man page were written by -.An Hellmuth Michaelis Aq Mt hm@kts.org . diff --git a/share/man/man4/isdntrc.4 b/share/man/man4/isdntrc.4 deleted file mode 100644 index a4839478585f..000000000000 --- a/share/man/man4/isdntrc.4 +++ /dev/null @@ -1,57 +0,0 @@ -.\" $NetBSD: isdntrc.4,v 1.4 2014/03/18 18:20:39 riastradh Exp $ -.\" -.\" Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: isdntrc.4,v 1.4 2014/03/18 18:20:39 riastradh Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Mon Dec 13 23:14:19 1999] -.\" -.Dd July 30, 1999 -.Dt ISDNTRC 4 -.Os -.Sh NAME -.Nm isdntrc -.Nd ISDN interface driver for D and B channel tracing -.Sh SYNOPSIS -.Cd "pseudo-device isdntrc" Ar count -.Sh DESCRIPTION -The -.Nm -driver is used to add a header to the data got from the D and/or B channel -and queues it to be read and further processed by the -.Xr isdntrace 8 -utility. -Currently, -.Ar count -should be the number of B channels (twice the number of cards). -.Sh SEE ALSO -.Xr isdnd 8 , -.Xr isdntrace 8 -.Sh AUTHORS -The -.Nm -device driver and this man page were written by -.An Hellmuth Michaelis Aq Mt hm@kts.org . diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 45ea1384f851..82f24293824c 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -1,4 +1,4 @@ -.\" $NetBSD: rc.conf.5,v 1.173 2018/09/23 07:24:20 maxv Exp $ +.\" $NetBSD: rc.conf.5,v 1.174 2018/09/23 09:21:00 maxv Exp $ .\" .\" Copyright (c) 1996 Matthew R. Green .\" All rights reserved. @@ -55,7 +55,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 12, 2018 +.Dd September 23, 2018 .Dt RC.CONF 5 .Os .Sh NAME @@ -280,8 +280,6 @@ events. .Pp All active .Xr pppoe 4 -and -.Xr ippp 4 interfaces will be automatically added to this list. .It Sy hostname A string. diff --git a/share/man/man7/src.7 b/share/man/man7/src.7 index fef7e47d7926..d40889012cb1 100644 --- a/share/man/man7/src.7 +++ b/share/man/man7/src.7 @@ -1,4 +1,4 @@ -.\" $NetBSD: src.7,v 1.14 2018/09/06 09:44:09 maxv Exp $ +.\" $NetBSD: src.7,v 1.15 2018/09/23 09:21:00 maxv Exp $ .\" .\" Copyright (c) 2012, 2013 Mingzhe Wang and Elvira Khabirova. .\" All rights reserved. @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 6, 2018 +.Dd September 23, 2018 .Dt SRC 7 .Os .Sh NAME @@ -302,9 +302,6 @@ IPv6 protocol stack. .It Pa netipsec/ IPsec protocol stack .Xr ipsec 4 . -.It Pa netisdn/ -ISDN protocol stack -.Xr isdn 4 . .It Pa netmpls/ MPLS protocol stack .Xr mpls 4 . diff --git a/share/man/man9/ioctl.9 b/share/man/man9/ioctl.9 index ba83940dd03f..1da7420682c0 100644 --- a/share/man/man9/ioctl.9 +++ b/share/man/man9/ioctl.9 @@ -1,4 +1,4 @@ -.\" $NetBSD: ioctl.9,v 1.32 2017/07/03 21:28:48 wiz Exp $ +.\" $NetBSD: ioctl.9,v 1.33 2018/09/23 09:21:00 maxv Exp $ .\" .\" Copyright (c) 1999 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd December 11, 2010 +.Dd September 23, 2018 .Dt IOCTL 9 .Os .Sh NAME @@ -74,8 +74,6 @@ can be one of .Bl -tag -width xxxxx -compact .It '1' pulse-per-second interface -.It '4' -.Xr isdn 4 .It 'a' ISO networking .It 'A' @@ -87,8 +85,6 @@ Advanced Power Management (hpcmips, i386, sparc), see ADB devices (mac68k, macppc) .It 'A' .Xr audio 4 -.It 'A' -.Xr isdntel 4 .It 'b' .Xr \&tb 4 .It 'b' @@ -112,8 +108,6 @@ coda .Xr \&ch 4 .It 'C' clock devices (amiga, atari, hp300, x68k) -.It 'C' -.Xr isdnctl 4 .It 'd' the disk subsystem .It 'E' @@ -187,8 +181,6 @@ the routing subsystem .It 'r' .Xr \&md 4 .It 'R' -.Xr isdnbchan 4 -.It 'R' .Xr rnd 4 .It 's' the socket layer diff --git a/sys/Makefile b/sys/Makefile index bd0ed969d149..6d466eb0a336 100644 --- a/sys/Makefile +++ b/sys/Makefile @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.82 2018/09/06 19:19:44 maxv Exp $ +# $NetBSD: Makefile,v 1.83 2018/09/23 09:21:01 maxv Exp $ .include SUBDIR= altq arch compat dev fs miscfs \ net net80211 netatalk netbt netcan netipsec netinet netinet6 \ - netisdn netmpls netsmb \ + netmpls netsmb \ nfs opencrypto sys ufs uvm # interrupt implementation depends on the kernel within the port diff --git a/sys/arch/aarch64/conf/majors.aarch64 b/sys/arch/aarch64/conf/majors.aarch64 index 2a5e9ea3366d..294272aa96cb 100644 --- a/sys/arch/aarch64/conf/majors.aarch64 +++ b/sys/arch/aarch64/conf/majors.aarch64 @@ -1,4 +1,4 @@ -# $NetBSD: majors.aarch64,v 1.2 2015/04/23 23:22:51 pgoyette Exp $ +# $NetBSD: majors.aarch64,v 1.3 2018/09/23 09:21:01 maxv Exp $ # # Device majors for arm32 # @@ -72,11 +72,6 @@ device-major urio char 75 urio device-major uscanner char 76 uscanner device-major openfirm char 77 openfirm device-major biconsdev char 78 biconsdev -device-major isdn char 79 isdn -device-major isdnctl char 80 isdnctl -device-major isdnrchan char 81 isdnbchan -device-major isdntrc char 82 isdntrc -device-major isdntel char 83 isdntel device-major sacom char 84 sacom device-major mly char 85 mly device-major wsfont char 86 wsfont @@ -99,7 +94,6 @@ device-major apm char 103 apm device-major sscom char 104 sscom device-major imxcom char 104 imxuart device-major ksyms char 105 ksyms -device-major isdnbchan char 106 isdnbchan device-major epcom char 107 epcom device-major tslcd char 108 tslcd device-major twe char 109 twe diff --git a/sys/arch/acorn32/conf/majors.acorn32 b/sys/arch/acorn32/conf/majors.acorn32 index fffeb0657b5a..5d1ea7f064bd 100644 --- a/sys/arch/acorn32/conf/majors.acorn32 +++ b/sys/arch/acorn32/conf/majors.acorn32 @@ -1,4 +1,4 @@ -# $NetBSD: majors.acorn32,v 1.25 2011/06/30 20:09:17 wiz Exp $ +# $NetBSD: majors.acorn32,v 1.26 2018/09/23 09:21:01 maxv Exp $ # # Device majors for acorn32 # @@ -52,11 +52,6 @@ device-major raid char 71 block 71 raid device-major wsmux char 73 wsmux -device-major isdn char 79 isdn -device-major isdnctl char 80 isdnctl -device-major isdnbchan char 81 isdnbchan -device-major isdntrc char 82 isdntrc -device-major isdntel char 83 isdntel device-major clockctl char 84 clockctl device-major ksyms char 86 ksyms device-major wsfont char 87 wsfont diff --git a/sys/arch/algor/conf/majors.algor b/sys/arch/algor/conf/majors.algor index 3f300b6a55c4..7ee85484e051 100644 --- a/sys/arch/algor/conf/majors.algor +++ b/sys/arch/algor/conf/majors.algor @@ -1,4 +1,4 @@ -# $NetBSD: majors.algor,v 1.23 2016/12/08 11:31:09 nat Exp $ +# $NetBSD: majors.algor,v 1.24 2018/09/23 09:21:01 maxv Exp $ # # Device majors for algor # @@ -46,11 +46,6 @@ device-major ulpt char 47 ulpt device-major ugen char 48 ugen device-major midi char 49 midi device-major sequencer char 50 sequencer -device-major isdn char 51 isdn -device-major isdnctl char 52 isdnctl -device-major isdnbchan char 53 isdnbchan -device-major isdntrc char 54 isdntrc -device-major isdntel char 55 isdntel device-major wsmux char 56 wsmux device-major ucom char 57 ucom device-major ses char 58 ses diff --git a/sys/arch/alpha/conf/majors.alpha b/sys/arch/alpha/conf/majors.alpha index 097fa011aa3b..df6f06abb8d5 100644 --- a/sys/arch/alpha/conf/majors.alpha +++ b/sys/arch/alpha/conf/majors.alpha @@ -1,4 +1,4 @@ -# $NetBSD: majors.alpha,v 1.30 2016/12/08 11:31:09 nat Exp $ +# $NetBSD: majors.alpha,v 1.31 2018/09/23 09:21:01 maxv Exp $ # # Device majors for alpha # @@ -47,11 +47,6 @@ device-major ulpt char 47 ulpt device-major ugen char 48 ugen device-major midi char 49 midi device-major sequencer char 50 sequencer -device-major isdn char 51 isdn -device-major isdnctl char 52 isdnctl -device-major isdnbchan char 53 isdnbchan -device-major isdntrc char 54 isdntrc -device-major isdntel char 55 isdntel device-major wsmux char 56 wsmux device-major ucom char 57 ucom device-major ses char 58 ses diff --git a/sys/arch/amd64/conf/ALL b/sys/arch/amd64/conf/ALL index 7ace69aa7f7a..35c8fda50d2b 100644 --- a/sys/arch/amd64/conf/ALL +++ b/sys/arch/amd64/conf/ALL @@ -1,4 +1,4 @@ -# $NetBSD: ALL,v 1.106 2018/09/22 16:22:22 maxv Exp $ +# $NetBSD: ALL,v 1.107 2018/09/23 09:21:01 maxv Exp $ # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp # # ALL machine description file @@ -17,7 +17,7 @@ include "arch/amd64/conf/std.amd64" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "ALL-$Revision: 1.106 $" +#ident "ALL-$Revision: 1.107 $" maxusers 64 # estimated number of users @@ -1892,7 +1892,6 @@ options DL_DEBUG options DMAC_DEBUG options DMA_DEBUG options DMCDEBUG -options DO_I4B_MAXDEBUG options DRACORAWKEYDEBUG options EARLY_DEBUG_EVENT options EBUS_DEBUG @@ -1960,9 +1959,6 @@ options HP_DEBUG options HSCXADEBUG options HSCXBDEBUG options I2ODEBUG -options I4BISPPPDEBUG -options I4B_MBUF_DEBUG -options I4B_MBUF_TYPE_DEBUG options ICONV_DEBUG options ICP_DEBUG options IEDEBUG diff --git a/sys/arch/amd64/conf/majors.amd64 b/sys/arch/amd64/conf/majors.amd64 index e9839f9d061a..d6154f9dee0c 100644 --- a/sys/arch/amd64/conf/majors.amd64 +++ b/sys/arch/amd64/conf/majors.amd64 @@ -1,4 +1,4 @@ -# $NetBSD: majors.amd64,v 1.27 2017/01/12 05:24:36 ryo Exp $ +# $NetBSD: majors.amd64,v 1.28 2018/09/23 09:21:01 maxv Exp $ # # Device majors for amd64 # @@ -41,11 +41,6 @@ device-major rnd char 46 rnd device-major wsdisplay char 47 wsdisplay device-major wskbd char 48 wskbd device-major wsmouse char 49 wsmouse -device-major isdn char 50 isdn -device-major isdnctl char 51 isdnctl -device-major isdnbchan char 52 isdnbchan -device-major isdntrc char 53 isdntrc -device-major isdntel char 54 isdntel device-major usb char 55 usb device-major uhid char 56 uhid device-major ulpt char 57 ulpt diff --git a/sys/arch/amiga/conf/majors.amiga b/sys/arch/amiga/conf/majors.amiga index 5d975fd95006..a8ec64091b13 100644 --- a/sys/arch/amiga/conf/majors.amiga +++ b/sys/arch/amiga/conf/majors.amiga @@ -1,4 +1,4 @@ -# $NetBSD: majors.amiga,v 1.23 2011/10/07 08:44:21 rkujawa Exp $ +# $NetBSD: majors.amiga,v 1.24 2018/09/23 09:21:01 maxv Exp $ # # Device majors for amiga # @@ -41,11 +41,6 @@ device-major audio char 41 audio device-major rnd char 42 rnd device-major md char 43 block 15 md device-major scsibus char 44 scsibus -device-major isdn char 45 isdn -device-major isdnctl char 46 isdnctl -device-major isdnbchan char 47 isdnbchan -device-major isdntrc char 48 isdntrc -device-major isdntel char 49 isdntel device-major raid char 50 block 16 raid device-major svr4_net char 51 compat_svr4 device-major wd char 52 block 17 wd diff --git a/sys/arch/amigappc/conf/majors.amigappc b/sys/arch/amigappc/conf/majors.amigappc index 3910068b31b7..6bfc05b84e36 100644 --- a/sys/arch/amigappc/conf/majors.amigappc +++ b/sys/arch/amigappc/conf/majors.amigappc @@ -1,4 +1,4 @@ -# $NetBSD: majors.amigappc,v 1.5 2011/06/30 20:09:19 wiz Exp $ +# $NetBSD: majors.amigappc,v 1.6 2018/09/23 09:21:01 maxv Exp $ # # Device majors for amigappc # @@ -41,11 +41,6 @@ device-major audio char 41 audio device-major rnd char 42 rnd device-major md char 43 block 15 md device-major scsibus char 44 scsibus -device-major isdn char 45 isdn -device-major isdnctl char 46 isdnctl -device-major isdnbchan char 47 isdnbchan -device-major isdntrc char 48 isdntrc -device-major isdntel char 49 isdntel device-major raid char 50 block 16 raid device-major svr4_net char 51 compat_svr4 device-major wd char 52 block 17 wd diff --git a/sys/arch/arc/conf/majors.arc b/sys/arch/arc/conf/majors.arc index ea2f91434788..57ca424cde80 100644 --- a/sys/arch/arc/conf/majors.arc +++ b/sys/arch/arc/conf/majors.arc @@ -1,4 +1,4 @@ -# $NetBSD: majors.arc,v 1.24 2011/06/30 20:09:19 wiz Exp $ +# $NetBSD: majors.arc,v 1.25 2018/09/23 09:21:01 maxv Exp $ # # Device majors for arc # @@ -39,11 +39,6 @@ device-major rnd char 33 rnd device-major ss char 34 ss device-major ses char 35 ses device-major ch char 36 ch -device-major isdn char 37 isdn -device-major isdnctl char 38 isdnctl -device-major isdnbchan char 39 isdnbchan -device-major isdntrc char 40 isdntrc -device-major isdntel char 41 isdntel device-major clockctl char 52 clockctl device-major cgd char 54 block 10 cgd diff --git a/sys/arch/arm/conf/majors.arm32 b/sys/arch/arm/conf/majors.arm32 index 503084f3c464..deaf9602b3ef 100644 --- a/sys/arch/arm/conf/majors.arm32 +++ b/sys/arch/arm/conf/majors.arm32 @@ -1,4 +1,4 @@ -# $NetBSD: majors.arm32,v 1.37 2015/04/23 23:22:51 pgoyette Exp $ +# $NetBSD: majors.arm32,v 1.38 2018/09/23 09:21:01 maxv Exp $ # # Device majors for arm32 # @@ -72,11 +72,6 @@ device-major urio char 75 urio device-major uscanner char 76 uscanner device-major openfirm char 77 openfirm device-major biconsdev char 78 biconsdev -device-major isdn char 79 isdn -device-major isdnctl char 80 isdnctl -device-major isdnrchan char 81 isdnbchan -device-major isdntrc char 82 isdntrc -device-major isdntel char 83 isdntel device-major sacom char 84 sacom device-major mly char 85 mly device-major wsfont char 86 wsfont @@ -100,7 +95,6 @@ device-major apm char 103 apm device-major sscom char 104 sscom device-major imxcom char 104 imxuart device-major ksyms char 105 ksyms -device-major isdnbchan char 106 isdnbchan device-major epcom char 107 epcom device-major tslcd char 108 tslcd device-major twe char 109 twe diff --git a/sys/arch/atari/conf/majors.atari b/sys/arch/atari/conf/majors.atari index fbe6993302b3..52f865535e58 100644 --- a/sys/arch/atari/conf/majors.atari +++ b/sys/arch/atari/conf/majors.atari @@ -1,4 +1,4 @@ -# $NetBSD: majors.atari,v 1.22 2011/06/30 20:09:20 wiz Exp $ +# $NetBSD: majors.atari,v 1.23 2018/09/23 09:21:01 maxv Exp $ # # Device majors for atari # @@ -42,11 +42,6 @@ device-major et char 40 et device-major wsdisplay char 41 wsdisplay device-major audio char 42 audio -device-major isdn char 44 isdn -device-major isdnctl char 45 isdnctl -device-major isdnbchan char 46 isdnbchan -device-major isdntrc char 47 isdntrc -device-major isdntel char 48 isdntel device-major scsibus char 49 scsibus device-major raid char 50 block 15 raid device-major svr4_net char 51 compat_svr4 diff --git a/sys/arch/bebox/conf/majors.bebox b/sys/arch/bebox/conf/majors.bebox index c849e1786a66..d1f0e28cbc92 100644 --- a/sys/arch/bebox/conf/majors.bebox +++ b/sys/arch/bebox/conf/majors.bebox @@ -1,4 +1,4 @@ -# $NetBSD: majors.bebox,v 1.26 2016/12/08 11:31:09 nat Exp $ +# $NetBSD: majors.bebox,v 1.27 2018/09/23 09:21:01 maxv Exp $ # # Device majors for bebox # @@ -49,11 +49,6 @@ device-major wsmouse char 49 wsmouse device-major scsibus char 50 scsibus device-major raid char 51 block 18 raid device-major wsmux char 52 wsmux -device-major isdn char 53 isdn -device-major isdnctl char 54 isdnctl -device-major isdnbchan char 55 isdnbchan -device-major isdntrc char 56 isdntrc -device-major isdntel char 57 isdntel device-major clockctl char 58 clockctl device-major cgd char 60 block 19 cgd device-major ksyms char 61 ksyms diff --git a/sys/arch/cobalt/conf/majors.cobalt b/sys/arch/cobalt/conf/majors.cobalt index e0356877bc0c..af3292aa616f 100644 --- a/sys/arch/cobalt/conf/majors.cobalt +++ b/sys/arch/cobalt/conf/majors.cobalt @@ -1,4 +1,4 @@ -# $NetBSD: majors.cobalt,v 1.30 2011/06/30 20:09:22 wiz Exp $ +# $NetBSD: majors.cobalt,v 1.31 2018/09/23 09:21:02 maxv Exp $ # # Device majors for cobalt # @@ -30,11 +30,6 @@ device-major scsibus char 24 scsibus device-major ses char 25 ses device-major com char 26 com device-major ld char 27 block 10 ld -device-major isdn char 28 isdn -device-major isdnctl char 29 isdnctl -device-major isdnbchan char 30 isdnbchan -device-major isdntrc char 31 isdntrc -device-major isdntel char 32 isdntel device-major clockctl char 33 clockctl device-major cgd char 35 block 11 cgd device-major panel char 36 panel diff --git a/sys/arch/epoc32/conf/majors.epoc32 b/sys/arch/epoc32/conf/majors.epoc32 index 42d48574c8d8..d260a00abeef 100644 --- a/sys/arch/epoc32/conf/majors.epoc32 +++ b/sys/arch/epoc32/conf/majors.epoc32 @@ -1,4 +1,4 @@ -# $NetBSD: majors.epoc32,v 1.2 2015/04/23 23:22:51 pgoyette Exp $ +# $NetBSD: majors.epoc32,v 1.3 2018/09/23 09:21:02 maxv Exp $ # # Device majors for epoc32 # @@ -72,11 +72,6 @@ device-major urio char 75 urio device-major uscanner char 76 uscanner device-major openfirm char 77 openfirm device-major biconsdev char 78 biconsdev -device-major isdn char 79 isdn -device-major isdnctl char 80 isdnctl -device-major isdnrchan char 81 isdnbchan -device-major isdntrc char 82 isdntrc -device-major isdntel char 83 isdntel device-major sacom char 84 sacom device-major mly char 85 mly device-major wsfont char 86 wsfont @@ -98,7 +93,6 @@ device-major dmoverio char 102 dmoverio device-major apmdev char 103 apmdev device-major sscom char 104 sscom device-major ksyms char 105 ksyms -device-major isdnbchan char 106 isdnbchan device-major epcom char 107 epcom device-major tslcd char 108 tslcd device-major twe char 109 twe diff --git a/sys/arch/evbmips/conf/majors.evbmips b/sys/arch/evbmips/conf/majors.evbmips index 77c41e2c69d3..2c32269041ca 100644 --- a/sys/arch/evbmips/conf/majors.evbmips +++ b/sys/arch/evbmips/conf/majors.evbmips @@ -1,4 +1,4 @@ -# $NetBSD: majors.evbmips,v 1.30 2016/12/08 11:31:10 nat Exp $ +# $NetBSD: majors.evbmips,v 1.31 2018/09/23 09:21:02 maxv Exp $ # # Device majors for evbmips # @@ -48,11 +48,6 @@ device-major ulpt char 47 ulpt device-major ugen char 48 ugen device-major midi char 49 midi device-major sequencer char 50 sequencer -device-major isdn char 51 isdn -device-major isdnctl char 52 isdnctl -device-major isdnbchan char 53 isdnbchan -device-major isdntrc char 54 isdntrc -device-major isdntel char 55 isdntel device-major wsmux char 56 wsmux device-major ucom char 57 ucom device-major ses char 58 ses diff --git a/sys/arch/evbppc/conf/majors.evbppc b/sys/arch/evbppc/conf/majors.evbppc index 3d2a8d863fa0..d3067ef29996 100644 --- a/sys/arch/evbppc/conf/majors.evbppc +++ b/sys/arch/evbppc/conf/majors.evbppc @@ -1,4 +1,4 @@ -# $NetBSD: majors.evbppc,v 1.32 2015/04/23 23:22:51 pgoyette Exp $ +# $NetBSD: majors.evbppc,v 1.33 2018/09/23 09:21:02 maxv Exp $ # # Device majors for evbppc # (When possible, make entries the same as macppc) @@ -55,11 +55,6 @@ device-major sequencer char 50 sequencer device-major urio char 51 urio device-major uscanner char 52 uscanner # char 53 -device-major isdn char 54 isdn -device-major isdnctl char 55 isdnctl -device-major isdnbchan char 56 isdnbchan -device-major isdntrc char 57 isdntrc -device-major isdntel char 58 isdntel device-major ld char 59 block 13 ld device-major pci char 60 pci device-major clockctl char 61 clockctl diff --git a/sys/arch/hpcarm/conf/majors.hpcarm b/sys/arch/hpcarm/conf/majors.hpcarm index b123fc12ad64..8f1661eec0c2 100644 --- a/sys/arch/hpcarm/conf/majors.hpcarm +++ b/sys/arch/hpcarm/conf/majors.hpcarm @@ -1,4 +1,4 @@ -# $NetBSD: majors.hpcarm,v 1.13 2015/04/23 23:22:51 pgoyette Exp $ +# $NetBSD: majors.hpcarm,v 1.14 2018/09/23 09:21:02 maxv Exp $ # # Device majors for hpcarm # @@ -72,11 +72,6 @@ device-major urio char 75 urio device-major uscanner char 76 uscanner device-major openfirm char 77 openfirm device-major biconsdev char 78 biconsdev -device-major isdn char 79 isdn -device-major isdnctl char 80 isdnctl -device-major isdnrchan char 81 isdnbchan -device-major isdntrc char 82 isdntrc -device-major isdntel char 83 isdntel device-major sacom char 84 sacom device-major mly char 85 mly device-major wsfont char 86 wsfont @@ -98,7 +93,6 @@ device-major dmoverio char 102 dmoverio device-major apmdev char 103 apmdev device-major sscom char 104 sscom device-major ksyms char 105 ksyms -device-major isdnbchan char 106 isdnbchan device-major epcom char 107 epcom device-major tslcd char 108 tslcd device-major twe char 109 twe diff --git a/sys/arch/hpcmips/conf/majors.hpcmips b/sys/arch/hpcmips/conf/majors.hpcmips index 0006dbf0dd34..79bb6cda257d 100644 --- a/sys/arch/hpcmips/conf/majors.hpcmips +++ b/sys/arch/hpcmips/conf/majors.hpcmips @@ -1,4 +1,4 @@ -# $NetBSD: majors.hpcmips,v 1.31 2011/06/30 20:09:31 wiz Exp $ +# $NetBSD: majors.hpcmips,v 1.32 2018/09/23 09:21:02 maxv Exp $ # # Device majors for hpcmips # @@ -44,11 +44,6 @@ device-major ucom char 37 ucom device-major wsmux char 38 wsmux device-major urio char 39 urio device-major uscanner char 40 uscanner -device-major isdn char 41 isdn -device-major isdnctl char 42 isdnctl -device-major isdnbchan char 43 isdnbchan -device-major isdntrc char 44 isdntrc -device-major isdntel char 45 isdntel device-major clockctl char 46 clockctl device-major audio char 48 audio device-major cgd char 50 block 10 cgd diff --git a/sys/arch/i386/conf/ALL b/sys/arch/i386/conf/ALL index 4c5610e8a7ee..c9f5fc8bbc1b 100644 --- a/sys/arch/i386/conf/ALL +++ b/sys/arch/i386/conf/ALL @@ -1,4 +1,4 @@ -# $NetBSD: ALL,v 1.456 2018/09/22 16:22:23 maxv Exp $ +# $NetBSD: ALL,v 1.457 2018/09/23 09:21:02 maxv Exp $ # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp # # ALL machine description file @@ -17,7 +17,7 @@ include "arch/i386/conf/std.i386" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "ALL-$Revision: 1.456 $" +#ident "ALL-$Revision: 1.457 $" maxusers 64 # estimated number of users @@ -2024,7 +2024,6 @@ options DL_DEBUG options DMAC_DEBUG options DMA_DEBUG options DMCDEBUG -options DO_I4B_MAXDEBUG options DRACORAWKEYDEBUG options EARLY_DEBUG_EVENT options EBUS_DEBUG @@ -2092,9 +2091,6 @@ options HP_DEBUG options HSCXADEBUG options HSCXBDEBUG options I2ODEBUG -options I4BISPPPDEBUG -options I4B_MBUF_DEBUG -options I4B_MBUF_TYPE_DEBUG options ICONV_DEBUG options ICP_DEBUG options IEDEBUG diff --git a/sys/arch/i386/conf/majors.i386 b/sys/arch/i386/conf/majors.i386 index ca1b6db12906..179686e6702c 100644 --- a/sys/arch/i386/conf/majors.i386 +++ b/sys/arch/i386/conf/majors.i386 @@ -1,4 +1,4 @@ -# $NetBSD: majors.i386,v 1.46 2017/01/12 05:24:36 ryo Exp $ +# $NetBSD: majors.i386,v 1.47 2018/09/23 09:21:02 maxv Exp $ # # Device majors for i386 # @@ -47,11 +47,6 @@ device-major rnd char 46 rnd device-major wsdisplay char 47 wsdisplay device-major wskbd char 48 wskbd device-major wsmouse char 49 wsmouse -device-major isdn char 50 isdn -device-major isdnctl char 51 isdnctl -device-major isdnbchan char 52 isdnbchan -device-major isdntrc char 53 isdntrc -device-major isdntel char 54 isdntel device-major usb char 55 usb device-major uhid char 56 uhid device-major ulpt char 57 ulpt diff --git a/sys/arch/ia64/conf/majors.ia64 b/sys/arch/ia64/conf/majors.ia64 index 8a9a214d65a0..df012c6ab3af 100644 --- a/sys/arch/ia64/conf/majors.ia64 +++ b/sys/arch/ia64/conf/majors.ia64 @@ -1,4 +1,4 @@ -# $NetBSD: majors.ia64,v 1.12 2016/12/08 11:31:11 nat Exp $ +# $NetBSD: majors.ia64,v 1.13 2018/09/23 09:21:02 maxv Exp $ # # Device majors for ia64 # @@ -47,11 +47,6 @@ device-major rnd char 46 rnd device-major wsdisplay char 47 wsdisplay device-major wskbd char 48 wskbd device-major wsmouse char 49 wsmouse -device-major isdn char 50 isdn -device-major isdnctl char 51 isdnctl -device-major isdnbchan char 52 isdnbchan -device-major isdntrc char 53 isdntrc -device-major isdntel char 54 isdntel device-major usb char 55 usb device-major uhid char 56 uhid device-major ulpt char 57 ulpt diff --git a/sys/arch/ibmnws/conf/majors.ibmnws b/sys/arch/ibmnws/conf/majors.ibmnws index c8e9dc5044e2..52448d5ae6a8 100644 --- a/sys/arch/ibmnws/conf/majors.ibmnws +++ b/sys/arch/ibmnws/conf/majors.ibmnws @@ -1,4 +1,4 @@ -# $NetBSD: majors.ibmnws,v 1.14 2011/06/30 20:09:31 wiz Exp $ +# $NetBSD: majors.ibmnws,v 1.15 2018/09/23 09:21:02 maxv Exp $ # # Device majors for ibmnws # @@ -45,11 +45,6 @@ device-major scsibus char 61 scsibus device-major raid char 62 block 18 raid device-major wsmux char 65 wsmux -device-major isdn char 66 isdn -device-major isdnctl char 67 isdnctl -device-major isdnbchan char 68 isdnbchan -device-major isdntrc char 69 isdntrc -device-major isdntel char 70 isdntel device-major wsfont char 71 wsfont device-major pci char 72 pci device-major clockctl char 73 clockctl diff --git a/sys/arch/mvmeppc/conf/majors.mvmeppc b/sys/arch/mvmeppc/conf/majors.mvmeppc index ba63f00c9e01..d2f5ac7af047 100644 --- a/sys/arch/mvmeppc/conf/majors.mvmeppc +++ b/sys/arch/mvmeppc/conf/majors.mvmeppc @@ -1,4 +1,4 @@ -# $NetBSD: majors.mvmeppc,v 1.20 2011/06/30 20:09:33 wiz Exp $ +# $NetBSD: majors.mvmeppc,v 1.21 2018/09/23 09:21:02 maxv Exp $ # # Device majors for mvmeppc # @@ -38,11 +38,6 @@ device-major rnd char 46 rnd device-major scsibus char 50 scsibus device-major raid char 51 block 18 raid -device-major isdn char 53 isdn -device-major isdnctl char 54 isdnctl -device-major isdnbchan char 55 isdnbchan -device-major isdntrc char 56 isdntrc -device-major isdntel char 57 isdntel device-major clockctl char 58 clockctl device-major cgd char 60 block 19 cgd device-major ksyms char 61 ksyms diff --git a/sys/arch/powerpc/conf/majors.powerpc b/sys/arch/powerpc/conf/majors.powerpc index e24c8b50b6d2..8c3d7b666e51 100644 --- a/sys/arch/powerpc/conf/majors.powerpc +++ b/sys/arch/powerpc/conf/majors.powerpc @@ -1,4 +1,4 @@ -# $NetBSD: majors.powerpc,v 1.10 2016/12/08 11:31:11 nat Exp $ +# $NetBSD: majors.powerpc,v 1.11 2018/09/23 09:21:02 maxv Exp $ # # Device majors for shared PowerPC # @@ -59,11 +59,6 @@ device-major sequencer char 50 sequencer device-major urio char 51 urio device-major uscanner char 52 uscanner device-major openfirm char 53 openfirm -device-major isdn char 54 isdn -device-major isdnctl char 55 isdnctl -device-major isdnbchan char 56 isdnbchan -device-major isdntrc char 57 isdntrc -device-major isdntel char 58 isdntel device-major ld char 59 block 13 ld device-major pci char 60 pci diff --git a/sys/arch/prep/conf/majors.prep b/sys/arch/prep/conf/majors.prep index b4f3c96d7ab2..a68cc0ded16a 100644 --- a/sys/arch/prep/conf/majors.prep +++ b/sys/arch/prep/conf/majors.prep @@ -1,4 +1,4 @@ -# $NetBSD: majors.prep,v 1.23 2016/12/08 11:31:12 nat Exp $ +# $NetBSD: majors.prep,v 1.24 2018/09/23 09:21:03 maxv Exp $ # # Device majors for prep # @@ -53,11 +53,6 @@ device-major scsibus char 61 scsibus device-major raid char 62 block 18 raid device-major wsmux char 65 wsmux -device-major isdn char 66 isdn -device-major isdnctl char 67 isdnctl -device-major isdnbchan char 68 isdnbchan -device-major isdntrc char 69 isdntrc -device-major isdntel char 70 isdntel device-major wsfont char 71 wsfont device-major pci char 72 pci device-major clockctl char 73 clockctl diff --git a/sys/arch/riscv/conf/majors.riscv b/sys/arch/riscv/conf/majors.riscv index 22cc111c1a70..d27907865deb 100644 --- a/sys/arch/riscv/conf/majors.riscv +++ b/sys/arch/riscv/conf/majors.riscv @@ -1,4 +1,4 @@ -# $NetBSD: majors.riscv,v 1.2 2016/12/08 11:31:12 nat Exp $ +# $NetBSD: majors.riscv,v 1.3 2018/09/23 09:21:03 maxv Exp $ # # Device majors for evbmips # @@ -15,11 +15,6 @@ device-major satlink char 38 satlink device-major esh char 44 esh device-major midi char 49 midi device-major sequencer char 50 sequencer -device-major isdn char 51 isdn -device-major isdnctl char 52 isdnctl -device-major isdnbchan char 53 isdnbchan -device-major isdntrc char 54 isdntrc -device-major isdntel char 55 isdntel device-major cy char 60 cy device-major cz char 61 cz device-major altq char 64 altq diff --git a/sys/arch/sgimips/conf/majors.sgimips b/sys/arch/sgimips/conf/majors.sgimips index 2aa5f57ac418..4d1b8a1a61b5 100644 --- a/sys/arch/sgimips/conf/majors.sgimips +++ b/sys/arch/sgimips/conf/majors.sgimips @@ -1,4 +1,4 @@ -# $NetBSD: majors.sgimips,v 1.28 2015/04/23 23:22:52 pgoyette Exp $ +# $NetBSD: majors.sgimips,v 1.29 2018/09/23 09:21:03 maxv Exp $ # # Device majors for sgimips # @@ -36,11 +36,6 @@ device-major scsibus char 34 scsibus device-major zstty char 35 zstty device-major com char 36 com device-major arcbios char 37 -device-major isdn char 38 isdn -device-major isdnctl char 39 isdnctl -device-major isdnbchan char 40 isdnbchan -device-major isdntrc char 41 isdntrc -device-major isdntel char 42 isdntel device-major svr4_net char 43 compat_svr4 device-major ses char 44 ses diff --git a/sys/arch/sparc/conf/majors.sparc b/sys/arch/sparc/conf/majors.sparc index 0665922dc9fe..16a19159f981 100644 --- a/sys/arch/sparc/conf/majors.sparc +++ b/sys/arch/sparc/conf/majors.sparc @@ -1,4 +1,4 @@ -# $NetBSD: majors.sparc,v 1.35 2017/03/26 13:57:53 martin Exp $ +# $NetBSD: majors.sparc,v 1.36 2018/09/23 09:21:03 maxv Exp $ # # Device majors for sparc # @@ -63,11 +63,6 @@ device-major altq char 68 altq device-major audio char 69 audio device-major openprom char 70 device-major tctrl char 71 tctrl -device-major isdn char 72 isdn -device-major isdnctl char 73 isdnctl -device-major isdnbchan char 74 isdnbchan -device-major isdntrc char 75 isdntrc -device-major isdntel char 76 isdntel # sparc64: device-major sabtty char 77 sabtty # sparc64: device-major usb char 78 usb # sparc64: device-major uhid char 79 uhid diff --git a/sys/arch/sparc64/conf/majors.sparc64 b/sys/arch/sparc64/conf/majors.sparc64 index 435e910cf129..db2e416b6a94 100644 --- a/sys/arch/sparc64/conf/majors.sparc64 +++ b/sys/arch/sparc64/conf/majors.sparc64 @@ -1,4 +1,4 @@ -# $NetBSD: majors.sparc64,v 1.34 2017/03/26 13:57:53 martin Exp $ +# $NetBSD: majors.sparc64,v 1.35 2018/09/23 09:21:03 maxv Exp $ # # Device majors for sparc64 # @@ -60,11 +60,6 @@ device-major altq char 68 altq device-major audio char 69 audio device-major openprom char 70 # sparc: device-major tctrl char 71 tctrl -device-major isdn char 72 isdn -device-major isdnctl char 73 isdnctl -device-major isdnbchan char 74 isdnbchan -device-major isdntrc char 75 isdntrc -device-major isdntel char 76 isdntel device-major sabtty char 77 sabtty device-major usb char 78 usb device-major uhid char 79 uhid diff --git a/sys/arch/x68k/conf/majors.x68k b/sys/arch/x68k/conf/majors.x68k index f81524f79b6d..d801f015098b 100644 --- a/sys/arch/x68k/conf/majors.x68k +++ b/sys/arch/x68k/conf/majors.x68k @@ -1,4 +1,4 @@ -# $NetBSD: majors.x68k,v 1.27 2015/04/23 23:22:52 pgoyette Exp $ +# $NetBSD: majors.x68k,v 1.28 2018/09/23 09:21:03 maxv Exp $ # # Device majors for x68k # @@ -40,11 +40,6 @@ device-major rnd char 39 rnd device-major scsibus char 40 scsibus device-major raid char 41 block 16 raid device-major svr4_net char 42 compat_svr4 -device-major isdn char 43 isdn -device-major isdnctl char 44 isdnctl -device-major isdnbchan char 45 isdnbchan -device-major isdntrc char 46 isdntrc -device-major isdntel char 47 isdntel device-major clockctl char 48 clockctl device-major usb char 50 usb device-major ugen char 51 ugen diff --git a/sys/arch/zaurus/conf/majors.zaurus b/sys/arch/zaurus/conf/majors.zaurus index 176e6d0a66a5..93303d62be93 100644 --- a/sys/arch/zaurus/conf/majors.zaurus +++ b/sys/arch/zaurus/conf/majors.zaurus @@ -1,4 +1,4 @@ -# $NetBSD: majors.zaurus,v 1.7 2015/04/23 23:22:52 pgoyette Exp $ +# $NetBSD: majors.zaurus,v 1.8 2018/09/23 09:21:03 maxv Exp $ # # Device majors for zaurus # @@ -72,11 +72,6 @@ device-major urio char 75 urio device-major uscanner char 76 uscanner device-major openfirm char 77 openfirm device-major biconsdev char 78 biconsdev -device-major isdn char 79 isdn -device-major isdnctl char 80 isdnctl -device-major isdnrchan char 81 isdnbchan -device-major isdntrc char 82 isdntrc -device-major isdntel char 83 isdntel device-major sacom char 84 sacom device-major mly char 85 mly device-major wsfont char 86 wsfont @@ -98,7 +93,6 @@ device-major dmoverio char 102 dmoverio device-major apmdev char 103 apmdev device-major sscom char 104 sscom device-major ksyms char 105 ksyms -device-major isdnbchan char 106 isdnbchan device-major epcom char 107 epcom device-major tslcd char 108 tslcd device-major twe char 109 twe diff --git a/sys/conf/files b/sys/conf/files index 6af181b867b2..ce0845c2665b 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $NetBSD: files,v 1.1212 2018/09/22 16:22:23 maxv Exp $ +# $NetBSD: files,v 1.1213 2018/09/23 09:21:03 maxv Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 version 20171118 @@ -1357,13 +1357,6 @@ attach cpciic at cpcbus with iic_cpcbus file dev/ic/iic_cpcbus.c iic_cpcbus -# Attributes used by the ISDN subsystem -# -define isdndev # the ISDN subsystem -define passive_isdn # files needed by passive cards (XXX - protocol - # specific) -define isdncapi # ISDN CAPI (http://www.capi.org/) - # Broadcom AirForce / Apple Airport Extreme device bwi: arp, ifnet, firmload, wlan file dev/ic/bwi.c bwi @@ -1435,19 +1428,6 @@ defpseudo clockctl defpseudo accf_data defpseudo accf_http -# ISDN userland pseudo devices -# -defpseudo isdntrc: isdndev, tty -defpseudo isdnbchan: isdndev, tty -defpseudo isdntel: isdndev, tty -defpseudo isdnctl: isdndev, tty -defpseudo isdn: isdndev, tty - -# ISDN network interfaces -defpseudo irip: isdndev, ifnet -defflag opt_irip.h IRIP_VJ -defpseudo ippp: isdndev, sppp, ifnet - # KTTCP network throughput testing pseudo-device defpseudo kttcp file dev/kttcp.c kttcp needs-flag diff --git a/sys/dev/DEVNAMES b/sys/dev/DEVNAMES index 549fabd917be..1f42a33c0a9a 100644 --- a/sys/dev/DEVNAMES +++ b/sys/dev/DEVNAMES @@ -1,4 +1,4 @@ -# $NetBSD: DEVNAMES,v 1.317 2018/09/22 16:22:23 maxv Exp $ +# $NetBSD: DEVNAMES,v 1.318 2018/09/23 09:21:03 maxv Exp $ # # This file contains all used device names and defined attributes in # alphabetical order. New devices added to the system somewhere should first @@ -664,13 +664,11 @@ ipaqpcic hpcarm ipmi amd64 ipmi i386 ipmi xen -ippp MI ipw MI irdasir MI Attribute irframe MI irframedrv MI Attribute irif hpcmips -irip MI isa MI isabeep alpha isabeep prep @@ -679,11 +677,6 @@ isabus MI Attribute isabus atari isadma MI Attribute isapnp MI -isdn MI -isdnbchan MI -isdnctl MI -isdntel MI -isdntrc MI ismt amd64 ismt i386 isp MI diff --git a/sys/net/files.net b/sys/net/files.net index 6d43ef2e926d..5330c8e64a47 100644 --- a/sys/net/files.net +++ b/sys/net/files.net @@ -1,4 +1,4 @@ -# $NetBSD: files.net,v 1.18 2018/09/06 06:42:00 maxv Exp $ +# $NetBSD: files.net,v 1.19 2018/09/23 09:21:03 maxv Exp $ # XXX CLEANUP define net @@ -66,5 +66,3 @@ file netinet6/in6_gif.c gif & inet6 file netinet6/in6_l2tp.c l2tp & inet6 include "net/agr/files.agr" - -include "netisdn/files.i4b" diff --git a/sys/netisdn/Makefile b/sys/netisdn/Makefile deleted file mode 100644 index dc9beb015d6e..000000000000 --- a/sys/netisdn/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2002/11/26 23:30:35 lukem Exp $ - -INCSDIR= /usr/include/netisdn - -INCS= i4b_cause.h i4b_trace.h i4b_debug.h i4b_ioctl.h i4b_tel_ioctl.h \ - i4b_rbch_ioctl.h - -.include diff --git a/sys/netisdn/files.i4b b/sys/netisdn/files.i4b deleted file mode 100644 index 23f458400144..000000000000 --- a/sys/netisdn/files.i4b +++ /dev/null @@ -1,35 +0,0 @@ -# $NetBSD: files.i4b,v 1.1 2010/03/02 13:27:27 uebayasi Exp $ - -file netisdn/i4b_ctl.c isdnctl needs-flag -file netisdn/i4b_isppp.c ippp needs-count -file netisdn/i4b_ipr.c irip needs-count -file netisdn/i4b_rbch.c isdnbchan needs-count -file netisdn/i4b_tel.c isdntel needs-count -file netisdn/i4b_trace.c isdntrc needs-count - -file netisdn/i4b_mbuf.c passive_isdn -file netisdn/i4b_l2.c passive_isdn -file netisdn/i4b_l2fsm.c passive_isdn -file netisdn/i4b_uframe.c passive_isdn -file netisdn/i4b_tei.c passive_isdn -file netisdn/i4b_sframe.c passive_isdn -file netisdn/i4b_iframe.c passive_isdn -file netisdn/i4b_l2timer.c passive_isdn -file netisdn/i4b_util.c passive_isdn -file netisdn/i4b_lme.c passive_isdn -# Q.931 handler -file netisdn/i4b_q931.c passive_isdn -file netisdn/i4b_q932fac.c passive_isdn -file netisdn/i4b_l3fsm.c passive_isdn -file netisdn/i4b_l3timer.c passive_isdn -file netisdn/i4b_l2if.c passive_isdn -file netisdn/i4b_l4if.c passive_isdn -# isdn device driver, interface to isdnd -file netisdn/i4b_i4bdrv.c isdn needs-flag -file netisdn/i4b_l4.c isdndev needs-flag -file netisdn/i4b_l4mgmt.c isdndev needs-flag -file netisdn/i4b_l4timer.c isdndev needs-flag -# capi -file netisdn/i4b_capi_l4if.c isdncapi -file netisdn/i4b_capi_llif.c isdncapi -file netisdn/i4b_capi_msgs.c isdncapi diff --git a/sys/netisdn/i4b_capi.h b/sys/netisdn/i4b_capi.h deleted file mode 100644 index 2187355a76c8..000000000000 --- a/sys/netisdn/i4b_capi.h +++ /dev/null @@ -1,134 +0,0 @@ -/* $NetBSD: i4b_capi.h,v 1.6 2013/05/29 09:26:02 martin Exp $ */ - -/* - * Copyright (c) 2001-2003 Cubical Solutions Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * capi/capi.h The CAPI device interface. - * - * $FreeBSD: src/sys/i4b/capi/capi.h,v 1.1 2001/05/25 08:39:31 hm Exp $ - */ - -#ifndef _NETISDN_I4B_CAPI_H_ -#define _NETISDN_I4B_CAPI_H_ - -/* -// CAPI driver context: B channels and controller softcs. -*/ - -#define INVALID -1 - -enum capi_b_state { - B_FREE, /* 0: channel free, ncci invalid */ - B_CONNECT_CONF, /* 1: wait for CONNECT_CONF */ - B_CONNECT_IND, /* 2: IND got, wait for appl RESP */ - B_CONNECT_ACTIVE_IND, /* 3: wait for CONNECT_ACTIVE_IND */ - B_CONNECT_B3_CONF, /* 4: wait for CONNECT_B3_CONF */ - B_CONNECT_B3_IND, /* 5: wait for CONNECT_B3_IND */ - B_CONNECT_B3_ACTIVE_IND, /* 6: wait for CONNECT_B3_ACTIVE_IND */ - B_CONNECTED, /* 7: channel connected & in use */ - B_DISCONNECT_CONF, /* 8: wait for DISCONNECT_CONF */ - B_DISCONNECT_B3_CONF, /* 9: wait for DISCONNECT_B3_CONF */ - B_DISCONNECT_IND, /* 10: wait for DISCONNECT_IND */ -}; - -typedef struct capi_bchan -{ - /* Channel state */ - - int ncci; -#define CAPI_CTRL_MASK 0x000000ff -#define CAPI_PLCI_MASK 0x0000ffff -#define CAPI_NCCI_MASK 0xffff0000 - u_int16_t msgid; - int busy; - enum capi_b_state state; - - struct ifqueue tx_queue; - struct ifqueue rx_queue; - int rxcount; - int txcount; - - /* The rest is needed for i4b integration */ - int bprot; - int cdid; - - struct mbuf *in_mbuf; - isdn_link_t capi_isdn_linktab; - - const struct isdn_l4_driver_functions *l4_driver; - void *l4_driver_softc; -} capi_bchan_t; - -enum capi_c_state { - C_DOWN, /* controller uninitialized */ - C_READY, /* controller initialized but not listening */ - C_UP, /* controller listening */ -}; - -typedef struct capi_softc { - int sc_unit; /* index in capi_sc[] */ - int card_type; /* CARD_TYPEC_xxx, filled by ll driver */ - int sc_nbch; /* number of b channels on this controller */ - int sc_enabled; /* is daemon connected TRUE/FALSE */ - int sc_msgid; /* next CAPI message id */ - int capi_isdnif; /* isdnif identifier */ - char sc_profile[64];/* CAPI profile data */ - enum capi_c_state sc_state; - - capi_bchan_t sc_bchan[MAX_BCHAN]; - - /* Link layer driver context holder and methods */ - void *ctx; - - int (*load)(struct capi_softc *, int, u_int8_t *); - int (*reg_appl)(struct capi_softc *, int, int); - int (*rel_appl)(struct capi_softc *, int); - int (*send)(struct capi_softc *, struct mbuf *); -} capi_softc_t; - -#define CARD_TYPEC_CAPI_UNK 0 -#define CARD_TYPEC_AVM_T1_PCI 1 -#define CARD_TYPEC_AVM_B1_PCI 2 -#define CARD_TYPEC_AVM_B1_ISA 3 - -/* -// CAPI upcalls for the link layer. -*/ - -#define I4BCAPI_APPLID 1 - -extern int capi_ll_attach(capi_softc_t *, const char *, const char *); -extern int capi_ll_control(capi_softc_t *, int op, intptr_t arg); -extern int capi_ll_detach(capi_softc_t *); - -#define CAPI_CTRL_READY 0 /* ctrl ready, value=TRUE/FALSE */ -#define CAPI_CTRL_PROFILE 1 /* set CAPI profile */ -#define CAPI_CTRL_NEW_NCCI 2 /* new ncci value, assign bchan */ -#define CAPI_CTRL_FREE_NCCI 3 /* free ncci value, clear bchan */ - -extern int capi_ll_receive(capi_softc_t *, struct mbuf *); - -extern int capi_start_tx(void *, int bchan); - -#endif /* !_NETISDN_I4B_CAPI_H_ */ diff --git a/sys/netisdn/i4b_capi_l4if.c b/sys/netisdn/i4b_capi_l4if.c deleted file mode 100644 index 398f4f3b7fc4..000000000000 --- a/sys/netisdn/i4b_capi_l4if.c +++ /dev/null @@ -1,427 +0,0 @@ -/* $NetBSD: i4b_capi_l4if.c,v 1.9 2006/11/16 01:33:49 christos Exp $ */ - -/* - * Copyright (c) 2001-2003 Cubical Solutions Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * capi/capi_l4if.c The CAPI i4b L4/device interface. - * - * $FreeBSD: src/sys/i4b/capi/capi_l4if.c,v 1.4 2002/04/04 21:03:20 jhb Exp $ - */ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_capi_l4if.c,v 1.9 2006/11/16 01:33:49 christos Exp $"); - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static void n_connect_request(call_desc_t *); -static void n_connect_response(call_desc_t *, int response, int cause); -static void n_disconnect_request(call_desc_t *, int cause); -static void n_alert_request(call_desc_t *); -static void n_mgmt_command(struct isdn_l3_driver *, int cmd, void *parm); -static int n_download(void *, int, struct isdn_dr_prot *); - -static int ncapi = 0; - -/* -// i4b_capi_{ret,set}_linktab -// i4b driver glue. -// -// i4b_capi_bch_config -// Called by i4b driver to flush + {en,dis}able a channel. -// -// i4b_capi_bch_start_tx -// Called by i4b driver to transmit a queued mbuf. -// -// i4b_capi_bch_stat -// Called by i4b driver to obtain statistics information. -*/ - -static isdn_link_t * -i4b_capi_ret_linktab(void *token, int channel) -{ - capi_softc_t *sc = token; - - return &sc->sc_bchan[channel].capi_isdn_linktab; -} - -static void -i4b_capi_set_link(void *token, int channel, - const struct isdn_l4_driver_functions *l4_driver, void *l4_inst) -{ - capi_softc_t *sc = token; - - sc->sc_bchan[channel].l4_driver = l4_driver; - sc->sc_bchan[channel].l4_driver_softc = l4_inst; -} - -static void -i4b_capi_bch_config(void *token, int chan, int bprot, int activate) -{ - capi_softc_t *sc = token; - - i4b_Bcleanifq(&sc->sc_bchan[chan].tx_queue); - sc->sc_bchan[chan].tx_queue.ifq_maxlen = IFQ_MAXLEN; - sc->sc_bchan[chan].txcount = 0; - - /* The telephony drivers use rx_queue for receive. */ - i4b_Bcleanifq(&sc->sc_bchan[chan].rx_queue); - sc->sc_bchan[chan].rx_queue.ifq_maxlen = IFQ_MAXLEN; - sc->sc_bchan[chan].rxcount = 0; - - /* HDLC frames are put to in_mbuf */ - i4b_Bfreembuf(sc->sc_bchan[chan].in_mbuf); - sc->sc_bchan[chan].in_mbuf = NULL; - - /* Because of the difference, we need to remember the protocol. */ - sc->sc_bchan[chan].bprot = bprot; - sc->sc_bchan[chan].busy = 0; -} - -static void -i4b_capi_bch_start_tx(void *token, int chan) -{ - capi_softc_t *sc = token; - int s; - - s = splnet(); - - if (sc->sc_bchan[chan].state != B_CONNECTED) { - splx(s); - printf("capi%d: start_tx on unconnected channel\n", sc->sc_unit); - return; - } - - if (sc->sc_bchan[chan].busy) { - splx(s); - return; - } - - capi_start_tx(sc, chan); - - splx(s); -} - -static void -i4b_capi_bch_stat(void *token, int chan, bchan_statistics_t *bsp) -{ - capi_softc_t *sc = token; - int s = splnet(); - - bsp->outbytes = sc->sc_bchan[chan].txcount; - bsp->inbytes = sc->sc_bchan[chan].rxcount; - - sc->sc_bchan[chan].txcount = 0; - sc->sc_bchan[chan].rxcount = 0; - - splx(s); -} - -int capi_start_tx(void *token, int chan) -{ - capi_softc_t *sc = token; - struct mbuf *m_b3; - int sent = 0; - - IF_DEQUEUE(&sc->sc_bchan[chan].tx_queue, m_b3); - while (m_b3) { - struct mbuf *m = m_b3->m_next; - - sc->sc_bchan[chan].txcount += m_b3->m_len; - capi_data_b3_req(sc, chan, m_b3); - sent++; - - m_b3 = m; - } - - if (sc->sc_bchan[chan].l4_driver) { - capi_bchan_t *bch = &sc->sc_bchan[chan]; - - /* Notify i4b driver of activity, and if the queue is drained. */ - if (sent) - (*bch->l4_driver->bch_activity)(bch->l4_driver_softc, ACT_TX); - - if (IF_QEMPTY(&bch->tx_queue)) - (*bch->l4_driver->bch_tx_queue_empty)(bch->l4_driver_softc); - } - - return sent; -} - -static const struct isdn_l4_bchannel_functions -capi_l4_driver = { - i4b_capi_bch_config, - i4b_capi_bch_start_tx, - i4b_capi_bch_stat -}; - -/* -// n_mgmt_command -// i4b L4 management command. -*/ - -static void -n_mgmt_command(struct isdn_l3_driver *l3, int op, void *arg) -{ - capi_softc_t *sc = l3->l1_token; - -#if 0 - printf("capi%d: mgmt command %d\n", sc->sc_unit, op); -#endif - - switch(op) { - case CMR_DOPEN: - sc->sc_enabled = 1; - break; - - case CMR_DCLOSE: - sc->sc_enabled = 0; - break; - - case CMR_SETTRACE: - break; - - default: - break; - } -} - -/* -// n_connect_request -// i4b L4 wants to connect. We assign a B channel to the call, -// send a CAPI_CONNECT_REQ, and set the channel to B_CONNECT_CONF. -*/ - -static void -n_connect_request(call_desc_t *cd) -{ - capi_softc_t *sc; - int bch, s; - - sc = cd->l3drv->l1_token; - bch = cd->channelid; - - s = splnet(); - - if ((bch < 0) || (bch >= sc->sc_nbch)) - for (bch = 0; bch < sc->sc_nbch; bch++) - if (sc->sc_bchan[bch].state == B_FREE) - break; - - if (bch == sc->sc_nbch) { - splx(s); - printf("capi%d: no free B channel\n", sc->sc_unit); - return; - } - - cd->channelid = bch; - - capi_connect_req(sc, cd); - splx(s); -} - -/* -// n_connect_response -// i4b L4 answers a call. We send a CONNECT_RESP with the proper -// Reject code, and set the channel to B_CONNECT_B3_IND or B_FREE, -// depending whether we answer or not. -*/ - -static void -n_connect_response(call_desc_t *cd, int response, int cause) -{ - capi_softc_t *sc; - int s; - - sc = cd->l3drv->l1_token; - - T400_stop(cd); - - cd->response = response; - cd->cause_out = cause; - - s = splnet(); - capi_connect_resp(sc, cd); - splx(s); -} - -/* -// n_disconnect_request -// i4b L4 wants to disconnect. We send a DISCONNECT_REQ and -// set the channel to B_DISCONNECT_CONF. -*/ - -static void -n_disconnect_request(call_desc_t *cd, int cause) -{ - capi_softc_t *sc; - int s; - - sc = cd->l3drv->l1_token; - - cd->cause_out = cause; - - s = splnet(); - capi_disconnect_req(sc, cd); - splx(s); -} - -/* -// n_alert_request -// i4b L4 wants to alert an incoming call. We send ALERT_REQ. -*/ - -static void -n_alert_request(call_desc_t *cd) -{ - capi_softc_t *sc; - int s; - - sc = cd->l3drv->l1_token; - - s = splnet(); - capi_alert_req(sc, cd); - splx(s); -} - -/* -// n_download -// L4 -> firmware download -*/ - -static int -n_download(void *token, int numprotos, struct isdn_dr_prot *protocols) -{ - capi_softc_t *sc = token; - - if (sc->load) { - (*sc->load)(sc, protocols[0].bytecount, - protocols[0].microcode); - return(0); - } - - return(ENXIO); -} - -static const struct isdn_l3_driver_functions -capi_l3_functions = { - i4b_capi_ret_linktab, - i4b_capi_set_link, - n_connect_request, - n_connect_response, - n_disconnect_request, - n_alert_request, - n_download, - NULL, - n_mgmt_command -}; - -/* -// capi_ll_attach -// Called by a link layer driver at boot time. -*/ - -int -capi_ll_attach(capi_softc_t *sc, const char *devname, const char *cardname) -{ - struct isdn_l3_driver *l3drv; - int i; - - /* Unit state */ - - sc->sc_enabled = 0; - sc->sc_state = C_DOWN; - sc->sc_msgid = 0; - - for (i = 0; i < sc->sc_nbch; i++) { - sc->sc_bchan[i].ncci = INVALID; - sc->sc_bchan[i].msgid = 0; - sc->sc_bchan[i].busy = 0; - sc->sc_bchan[i].state = B_FREE; - - memset(&sc->sc_bchan[i].tx_queue, 0, sizeof(struct ifqueue)); - memset(&sc->sc_bchan[i].rx_queue, 0, sizeof(struct ifqueue)); - sc->sc_bchan[i].tx_queue.ifq_maxlen = IFQ_MAXLEN; - sc->sc_bchan[i].rx_queue.ifq_maxlen = IFQ_MAXLEN; - - sc->sc_bchan[i].txcount = 0; - sc->sc_bchan[i].rxcount = 0; - - sc->sc_bchan[i].cdid = CDID_UNUSED; - sc->sc_bchan[i].bprot = BPROT_NONE; - sc->sc_bchan[i].in_mbuf = NULL; - - sc->sc_bchan[i].capi_isdn_linktab.l1token = sc; - sc->sc_bchan[i].capi_isdn_linktab.channel = i; - sc->sc_bchan[i].capi_isdn_linktab.bchannel_driver = &capi_l4_driver; - sc->sc_bchan[i].capi_isdn_linktab.tx_queue = &sc->sc_bchan[i].tx_queue; - sc->sc_bchan[i].capi_isdn_linktab.rx_queue = &sc->sc_bchan[i].rx_queue; - sc->sc_bchan[i].capi_isdn_linktab.rx_mbuf = &sc->sc_bchan[i].in_mbuf; - } - - l3drv = isdn_attach_isdnif(devname, cardname, sc, &capi_l3_functions, - sc->sc_nbch); - - l3drv->tei = -1; - l3drv->dl_est = DL_DOWN; - l3drv->nbch = sc->sc_nbch; - - sc->sc_unit = ncapi++; - sc->capi_isdnif = l3drv->isdnif; - - isdn_isdnif_ready(l3drv->isdnif); - - printf("capi%d: card type %d attached\n", sc->sc_unit, sc->card_type); - - return(0); -} - - -/* -// capi_ll_detach -*/ - -int -capi_ll_detach(capi_softc_t *sc) -{ - - (void)sc; - /* TODO */ - return(0); -} diff --git a/sys/netisdn/i4b_capi_llif.c b/sys/netisdn/i4b_capi_llif.c deleted file mode 100644 index a53a457bbd9b..000000000000 --- a/sys/netisdn/i4b_capi_llif.c +++ /dev/null @@ -1,164 +0,0 @@ -/* $NetBSD: i4b_capi_llif.c,v 1.6 2013/05/29 09:26:02 martin Exp $ */ - -/* - * Copyright (c) 2001 Cubical Solutions Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * capi/capi_llif.c The i4b CAPI link layer interface. - * - * $FreeBSD: src/sys/i4b/capi/capi_llif.c,v 1.1 2001/05/25 08:39:31 hm Exp $ - */ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_capi_llif.c,v 1.6 2013/05/29 09:26:02 martin Exp $"); - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* -// capi_ll_control -// CAPI link layer control routine. Called by a link layer -// driver when its state changes. -*/ - -int -capi_ll_control(capi_softc_t *sc, int op, intptr_t arg) -{ - switch (op) { - case CAPI_CTRL_READY: - if (arg) { - sc->sc_state = C_READY; - - /* - * Register our CAPI ApplId and send CAPI_LISTEN_REQ - * with CIP Mask value 1 (match all). - */ - - sc->reg_appl(sc, I4BCAPI_APPLID, sc->sc_nbch); - capi_listen_req(sc, 0x10007); - - } else { - sc->sc_state = C_DOWN; - /* XXX go through cds and notify L4 of pdeact? XXX */ - } - break; - - case CAPI_CTRL_PROFILE: - memcpy(&sc->sc_profile, (char*) arg, sizeof(sc->sc_profile)); - break; - - case CAPI_CTRL_NEW_NCCI: - case CAPI_CTRL_FREE_NCCI: - /* We ignore the controller's NCCI notifications. */ - break; - - default: - printf("capi%d: unknown control %d\n", sc->sc_unit, op); - } - - return 0; -} - -/* -// i4b_capi_handlers -// Array of message-handler pairs used to dispatch CAPI -// messages sent to I4BCAPI_APPLID. -*/ - -static struct capi_cmdtab { - u_int16_t cmd; - void (*handler)(capi_softc_t *, struct mbuf *); -} i4b_capi_handlers[] = { - { CAPI_LISTEN_CONF, capi_listen_conf }, - { CAPI_INFO_IND, capi_info_ind }, - { CAPI_ALERT_CONF, capi_alert_conf }, - { CAPI_CONNECT_CONF, capi_connect_conf }, - { CAPI_CONNECT_IND, capi_connect_ind }, - { CAPI_CONNECT_ACTIVE_IND, capi_connect_active_ind }, - { CAPI_CONNECT_B3_CONF, capi_connect_b3_conf }, - { CAPI_CONNECT_B3_IND, capi_connect_b3_ind }, - { CAPI_CONNECT_B3_ACTIVE_IND, capi_connect_b3_active_ind }, - { CAPI_DATA_B3_CONF, capi_data_b3_conf }, - { CAPI_DATA_B3_IND, capi_data_b3_ind }, - { CAPI_DISCONNECT_B3_IND, capi_disconnect_b3_ind }, - { CAPI_DISCONNECT_CONF, capi_disconnect_conf }, - { CAPI_DISCONNECT_IND, capi_disconnect_ind }, - { 0, 0 } -}; - -/* -// capi_ll_receive -// CAPI link layer receive upcall. Called by a link layer -// driver to dispatch incoming CAPI messages. -*/ - -int -capi_ll_receive(capi_softc_t *sc, struct mbuf *m) -{ - u_int8_t *p = mtod(m, u_int8_t*); - u_int16_t len, applid, msgid, cmd; - - capimsg_getu16(p + 0, &len); - capimsg_getu16(p + 2, &applid); - capimsg_getu16(p + 4, &cmd); - capimsg_getu16(p + 6, &msgid); - -#if 0 - printf("capi%d: ll_receive hdr %04x %04x %04x %04x\n", sc->sc_unit, - len, applid, cmd, msgid); -#endif - - if (applid == I4BCAPI_APPLID) { - struct capi_cmdtab *e; - for (e = i4b_capi_handlers; e->cmd && e->cmd != cmd; e++); - if (e->cmd) (*e->handler)(sc, m); - else printf("capi%d: unknown message %04x\n", sc->sc_unit, cmd); - - } else { - /* XXX we could handle arbitrary ApplIds here XXX */ - printf("capi%d: message %04x for unknown applid %d\n", sc->sc_unit, - cmd, applid); - } - - if (m->m_next) { - i4b_Bfreembuf(m->m_next); - m->m_next = NULL; - } - i4b_Dfreembuf(m); - return(0); -} diff --git a/sys/netisdn/i4b_capi_msgs.c b/sys/netisdn/i4b_capi_msgs.c deleted file mode 100644 index 04db76718489..000000000000 --- a/sys/netisdn/i4b_capi_msgs.c +++ /dev/null @@ -1,982 +0,0 @@ -/* $NetBSD: i4b_capi_msgs.c,v 1.9 2017/03/28 08:47:19 ozaki-r Exp $ */ - -/* - * Copyright (c) 2001-2003 Cubical Solutions Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * capi/capi_msgs.c The CAPI i4b message handlers. - * - * $FreeBSD: src/sys/i4b/capi/capi_msgs.c,v 1.2 2001/10/21 08:51:54 hm Exp $ - */ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_capi_msgs.c,v 1.9 2017/03/28 08:47:19 ozaki-r Exp $"); - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* -// Administrative messages: -// ------------------------ -*/ - -void capi_listen_req(capi_softc_t *sc, u_int32_t CIP) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 18); - u_int8_t *msg; - u_int16_t msgid; - - if (!m) { - printf("capi%d: can't get mbuf for listen_req\n", sc->sc_unit); - return; - } - - msgid = sc->sc_msgid++; - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, I4BCAPI_APPLID); - msg = capimsg_setu16(msg, CAPI_LISTEN_REQ); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, sc->sc_unit + 1); /* Controller */ - msg = capimsg_setu32(msg, 0); /* Info mask */ - msg = capimsg_setu32(msg, CIP); - msg = capimsg_setu32(msg, 0); - msg = capimsg_setu8(msg, 0); - msg = capimsg_setu8(msg, 0); - - sc->send(sc, m); -} - -void capi_listen_conf(capi_softc_t *sc, struct mbuf *m_in) -{ - struct isdn_l3_driver *l3drv; - u_int8_t *msg = mtod(m_in, u_int8_t*); - u_int16_t Info; - - capimsg_getu16(msg + 12, &Info); - - if (Info == 0) { - /* We are now listening. */ - - sc->sc_state = C_UP; - l3drv = isdn_find_l3_by_isdnif(sc->capi_isdnif); - l3drv->dl_est = DL_UP; - - i4b_l4_l12stat(l3drv, 1, 1); - i4b_l4_l12stat(l3drv, 2, 1); - - } else { - /* XXX sc->sc_state = C_DOWN ? XXX */ - printf("capi%d: can't listen, info=%04x\n", sc->sc_unit, Info); - } -} - -void capi_info_ind(capi_softc_t *sc, struct mbuf *m_in) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 4); - u_int8_t *msg = mtod(m_in, u_int8_t*); - u_int16_t applid, msgid; - u_int32_t PLCI; - - if (!m) { - printf("capi%d: can't get mbuf for info_resp\n", sc->sc_unit); - return; - } - - msg = capimsg_getu16(msg + 2, &applid); - msg = capimsg_getu16(msg + 2, &msgid); - msg = capimsg_getu32(msg, &PLCI); - - /* i4b_l4_info_ind() */ - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, applid); - msg = capimsg_setu16(msg, CAPI_INFO_RESP); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, PLCI); - - sc->send(sc, m); -} - -void capi_alert_req(capi_softc_t *sc, call_desc_t *cd) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 5); - u_int8_t *msg; - u_int16_t msgid; - u_int32_t PLCI; - - if (!m) { - printf("capi%d: can't get mbuf for alert_req\n", sc->sc_unit); - return; - } - - msgid = sc->sc_bchan[cd->channelid].msgid = sc->sc_msgid++; - PLCI = (sc->sc_bchan[cd->channelid].ncci & CAPI_PLCI_MASK); - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, I4BCAPI_APPLID); - msg = capimsg_setu16(msg, CAPI_ALERT_REQ); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, PLCI); - msg = capimsg_setu8(msg, 0); - - sc->send(sc, m); -} - -void capi_alert_conf(capi_softc_t *sc, struct mbuf *m_in) -{ - u_int8_t *msg = mtod(m_in, u_int8_t*); - u_int16_t Info; - - msg = capimsg_getu16(msg + 12, &Info); - - if (Info) { - printf("capi%d: can't alert, info=%04x\n", sc->sc_unit, Info); - } -} - -/* -// Outgoing call setup: -// -------------------- -// -// CAPI_CONNECT_REQ --> -// <-- CAPI_CONNECT_CONF -// (notify Layer 4) -// <-- CAPI_CONNECT_ACTIVE_IND -// CAPI_CONNECT_ACTIVE_RESP --> -// CAPI_CONNECT_B3_REQ --> -// <-- CAPI_CONNECT_B3_CONF -// <-- CAPI_CONNECT_B3_ACTIVE_IND -// CAPI_CONNECT_B3_ACTIVE_RESP --> -// (notify Layer 4) -*/ - -void capi_connect_req(capi_softc_t *sc, call_desc_t *cd) -{ - struct isdn_l3_driver *l3drv; - struct mbuf *m; - u_int8_t *msg; - u_int16_t msgid; - int slen = strlen(cd->src_telno); - int dlen = strlen(cd->dst_telno); - - m = i4b_Dgetmbuf(8 + 27 + slen + dlen); - if (!m) { - printf("capi%d: can't get mbuf for connect_req\n", sc->sc_unit); - return; - } - - l3drv = isdn_find_l3_by_isdnif(sc->capi_isdnif); - - cd->crflag = CRF_ORIG; - - sc->sc_bchan[cd->channelid].cdid = cd->cdid; - sc->sc_bchan[cd->channelid].bprot = cd->bprot; - sc->sc_bchan[cd->channelid].state = B_CONNECT_CONF; - msgid = sc->sc_bchan[cd->channelid].msgid = sc->sc_msgid++; - l3drv->bch_state[cd->channelid] = BCH_ST_RSVD; - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, I4BCAPI_APPLID); - msg = capimsg_setu16(msg, CAPI_CONNECT_REQ); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, sc->sc_unit + 1); /* Controller */ - - switch (cd->bprot) { - case BPROT_NONE: - msg = capimsg_setu16(msg, 0x0010); /* Telephony */ - break; - - case BPROT_RHDLC: - msg = capimsg_setu16(msg, 0x0002); /* Unrestricted digital */ - break; - - default: - msg = capimsg_setu16(msg, 0x0002); /* Unrestricted digital */ - } - - msg = capimsg_setu8(msg, 1 + dlen); - msg = capimsg_setu8(msg, 0x80); - strncpy(msg, cd->dst_telno, dlen); - - msg = capimsg_setu8(msg + dlen, 2 + slen); - msg = capimsg_setu8(msg, 0x00); - msg = capimsg_setu8(msg, 0x80); /* Presentation and screening indicator */ - strncpy(msg, cd->src_telno, slen); - - msg = capimsg_setu8(msg + slen, 0); /* Called & */ - msg = capimsg_setu8(msg, 0); /* Calling party subaddress */ - - msg = capimsg_setu8(msg, 15); /* B protocol */ - if (cd->bprot == BPROT_NONE) - msg = capimsg_setu16(msg, 1); /* B1 protocol = transparent */ - else - msg = capimsg_setu16(msg, 0); /* B1 protocol = HDLC */ - msg = capimsg_setu16(msg, 1); /* B2 protocol = transparent */ - msg = capimsg_setu16(msg, 0); /* B3 protocol = transparent */ - msg = capimsg_setu8(msg, 0); /* B1 parameters */ - msg = capimsg_setu8(msg, 0); /* B2 parameters */ - msg = capimsg_setu8(msg, 0); /* B3 parameters */ - - msg = capimsg_setu8(msg, 0); /* Bearer Capability */ - msg = capimsg_setu8(msg, 0); /* Low Layer Compatibility */ - msg = capimsg_setu8(msg, 0); /* High Layer Compatibility */ - msg = capimsg_setu8(msg, 0); /* Additional Info */ - - sc->send(sc, m); -} - -void capi_connect_conf(capi_softc_t *sc, struct mbuf *m_in) -{ - u_int8_t *msg = mtod(m_in, u_int8_t*); - call_desc_t *cd; - u_int16_t msgid; - u_int32_t PLCI; - u_int16_t Info; - int bch; - - msg = capimsg_getu16(msg + 6, &msgid); - msg = capimsg_getu32(msg, &PLCI); - msg = capimsg_getu16(msg, &Info); - - for (bch = 0; bch < sc->sc_nbch; bch++) - if ((sc->sc_bchan[bch].state == B_CONNECT_CONF) && - (sc->sc_bchan[bch].msgid == msgid)) - break; - - if ((bch == sc->sc_nbch) || - (cd = cd_by_cdid(sc->sc_bchan[bch].cdid)) == NULL) { - printf("capi%d: can't find channel for connect_conf PLCI %x\n", - sc->sc_unit, PLCI); - return; - } - - if (Info == 0) { - sc->sc_bchan[bch].state = B_CONNECT_ACTIVE_IND; - sc->sc_bchan[bch].ncci = PLCI; - - i4b_l4_proceeding_ind(cd); - - } else { - struct isdn_l3_driver *l3drv; - - l3drv = isdn_find_l3_by_isdnif(sc->capi_isdnif); - SET_CAUSE_TV(cd->cause_out, CAUSET_I4B, CAUSE_I4B_L1ERROR); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); - - sc->sc_bchan[bch].state = B_FREE; - - l3drv->bch_state[bch] = BCH_ST_FREE; - - printf("capi%d: can't connect out, info=%04x\n", sc->sc_unit, Info); - } -} - -void capi_connect_active_ind(capi_softc_t *sc, struct mbuf *m_in) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 4); - u_int8_t *msg = mtod(m_in, u_int8_t*); - call_desc_t *cd; - u_int16_t applid, msgid; - u_int32_t PLCI; - int bch; - - if (!m) { - printf("capi%d: can't get mbuf for active_ind\n", sc->sc_unit); - return; - } - - msg = capimsg_getu16(msg + 2, &applid); - msg = capimsg_getu16(msg + 2, &msgid); - msg = capimsg_getu32(msg, &PLCI); - - for (bch = 0; bch < sc->sc_nbch; bch++) - if ((sc->sc_bchan[bch].state == B_CONNECT_ACTIVE_IND) && - (sc->sc_bchan[bch].ncci == PLCI)) - break; - - if ((bch == sc->sc_nbch) || - (cd = cd_by_cdid(sc->sc_bchan[bch].cdid)) == NULL) { - printf("capi%d: can't find channel for active_resp, PLCI %x\n", - sc->sc_unit, PLCI); - return; - } - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, applid); - msg = capimsg_setu16(msg, CAPI_CONNECT_ACTIVE_RESP); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, PLCI); - - sc->send(sc, m); - - if (cd->crflag == CRF_ORIG) { - capi_connect_b3_req(sc, cd); - - } else { - sc->sc_bchan[bch].state = B_CONNECT_B3_IND; - } -} - -void capi_connect_b3_req(capi_softc_t *sc, call_desc_t *cd) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 5); - u_int8_t *msg; - u_int16_t msgid; - u_int32_t PLCI; - - if (!m) { - printf("capi%d: can't get mbuf for connect_b3_req\n", sc->sc_unit); - return; - } - - sc->sc_bchan[cd->channelid].state = B_CONNECT_B3_CONF; - msgid = sc->sc_bchan[cd->channelid].msgid = sc->sc_msgid++; - PLCI = (sc->sc_bchan[cd->channelid].ncci & CAPI_PLCI_MASK); - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, I4BCAPI_APPLID); - msg = capimsg_setu16(msg, CAPI_CONNECT_B3_REQ); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, PLCI); - msg = capimsg_setu8(msg, 0); /* NCPI */ - - sc->send(sc, m); -} - -void capi_connect_b3_conf(capi_softc_t *sc, struct mbuf *m_in) -{ - u_int8_t *msg = mtod(m_in, u_int8_t*); - call_desc_t *cd; - u_int16_t msgid; - u_int32_t NCCI; - u_int16_t Info; - int bch; - - msg = capimsg_getu16(msg + 6, &msgid); - msg = capimsg_getu32(msg, &NCCI); - msg = capimsg_getu16(msg, &Info); - - for (bch = 0; bch < sc->sc_nbch; bch++) - if ((sc->sc_bchan[bch].state == B_CONNECT_B3_CONF) && - (sc->sc_bchan[bch].ncci == (NCCI & CAPI_PLCI_MASK))) - break; - - if ((bch == sc->sc_nbch) || - (cd = cd_by_cdid(sc->sc_bchan[bch].cdid)) == NULL) { - printf("capi%d: can't find channel for connect_b3_conf NCCI %x\n", - sc->sc_unit, NCCI); - return; - } - - if (Info == 0) { - sc->sc_bchan[bch].ncci = NCCI; - sc->sc_bchan[bch].state = B_CONNECT_B3_ACTIVE_IND; - - } else { - struct isdn_l3_driver *l3drv; - - l3drv = isdn_find_l3_by_isdnif(sc->capi_isdnif); - - SET_CAUSE_TV(cd->cause_in, CAUSET_I4B, CAUSE_I4B_OOO); /* XXX */ - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); - - l3drv->bch_state[bch] = BCH_ST_RSVD; - - printf("capi%d: can't connect_b3 out, info=%04x\n", sc->sc_unit, Info); - - capi_disconnect_req(sc, cd); - } -} - -void capi_connect_b3_active_ind(capi_softc_t *sc, struct mbuf *m_in) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 4); - u_int8_t *msg = mtod(m_in, u_int8_t*); - call_desc_t *cd; - u_int16_t applid, msgid; - u_int32_t NCCI; - int bch; - - if (!m) { - printf("capi%d: can't get mbuf for b3_active_ind\n", sc->sc_unit); - return; - } - - msg = capimsg_getu16(msg + 2, &applid); - msg = capimsg_getu16(msg + 2, &msgid); - msg = capimsg_getu32(msg, &NCCI); - - for (bch = 0; bch < sc->sc_nbch; bch++) - if ((sc->sc_bchan[bch].state == B_CONNECT_B3_ACTIVE_IND) && - (sc->sc_bchan[bch].ncci == NCCI)) - break; - - if ((bch == sc->sc_nbch) || - (cd = cd_by_cdid(sc->sc_bchan[bch].cdid)) == NULL) { - printf("capi%d: can't find channel for b3_active_resp NCCI %x\n", - sc->sc_unit, NCCI); - return; - } - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, I4BCAPI_APPLID); - msg = capimsg_setu16(msg, CAPI_CONNECT_B3_ACTIVE_RESP); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, NCCI); - - sc->send(sc, m); - - sc->sc_bchan[bch].state = B_CONNECTED; - - i4b_l4_connect_active_ind(cd); -} - -/* -// Incoming call setup: -// -------------------- -// -// <-- CAPI_CONNECT_IND -// (consult Layer 4) -// CAPI_CONNECT_RESP --> -// <-- CAPI_CONNECT_ACTIVE_IND -// CAPI_CONNECT_ACTIVE_RESP --> -// <-- CAPI_CONNECT_B3_IND -// CAPI_CONNECT_B3_RESP --> -// <-- CAPI_CONNECT_B3_ACTIVE_IND -// CAPI_CONNECT_B3_ACTIVE_RESP --> -// (notify Layer 4) -*/ - -void capi_connect_ind(capi_softc_t *sc, struct mbuf *m_in) -{ - u_int8_t *msg = mtod(m_in, u_int8_t*); - call_desc_t *cd; - u_int16_t applid, msgid; - u_int32_t PLCI; - u_int16_t CIP; - u_int8_t x, y, z; - int bch; - - if ((cd = reserve_cd()) == NULL) { - printf("capi%d: can't get cd for connect_ind\n", sc->sc_unit); - return; - } - - cd->isdnif = sc->capi_isdnif; - cd->channelexcl = 0; - cd->l3drv = isdn_find_l3_by_isdnif(sc->capi_isdnif); - - for (bch = 0; bch < sc->sc_nbch; bch++) - if (sc->sc_bchan[bch].state == B_FREE) - break; - - sc->sc_bchan[bch].state = B_CONNECT_IND; - cd->channelid = bch; /* XXX CHAN_ANY XXX */ - - cd->crflag = CRF_DEST; - cd->cr = get_rand_cr(sc->sc_unit); - cd->scr_ind = SCR_NONE; - cd->prs_ind = PRS_NONE; - cd->bprot = BPROT_NONE; - cd->ilt = NULL; - cd->display[0] = '\0'; - cd->datetime[0] = '\0'; - - msg = capimsg_getu16(msg + 2, &applid); - msg = capimsg_getu16(msg + 2, &msgid); - msg = capimsg_getu32(msg, &PLCI); - msg = capimsg_getu16(msg, &CIP); - - cd->event = (int) msgid; /* XXX overload */ - cd->Q931state = (int) PLCI; /* XXX overload */ - - switch (CIP) { - case 0x0010: - case 0x0001: cd->bprot = BPROT_NONE; break; - case 0x0002: cd->bprot = BPROT_RHDLC; break; - default: -#if 0 - NDBGL4(L4_CAPIDBG, "capi%d: unknown CIP = %d", sc->sc_unit, CIP); -#endif - cd->bprot = BPROT_NONE; - } - - msg = capimsg_getu8(msg, &x); /* Called party struct len */ - if (x) { - msg = capimsg_getu8(msg, &y); /* Numbering plan */ - z = x - 1; - if (z >= TELNO_MAX) z = (TELNO_MAX-1); - strncpy(cd->dst_telno, msg, z); - msg += x; - x = z; - } - cd->dst_telno[x] = '\0'; - - msg = capimsg_getu8(msg, &x); /* Calling party struct len */ - if (x) { - msg = capimsg_getu8(msg, &y); /* Numbering plan */ - msg = capimsg_getu8(msg, &y); /* Screening/Presentation */ - if ((y & 0x80) == 0) { /* screening used */ - cd->scr_ind = (y & 3) + SCR_USR_NOSC; - cd->prs_ind = ((y >> 5) & 3) + PRS_ALLOWED; - } - z = x - 2; - if (z >= TELNO_MAX) z = (TELNO_MAX-1); - strncpy(cd->src_telno, msg, z); - msg += x; - x = z; - } - cd->src_telno[x] = '\0'; - - i4b_l4_connect_ind(cd); -} - -void capi_connect_resp(capi_softc_t *sc, call_desc_t *cd) -{ - struct isdn_l3_driver *l3drv; - struct mbuf *m; - u_int8_t *msg; - u_int16_t msgid; - u_int32_t PLCI; - int dlen = strlen(cd->dst_telno); - - m = i4b_Dgetmbuf(8 + 21 + dlen); - if (!m) { - printf("capi%d: can't get mbuf for connect_resp\n", sc->sc_unit); - return; - } - - l3drv = isdn_find_l3_by_isdnif(sc->capi_isdnif); - - msgid = (u_int16_t) cd->event; - PLCI = (u_int32_t) cd->Q931state; - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, I4BCAPI_APPLID); - msg = capimsg_setu16(msg, CAPI_CONNECT_RESP); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, PLCI); - - switch (cd->response) { - case SETUP_RESP_ACCEPT: - sc->sc_bchan[cd->channelid].cdid = cd->cdid; - sc->sc_bchan[cd->channelid].ncci = PLCI; - sc->sc_bchan[cd->channelid].state = B_CONNECT_ACTIVE_IND; - l3drv->bch_state[cd->channelid] = BCH_ST_USED; - msg = capimsg_setu16(msg, 0); /* Accept the call */ - break; - - case SETUP_RESP_REJECT: - sc->sc_bchan[cd->channelid].state = B_FREE; - l3drv->bch_state[cd->channelid] = BCH_ST_FREE; - msg = capimsg_setu16(msg, 2); /* Reject, normal call clearing */ - break; - - case SETUP_RESP_DNTCRE: - sc->sc_bchan[cd->channelid].state = B_FREE; - l3drv->bch_state[cd->channelid] = BCH_ST_FREE; - if (sc->sc_nbch == 30) { - /* With PRI, we can't really ignore calls -- normal clearing */ - msg = capimsg_setu16(msg, (0x3480|CAUSE_Q850_NCCLR)); - } else { - msg = capimsg_setu16(msg, 1); /* Ignore */ - } - break; - - default: - sc->sc_bchan[cd->channelid].state = B_FREE; - l3drv->bch_state[cd->channelid] = BCH_ST_FREE; - msg = capimsg_setu16(msg, (0x3480|CAUSE_Q850_CALLREJ)); - } - - msg = capimsg_setu8(msg, 15); /* B protocol */ - if (cd->bprot == BPROT_NONE) - msg = capimsg_setu16(msg, 1); /* B1 protocol = transparent */ - else - msg = capimsg_setu16(msg, 0); /* B1 protocol = HDLC */ - msg = capimsg_setu16(msg, 1); /* B2 protocol = transparent */ - msg = capimsg_setu16(msg, 0); /* B3 protocol = transparent */ - msg = capimsg_setu8(msg, 0); /* B1 parameters */ - msg = capimsg_setu8(msg, 0); /* B2 parameters */ - msg = capimsg_setu8(msg, 0); /* B3 parameters */ - - msg = capimsg_setu8(msg, 1 + dlen); - msg = capimsg_setu8(msg, 0x80); /* Numbering plan */ - strncpy(msg, cd->dst_telno, dlen); - msg = capimsg_setu8(msg + dlen, 0); /* Connected subaddress */ - msg = capimsg_setu8(msg, 0); /* Low Layer Compatibility */ - msg = capimsg_setu8(msg, 0); /* Additional Info */ - - sc->send(sc, m); -} - -void capi_connect_b3_ind(capi_softc_t *sc, struct mbuf *m_in) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 7); - u_int8_t *msg = mtod(m_in, u_int8_t*); - u_int16_t applid, msgid; - u_int32_t NCCI; - int bch; - - if (!m) { - printf("capi%d: can't get mbuf for connect_b3_resp\n", sc->sc_unit); - return; - } - - msg = capimsg_getu16(msg + 2, &applid); - msg = capimsg_getu16(msg + 2, &msgid); - msg = capimsg_getu32(msg, &NCCI); - - for (bch = 0; bch < sc->sc_nbch; bch++) - if ((sc->sc_bchan[bch].state == B_CONNECT_B3_IND) && - (sc->sc_bchan[bch].ncci == (NCCI & CAPI_PLCI_MASK))) - break; - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, applid); - msg = capimsg_setu16(msg, CAPI_CONNECT_B3_RESP); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, NCCI); - - if (bch == sc->sc_nbch) { - printf("capi%d: can't get cd for connect_b3_resp NCCI %x\n", - sc->sc_unit, NCCI); - msg = capimsg_setu16(msg, 8); /* Reject, destination OOO */ - - } else { - sc->sc_bchan[bch].ncci = NCCI; - sc->sc_bchan[bch].state = B_CONNECT_B3_ACTIVE_IND; - msg = capimsg_setu16(msg, 0); /* Accept */ - } - - msg = capimsg_setu8(msg, 0); /* NCPI */ - - sc->send(sc, m); -} - -/* -// Data transfer: -// -------------- -*/ - -void capi_data_b3_req(capi_softc_t *sc, int chan, struct mbuf *m_b3) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 14); - u_int8_t *msg; - u_int16_t msgid; - - if (!m) { - printf("capi%d: can't get mbuf for data_b3_req\n", sc->sc_unit); - return; - } - - msgid = sc->sc_bchan[chan].msgid = sc->sc_msgid++; - sc->sc_bchan[chan].busy = 1; - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, I4BCAPI_APPLID); - msg = capimsg_setu16(msg, CAPI_DATA_B3_REQ); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, sc->sc_bchan[chan].ncci); - /* XXX: 32bit Pointer */ - msg = capimsg_setu32(msg, (u_int32_t)(intptr_t)m_b3->m_data); - msg = capimsg_setu16(msg, m_b3->m_len); - msg = capimsg_setu16(msg, chan); - msg = capimsg_setu16(msg, 0); /* Flags */ - - m->m_next = m_b3; - - sc->send(sc, m); -} - -void capi_data_b3_conf(capi_softc_t *sc, struct mbuf *m_in) -{ - u_int8_t *msg = mtod(m_in, u_int8_t*); - u_int32_t NCCI; - u_int16_t handle; - u_int16_t Info; - - msg = capimsg_getu32(msg + 8, &NCCI); - msg = capimsg_getu16(msg, &handle); - msg = capimsg_getu16(msg, &Info); - - if (Info == 0) { - sc->sc_bchan[handle].busy = 0; - capi_start_tx(sc, handle); - - } else { - printf("capi%d: data_b3_conf NCCI %x handle %x info=%04x\n", - sc->sc_unit, NCCI, handle, Info); - } -} - -void capi_data_b3_ind(capi_softc_t *sc, struct mbuf *m_in) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 6); - u_int8_t *msg = mtod(m_in, u_int8_t*); - u_int16_t applid, msgid; - u_int32_t NCCI; - u_int16_t handle; - int bch; - - if (!m) { - printf("capi%d: can't get mbuf for data_b3_resp\n", sc->sc_unit); - return; - } - - msg = capimsg_getu16(msg + 2, &applid); - msg = capimsg_getu16(msg + 2, &msgid); - msg = capimsg_getu32(msg, &NCCI); - msg = capimsg_getu16(msg + 6, &handle); - - for (bch = 0; bch < sc->sc_nbch; bch++) - if ((sc->sc_bchan[bch].state == B_CONNECTED) && - (sc->sc_bchan[bch].ncci == NCCI)) - break; - - if (bch == sc->sc_nbch) { - printf("capi%d: can't find channel for data_b3_ind NCCI %x\n", - sc->sc_unit, NCCI); - - } else { - if (sc->sc_bchan[bch].bprot == BPROT_RHDLC) { - /* HDLC drivers use rx_mbuf */ - - sc->sc_bchan[bch].in_mbuf = m_in->m_next; - sc->sc_bchan[bch].rxcount += m_in->m_next->m_len; - m_in->m_next = NULL; /* driver frees */ - - (*sc->sc_bchan[bch].l4_driver->bch_rx_data_ready)( - sc->sc_bchan[bch].l4_driver_softc); - - } else { - /* Telephony drivers use rx_queue */ - - if (!IF_QFULL(&sc->sc_bchan[bch].rx_queue)) { - sc->sc_bchan[bch].rxcount += m_in->m_next->m_len; - IF_ENQUEUE(&sc->sc_bchan[bch].rx_queue, m_in->m_next); - m_in->m_next = NULL; /* driver frees */ - } - - (*sc->sc_bchan[bch].l4_driver->bch_rx_data_ready)( - sc->sc_bchan[bch].l4_driver_softc); - } - } - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, I4BCAPI_APPLID); - msg = capimsg_setu16(msg, CAPI_DATA_B3_RESP); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, NCCI); - msg = capimsg_setu16(msg, handle); - - sc->send(sc, m); -} - -/* -// Connection teardown: -// -------------------- -*/ - -void capi_disconnect_req(capi_softc_t *sc, call_desc_t *cd) -{ - struct isdn_l3_driver *l3drv; - struct mbuf *m = i4b_Dgetmbuf(8 + 5); - u_int8_t *msg; - u_int16_t msgid; - u_int32_t PLCI; - - if (!m) { - printf("capi%d: can't get mbuf for disconnect_req\n", sc->sc_unit); - return; - } - - l3drv = isdn_find_l3_by_isdnif(sc->capi_isdnif); - - sc->sc_bchan[cd->channelid].state = B_DISCONNECT_CONF; - l3drv->bch_state[cd->channelid] = BCH_ST_RSVD; - msgid = sc->sc_bchan[cd->channelid].msgid = sc->sc_msgid++; - PLCI = (sc->sc_bchan[cd->channelid].ncci & CAPI_PLCI_MASK); - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, I4BCAPI_APPLID); - msg = capimsg_setu16(msg, CAPI_DISCONNECT_REQ); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, PLCI); - msg = capimsg_setu8(msg, 0); /* Additional Info */ - - sc->send(sc, m); -} - -void capi_disconnect_conf(capi_softc_t *sc, struct mbuf *m_in) -{ - struct isdn_l3_driver *l3drv; - u_int8_t *msg = mtod(m_in, u_int8_t*); - call_desc_t *cd; - u_int32_t PLCI; - int bch; - - msg = capimsg_getu32(msg + 8, &PLCI); - - for (bch = 0; bch < sc->sc_nbch; bch++) - if ((sc->sc_bchan[bch].state == B_DISCONNECT_CONF) && - ((sc->sc_bchan[bch].ncci & CAPI_PLCI_MASK) == PLCI)) - break; - - if (bch == sc->sc_nbch) { - printf("capi%d: can't find channel for disconnect_conf PLCI %x\n", - sc->sc_unit, PLCI); - return; - } - - cd = cd_by_cdid(sc->sc_bchan[bch].cdid); - if (!cd) { - printf("capi%d: can't find cd for disconnect_conf PLCI %x\n", - sc->sc_unit, PLCI); - } else { - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); - } - - l3drv = isdn_find_l3_by_isdnif(sc->capi_isdnif); - - sc->sc_bchan[bch].state = B_FREE; - l3drv->bch_state[bch] = BCH_ST_FREE; -} - -void capi_disconnect_b3_ind(capi_softc_t *sc, struct mbuf *m_in) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 4); - u_int8_t *msg = mtod(m_in, u_int8_t*); - u_int16_t applid, msgid; - u_int32_t NCCI; - - if (!m) { - printf("capi%d: can't get mbuf for disconnect_b3_resp\n", sc->sc_unit); - return; - } - - msg = capimsg_getu16(msg + 2, &applid); - msg = capimsg_getu16(msg + 2, &msgid); - msg = capimsg_getu32(msg, &NCCI); - - /* XXX update bchan state? XXX */ - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, applid); - msg = capimsg_setu16(msg, CAPI_DISCONNECT_B3_RESP); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, NCCI); - - sc->send(sc, m); -} - -void capi_disconnect_ind(capi_softc_t *sc, struct mbuf *m_in) -{ - struct isdn_l3_driver *l3drv; - struct mbuf *m = i4b_Dgetmbuf(8 + 4); - u_int8_t *msg = mtod(m_in, u_int8_t*); - call_desc_t *cd; - u_int16_t applid, msgid; - u_int32_t PLCI; - u_int16_t Reason; - int bch; - - if (!m) { - printf("capi%d: can't get mbuf for disconnect_resp\n", sc->sc_unit); - return; - } - - msg = capimsg_getu16(msg + 2, &applid); - msg = capimsg_getu16(msg + 2, &msgid); - msg = capimsg_getu32(msg, &PLCI); - msg = capimsg_getu16(msg, &Reason); - - for (bch = 0; bch < sc->sc_nbch; bch++) - if ((sc->sc_bchan[bch].state != B_FREE) && - ((sc->sc_bchan[bch].ncci & CAPI_PLCI_MASK) == PLCI)) - break; - - if (bch < sc->sc_nbch) { - /* We may not have a bchan assigned if call was ignored. */ - - cd = cd_by_cdid(sc->sc_bchan[bch].cdid); - sc->sc_bchan[bch].state = B_DISCONNECT_IND; - } else - cd = NULL; - - if (cd) { - if ((Reason & 0xff00) == 0x3400) { - SET_CAUSE_TV(cd->cause_in, CAUSET_Q850, (Reason & 0x7f)); - } else { - SET_CAUSE_TV(cd->cause_in, CAUSET_I4B, CAUSE_I4B_NORMAL); - } - - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); - - sc->sc_bchan[bch].state = B_FREE; - l3drv = isdn_find_l3_by_isdnif(sc->capi_isdnif); - l3drv->bch_state[bch] = BCH_ST_FREE; - } - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, applid); - msg = capimsg_setu16(msg, CAPI_DISCONNECT_RESP); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, PLCI); - - sc->send(sc, m); -} diff --git a/sys/netisdn/i4b_capi_msgs.h b/sys/netisdn/i4b_capi_msgs.h deleted file mode 100644 index 190cfa306ccd..000000000000 --- a/sys/netisdn/i4b_capi_msgs.h +++ /dev/null @@ -1,382 +0,0 @@ -/* $NetBSD: i4b_capi_msgs.h,v 1.4 2006/02/16 20:17:20 perry Exp $ */ - -/* - * Copyright (c) 2001-2003 Cubical Solutions Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * capi/capi_msgs.h The CAPI i4b message and handler declarations. - * - * $FreeBSD: src/sys/i4b/capi/capi_msgs.h,v 1.1 2001/05/25 08:39:31 hm Exp $ - */ - -#ifndef _NETISDN_I4B_CAPI_MSGS_H_ -#define _NETISDN_I4B_CAPI_MSGS_H_ - -/* CAPI commands */ - -#define CAPI_ALERT 0x01 -#define CAPI_CONNECT 0x02 -#define CAPI_CONNECT_ACTIVE 0x03 -#define CAPI_CONNECT_B3 0x82 -#define CAPI_CONNECT_B3_ACTIVE 0x83 -#define CAPI_CONNECT_B3_T90_ACTIVE 0x88 -#define CAPI_DATA_B3 0x86 -#define CAPI_DISCONNECT_B3 0x84 -#define CAPI_DISCONNECT 0x04 -#define CAPI_FACILITY 0x80 -#define CAPI_INFO 0x08 -#define CAPI_LISTEN 0x05 -#define CAPI_MANUFACTURER 0xff -#define CAPI_RESET_B3 0x87 -#define CAPI_SELECT_B_PROTOCOL 0x41 - -/* CAPI subcommands */ - -#define CAPI_REQ 0x80 -#define CAPI_CONF 0x81 -#define CAPI_IND 0x82 -#define CAPI_RESP 0x83 - -/* CAPI combined commands */ - -#define CAPICMD(cmd,subcmd) (((subcmd)<<8)|(cmd)) - -#define CAPI_DISCONNECT_REQ CAPICMD(CAPI_DISCONNECT,CAPI_REQ) -#define CAPI_DISCONNECT_CONF CAPICMD(CAPI_DISCONNECT,CAPI_CONF) -#define CAPI_DISCONNECT_IND CAPICMD(CAPI_DISCONNECT,CAPI_IND) -#define CAPI_DISCONNECT_RESP CAPICMD(CAPI_DISCONNECT,CAPI_RESP) - -#define CAPI_ALERT_REQ CAPICMD(CAPI_ALERT,CAPI_REQ) -#define CAPI_ALERT_CONF CAPICMD(CAPI_ALERT,CAPI_CONF) - -#define CAPI_CONNECT_REQ CAPICMD(CAPI_CONNECT,CAPI_REQ) -#define CAPI_CONNECT_CONF CAPICMD(CAPI_CONNECT,CAPI_CONF) -#define CAPI_CONNECT_IND CAPICMD(CAPI_CONNECT,CAPI_IND) -#define CAPI_CONNECT_RESP CAPICMD(CAPI_CONNECT,CAPI_RESP) - -#define CAPI_CONNECT_ACTIVE_REQ CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_REQ) -#define CAPI_CONNECT_ACTIVE_CONF CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_CONF) -#define CAPI_CONNECT_ACTIVE_IND CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_IND) -#define CAPI_CONNECT_ACTIVE_RESP CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_RESP) - -#define CAPI_SELECT_B_PROTOCOL_REQ CAPICMD(CAPI_SELECT_B_PROTOCOL,CAPI_REQ) -#define CAPI_SELECT_B_PROTOCOL_CONF CAPICMD(CAPI_SELECT_B_PROTOCOL,CAPI_CONF) - -#define CAPI_CONNECT_B3_REQ CAPICMD(CAPI_CONNECT_B3,CAPI_REQ) -#define CAPI_CONNECT_B3_CONF CAPICMD(CAPI_CONNECT_B3,CAPI_CONF) -#define CAPI_CONNECT_B3_IND CAPICMD(CAPI_CONNECT_B3,CAPI_IND) -#define CAPI_CONNECT_B3_RESP CAPICMD(CAPI_CONNECT_B3,CAPI_RESP) - -#define CAPI_CONNECT_B3_ACTIVE_REQ CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_REQ) -#define CAPI_CONNECT_B3_ACTIVE_CONF CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_CONF) -#define CAPI_CONNECT_B3_ACTIVE_IND CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_IND) -#define CAPI_CONNECT_B3_ACTIVE_RESP CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_RESP) - -#define CAPI_CONNECT_B3_T90_ACTIVE_IND CAPICMD(CAPI_CONNECT_B3_T90_ACTIVE,CAPI_IND) -#define CAPI_CONNECT_B3_T90_ACTIVE_RESP CAPICMD(CAPI_CONNECT_B3_T90_ACTIVE,CAPI_RESP) - -#define CAPI_DATA_B3_REQ CAPICMD(CAPI_DATA_B3,CAPI_REQ) -#define CAPI_DATA_B3_CONF CAPICMD(CAPI_DATA_B3,CAPI_CONF) -#define CAPI_DATA_B3_IND CAPICMD(CAPI_DATA_B3,CAPI_IND) -#define CAPI_DATA_B3_RESP CAPICMD(CAPI_DATA_B3,CAPI_RESP) - -#define CAPI_DISCONNECT_B3_REQ CAPICMD(CAPI_DISCONNECT_B3,CAPI_REQ) -#define CAPI_DISCONNECT_B3_CONF CAPICMD(CAPI_DISCONNECT_B3,CAPI_CONF) -#define CAPI_DISCONNECT_B3_IND CAPICMD(CAPI_DISCONNECT_B3,CAPI_IND) -#define CAPI_DISCONNECT_B3_RESP CAPICMD(CAPI_DISCONNECT_B3,CAPI_RESP) - -#define CAPI_RESET_B3_REQ CAPICMD(CAPI_RESET_B3,CAPI_REQ) -#define CAPI_RESET_B3_CONF CAPICMD(CAPI_RESET_B3,CAPI_CONF) -#define CAPI_RESET_B3_IND CAPICMD(CAPI_RESET_B3,CAPI_IND) -#define CAPI_RESET_B3_RESP CAPICMD(CAPI_RESET_B3,CAPI_RESP) - -#define CAPI_LISTEN_REQ CAPICMD(CAPI_LISTEN,CAPI_REQ) -#define CAPI_LISTEN_CONF CAPICMD(CAPI_LISTEN,CAPI_CONF) - -#define CAPI_MANUFACTURER_REQ CAPICMD(CAPI_MANUFACTURER,CAPI_REQ) -#define CAPI_MANUFACTURER_CONF CAPICMD(CAPI_MANUFACTURER,CAPI_CONF) -#define CAPI_MANUFACTURER_IND CAPICMD(CAPI_MANUFACTURER,CAPI_IND) -#define CAPI_MANUFACTURER_RESP CAPICMD(CAPI_MANUFACTURER,CAPI_RESP) - -#define CAPI_FACILITY_REQ CAPICMD(CAPI_FACILITY,CAPI_REQ) -#define CAPI_FACILITY_CONF CAPICMD(CAPI_FACILITY,CAPI_CONF) -#define CAPI_FACILITY_IND CAPICMD(CAPI_FACILITY,CAPI_IND) -#define CAPI_FACILITY_RESP CAPICMD(CAPI_FACILITY,CAPI_RESP) - -#define CAPI_INFO_REQ CAPICMD(CAPI_INFO,CAPI_REQ) -#define CAPI_INFO_CONF CAPICMD(CAPI_INFO,CAPI_CONF) -#define CAPI_INFO_IND CAPICMD(CAPI_INFO,CAPI_IND) -#define CAPI_INFO_RESP CAPICMD(CAPI_INFO,CAPI_RESP) - -/* CAPI message access helpers */ - -/* - * CAPI message header: - * word Length - * word ApplId - * byte Command - * byte Subcommand - * word MsgId - * - * Note that in the following, Controller/PLCI/NCCI is coded as follows: - * bits 0..6 = controller, bit 7 = ext/int, bits 8..15 = PLCI, and - * bits 16..31 = NCCI value. - * - * ALERT_REQ, 01 80: - * dword PLCI - * struct Additional Info - * - * ALERT_CONF, 01 81: - * dword PLCI - * word Info (0 = OK, other = cause) - * - * CONNECT_REQ, 02 80: - * dword controller - * word CIP - * struct Called party number - * struct Calling party number - * struct Called party subaddress - * struct Calling party subaddress - * struct Bearer Capability - * struct Low Layer Compatibility - * struct High Layer Compatibility - * struct Additional Info - * - * CONNECT_CONF, 02 81: - * dword PLCI - * word Info (0 = OK, other = cause) - * - * CONNECT_IND, 02 82: - * dword PLCI - * word CIP - * struct Called party number - * struct Calling party number - * struct Called party subaddress - * struct Calling party subaddress - * struct Bearer Capability - * struct Low Layer Compatibility - * struct High Layer Compatibility - * struct Additional Info - * struct Second Calling party number - * - * CONNECT_RESP, 02 83: - * dword PLCI - * word Reject (0 = accept, 1 = ignore, 2 = reject/normal clearing) - * struct B protocol - * struct Connected number - * struct Connected subaddress - * struct Low Layer Compatibility - * struct Additional Info - * - * CONNECT_ACTIVE_IND, 03 82: - * dword PLCI - * struct Connected number - * struct Connected subaddress - * struct Low Layer Compatibility - * - * CONNECT_ACTIVE_RESP, 03 83: - * dword PLCI - * - * CONNECT_B3_REQ, 82 80: - * dword PLCI - * struct NCPI - * - * CONNECT_B3_CONF, 82 81: - * dword NCCI - * word Info (0 = connected, other = cause) - * - * CONNECT_B3_IND, 82 82: - * dword NCCI - * struct NCPI - * - * CONNECT_B3_RESP, 82 83: - * dword NCCI - * word Reject (0 = accept, 2 = reject/normal clearing) - * struct NCPI - * - * CONNECT_B3_ACTIVE_IND, 83 82: - * dword NCCI - * struct NCPI - * - * CONNECT_B3_ACTIVE_RESP, 83 83: - * dword NCCI - * - * DATA_B3_REQ, 86 80: - * dword NCCI - * dword Data pointer - * word Data length - * word Data handle (packet id) - * word Flags (02 = more) - * - * DATA_B3_CONF, 86 81: - * dword NCCI - * word Data handle (packet id) - * word Info (0 = OK, other = cause) - * - * DATA_B3_IND, 86 82: - * dword NCCI - * dword Data pointer - * word Data length - * word Data handle (packet id) - * word Flags (02 = more) - * - * DATA_B3_RESP, 86 83: - * dword NCCI - * word Data handle (packet id) - * - * DISCONNECT_B3_REQ, 84 80: - * dword NCCI - * struct NCPI - * - * DISCONNECT_B3_CONF, 84 81: - * dword NCCI - * word Info (0 = OK, other = cause) - * - * DISCONNECT_B3_IND, 84 82: - * dword NCCI - * word Reason - * struct NCPI - * - * DISCONNECT_B3_RESP, 84 83: - * dword NCCI - * - * DISCONNECT_REQ, 04 80: - * dword PLCI - * struct Additional Info - * - * DISCONNECT_CONF, 04 81: - * dword PLCI - * word Info (0 = OK, other = cause) - * - * DISCONNECT_IND, 04 82: - * dword PLCI - * word Reason - * - * DISCONNECT_RESP, 04 83: - * dword PLCI - * - * LISTEN_REQ, 05 80: - * dword Controller - * dword Info mask (bits 0..9 used) - * dword CIP Mask (bit 0 = any match) - * dword CIP Mask 2 (bit 0 = any match) - * struct Calling party number - * struct Calling party subaddress - * - * LISTEN_CONF, 05 81: - * dword Controller - * word Info (0 = OK, other = cause) - * - * INFO_REQ, 08 80: - * dword Controller/PLCI - * struct Called party number - * struct Additional Info - * - * INFO_CONF, 08 81: - * dword Controller/PLCI - * word Info (0 = OK, other = cause) - * - * INFO_IND, 08 82: - * dword Controller/PLCI - * word Info number - * struct Info element - * - * INFO_RESP, 08 83: - * dword Controller/PLCI - */ - -#define CAPIMSG_LEN(msg) (msg[0]|(msg[1]<<8)) -#define CAPIMSG_DATALEN(msg) (msg[16]|(msg[17]<<8)) - -static __inline u_int8_t* capimsg_getu8(u_int8_t *msg, u_int8_t *val) -{ - *val = *msg; - return (msg + 1); -} - -static __inline u_int8_t* capimsg_getu16(u_int8_t *msg, u_int16_t *val) -{ - *val = (msg[0]|(msg[1]<<8)); - return (msg + 2); -} - -static __inline u_int8_t* capimsg_getu32(u_int8_t *msg, u_int32_t *val) -{ - *val = (msg[0]|(msg[1]<<8)|(msg[2]<<16)|(msg[3]<<24)); - return (msg + 4); -} - -static __inline u_int8_t* capimsg_setu8(u_int8_t *msg, u_int8_t val) -{ - msg[0] = val; - return (msg + 1); -} - -static __inline u_int8_t* capimsg_setu16(u_int8_t *msg, u_int16_t val) -{ - msg[0] = (val & 0xff); - msg[1] = (val >> 8) & 0xff; - return (msg + 2); -} - -static __inline u_int8_t* capimsg_setu32(u_int8_t *msg, u_int32_t val) -{ - msg[0] = (val & 0xff); - msg[1] = (val >> 8) & 0xff; - msg[2] = (val >> 16) & 0xff; - msg[3] = (val >> 24) & 0xff; - return (msg + 4); -} - -/* -// CAPI message handlers called by higher layers -*/ - -extern void capi_listen_req(capi_softc_t *sc, u_int32_t CIP); -extern void capi_alert_req(capi_softc_t *sc, call_desc_t *cd); -extern void capi_connect_req(capi_softc_t *sc, call_desc_t *cd); -extern void capi_connect_b3_req(capi_softc_t *sc, call_desc_t *cd); -extern void capi_connect_resp(capi_softc_t *sc, call_desc_t *cd); -extern void capi_data_b3_req(capi_softc_t *sc, int chan, struct mbuf *m); -extern void capi_disconnect_req(capi_softc_t *sc, call_desc_t *cd); - -/* -// CAPI message handlers called by the receive routine -*/ - -extern void capi_listen_conf(capi_softc_t *sc, struct mbuf *m); -extern void capi_info_ind(capi_softc_t *sc, struct mbuf *m); -extern void capi_alert_conf(capi_softc_t *sc, struct mbuf *m); -extern void capi_connect_conf(capi_softc_t *sc, struct mbuf *m); -extern void capi_connect_active_ind(capi_softc_t *sc, struct mbuf *m); -extern void capi_connect_b3_conf(capi_softc_t *sc, struct mbuf *m); -extern void capi_connect_b3_active_ind(capi_softc_t *sc, struct mbuf *m); -extern void capi_connect_ind(capi_softc_t *sc, struct mbuf *m); -extern void capi_connect_b3_ind(capi_softc_t *sc, struct mbuf *m); -extern void capi_data_b3_conf(capi_softc_t *sc, struct mbuf *m); -extern void capi_data_b3_ind(capi_softc_t *sc, struct mbuf *m); -extern void capi_disconnect_conf(capi_softc_t *sc, struct mbuf *m); -extern void capi_disconnect_b3_ind(capi_softc_t *sc, struct mbuf *m); -extern void capi_disconnect_ind(capi_softc_t *sc, struct mbuf *m); - -#endif /* !_NETISDN_I4B_CAPI_MSGS_H_ */ diff --git a/sys/netisdn/i4b_cause.h b/sys/netisdn/i4b_cause.h deleted file mode 100644 index 1bf74bc6d42e..000000000000 --- a/sys/netisdn/i4b_cause.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_cause.h - causes and cause handling for i4b - * ----------------------------------------------- - * - * $Id: i4b_cause.h,v 1.3 2005/12/10 23:51:50 elad Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Sun Feb 6 19:46:41 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _NETISDN_I4B_CAUSE_H_ -#define _NETISDN_I4B_CAUSE_H_ - -/*---------------------------------------------------------------------------* - * ISDN4BSD internal causes specification - *---------------------------------------------------------------------------*/ - -#define CAUSE_VAL 0x000000ff /* cause value */ -#define CAUSE_TYPE 0x0000ff00 /* cause type */ -#define CAUSET_Q850 0 /* value coded according to Q.850 */ -#define CAUSET_I4B 1 /* i4b protocol independent causes*/ - -#define GET_CAUSE_VAL(cause) ((cause) & 0xff) -#define SET_CAUSE_VAL(dest, val) ((dest) = ((dest & 0xffffff00) | \ - (val & 0x000000ff))) - -#define GET_CAUSE_TYPE(cause) (((cause) >> 8) & 0xff) -#define SET_CAUSE_TYPE(dest, type) ((dest) = ((dest & 0xffff00ff) | \ - ((type << 8) & 0x0000ff00))) - -#define SET_CAUSE_TV(dest, type, val) ((dest) = ((val & 0x000000ff) | \ - ((type << 8) & 0x0000ff00))) - -/* CAUSET_I4B - protocol independent cause values */ - -#define CAUSE_I4B_NORMAL 0 /* normal call clearing */ -#define CAUSE_I4B_BUSY 1 /* user busy */ -#define CAUSE_I4B_NOCHAN 2 /* circuit/channel not available*/ -#define CAUSE_I4B_INCOMP 3 /* incompatible source/dest */ -#define CAUSE_I4B_REJECT 4 /* call rejected */ -#define CAUSE_I4B_OOO 5 /* destination out of order */ -#define CAUSE_I4B_TMPFAIL 6 /* temporary failure */ -#define CAUSE_I4B_L1ERROR 7 /* L1 error / persistent deact */ -#define CAUSE_I4B_LLDIAL 8 /* no dialout on leased line */ -#define CAUSE_I4B_MAX 9 - /* NOTE: update isdnd/pcause.c when adding causes !!!!! */ - /* NOTE: update layer3/i4b_q931.c when adding causes !!!!! */ - -/* CAUSET_Q850 - causes defined in Q.850 */ - -#define CAUSE_Q850_SHUTDN 0x00 /* normal D-channel shutdown */ -#define CAUSE_Q850_NUNALLC 0x01 /* Unallocated (unassigned) number */ -#define CAUSE_Q850_NRTTN 0x02 /* No route to specified transit network */ -#define CAUSE_Q850_NRTDST 0x03 /* No route to destination */ -#define CAUSE_Q850_SSINFTN 0x04 /* Send special information tone */ -#define CAUSE_Q850_MDIALTP 0x05 /* Misdialled trunk prefix */ -#define CAUSE_Q850_CHUNACC 0x06 /* Channel unacceptable */ -#define CAUSE_Q850_CALLAWD 0x07 /* Call awarded and being delivered in an established channel */ -#define CAUSE_Q850_PREEMPT 0x08 /* Preemption */ -#define CAUSE_Q850_PREECRR 0x09 /* Preemption - circuit reserved for reuse */ -#define CAUSE_Q850_NCCLR 0x10 /* Normal call clearing */ -#define CAUSE_Q850_USRBSY 0x11 /* User busy */ -#define CAUSE_Q850_NOUSRRSP 0x12 /* No user responding */ -#define CAUSE_Q850_NOANSWR 0x13 /* No answer from user (user alerted) */ -#define CAUSE_Q850_SUBSABS 0x14 /* Subscriber absent */ -#define CAUSE_Q850_CALLREJ 0x15 /* Call rejected */ -#define CAUSE_Q850_NUCHNG 0x16 /* Number changed */ -#define CAUSE_Q850_NONSELUC 0x1A /* Non-selected user clearing */ -#define CAUSE_Q850_DSTOOORDR 0x1B /* Destination out of order */ -#define CAUSE_Q850_INVNUFMT 0x1C /* Invalid number format */ -#define CAUSE_Q850_FACREJ 0x1D /* Facility rejected */ -#define CAUSE_Q850_STENQRSP 0x1E /* Response to STATUS ENQUIRY */ -#define CAUSE_Q850_NORMUNSP 0x1F /* Normal, unspecified */ -#define CAUSE_Q850_NOCAVAIL 0x22 /* No circuit / channel available */ -#define CAUSE_Q850_NETOOORDR 0x26 /* Network out of order */ -#define CAUSE_Q850_PFMCDOOSERV 0x27 /* Permanent frame mode connection out of service */ -#define CAUSE_Q850_PFMCOPER 0x28 /* Permanent frame mode connection operational */ -#define CAUSE_Q850_TMPFAIL 0x29 /* Temporary failure */ -#define CAUSE_Q850_SWEQCONG 0x2A /* Switching equipment congestion */ -#define CAUSE_Q850_ACCINFDIS 0x2B /* Access information discarded */ -#define CAUSE_Q850_REQCNOTAV 0x2C /* Requested circuit/channel not available */ -#define CAUSE_Q850_PRECALBLK 0x2E /* Precedence call blocked */ -#define CAUSE_Q850_RESUNAVAIL 0x2F /* Resources unavailable, unspecified */ -#define CAUSE_Q850_QOSUNAVAIL 0x31 /* Quality of service unavailable */ -#define CAUSE_Q850_REQSERVNS 0x32 /* Requested facility not subscribed */ -#define CAUSE_Q850_OCBARRCUG 0x35 /* Outgoing calls barred within CUG */ -#define CAUSE_Q850_ICBARRCUG 0x36 /* Incoming calls barred within CUG */ -#define CAUSE_Q850_BCAPNAUTH 0x39 /* Bearer capability not authorized */ -#define CAUSE_Q850_BCAPNAVAIL 0x3A /* Bearer capability not presently available */ -#define CAUSE_Q850_INCSTOACISC 0x3E /* Inconsistenciy in designated outgoing access information and subscriber class */ -#define CAUSE_Q850_SOONOTAVAIL 0x3F /* Service or option not available, unspecified */ -#define CAUSE_Q850_BCAPNOTIMPL 0x41 /* Bearer capability not implemented */ -#define CAUSE_Q850_CHTYPNIMPL 0x42 /* Channel type not implemented */ -#define CAUSE_Q850_REQFACNIMPL 0x45 /* Requested facility not implemented */ -#define CAUSE_Q850_ORDINBCAVL 0x46 /* Only restricted digital information bearer capability is available */ -#define CAUSE_Q850_SOONOTIMPL 0x4F /* Service or option not implemented, unspecified */ -#define CAUSE_Q850_INVCLRFVAL 0x51 /* Invalid call reference value */ -#define CAUSE_Q850_IDCHDNOEX 0x52 /* Identified channel does not exist */ -#define CAUSE_Q850_SUSCAEXIN 0x53 /* A suspended call exists, but this call identity does not */ -#define CAUSE_Q850_CLIDINUSE 0x54 /* Call identity in use */ -#define CAUSE_Q850_NOCLSUSP 0x55 /* No call suspended */ -#define CAUSE_Q850_CLIDCLRD 0x56 /* Call having the requested call identity has been cleared */ -#define CAUSE_Q850_UNOTMEMCUG 0x57 /* User not member of CUG */ -#define CAUSE_Q850_INCDEST 0x58 /* Incompatible destination */ -#define CAUSE_Q850_NONEXCUG 0x5A /* Non-existent CUG */ -#define CAUSE_Q850_INVNTWSEL 0x5B /* Invalid transit network selection */ -#define CAUSE_Q850_INVMSG 0x5F /* Invalid message, unspecified */ -#define CAUSE_Q850_MIEMISS 0x60 /* Mandatory information element is missing */ -#define CAUSE_Q850_MSGTNI 0x61 /* Message type non-existent or not implemented */ -#define CAUSE_Q850_MSGNCMPT 0x62 /* Message not compatible with call state or message type non-existent or not implemented */ -#define CAUSE_Q850_IENENI 0x63 /* Information element/parameter non-existent or not implemented */ -#define CAUSE_Q850_INVIEC 0x64 /* Invalid information element contents */ -#define CAUSE_Q850_MSGNCWCS 0x65 /* Message not compatible with call state */ -#define CAUSE_Q850_RECOTIMEXP 0x66 /* Recovery on timer expiry */ -#define CAUSE_Q850_PARMNENIPO 0x67 /* Parameter non-existent or not implemented, passed on */ -#define CAUSE_Q850_MSGUNRDPRM 0x6E /* Message with unrecognized parameter, discarded */ -#define CAUSE_Q850_PROTERR 0x6F /* Protocol error, unspecified */ -#define CAUSE_Q850_INTWRKU 0x7F /* Interworking, unspecified */ - -#define CAUSE_Q850_MAX 128 - -#endif /* !_NETISDN_I4B_CAUSE_H_ */ diff --git a/sys/netisdn/i4b_ctl.c b/sys/netisdn/i4b_ctl.c deleted file mode 100644 index 0528c092890e..000000000000 --- a/sys/netisdn/i4b_ctl.c +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_ctl.c - i4b system control port driver - * ------------------------------------------ - * - * $Id: i4b_ctl.c,v 1.24 2014/07/25 08:10:40 dholland Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:46 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_ctl.c,v 1.24 2014/07/25 08:10:40 dholland Exp $"); - -#include "isdnctl.h" - -#if NISDNCTL > 0 - -#include - -#if defined(__FreeBSD__) && __FreeBSD__ >= 3 -#include -#include -#else -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __FreeBSD__ - -#if defined(__FreeBSD__) && __FreeBSD__ == 3 -#include "opt_devfs.h" -#endif - -#ifdef DEVFS -#include -#endif - -#endif /* __FreeBSD__ */ - -#ifdef __FreeBSD__ -#include -#include -#elif defined(__bsdi__) -#include -#include -#else -#include -#include -#include -#include -#endif - -#include -#include -#include - -#include -#include - -static int openflag = 0; - -#if BSD > 199306 && defined(__FreeBSD__) -static d_open_t i4bctlopen; -static d_close_t i4bctlclose; -static d_ioctl_t i4bctlioctl; - -#ifdef OS_USES_POLL -static d_poll_t i4bctlpoll; -#define POLLFIELD i4bctlpoll -#else -#define POLLFIELD noselect -#endif - -#define CDEV_MAJOR 55 - -#if defined(__FreeBSD__) && __FreeBSD__ >= 4 -static struct cdevsw i4bctl_cdevsw = { - /* open */ i4bctlopen, - /* close */ i4bctlclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ i4bctlioctl, - /* poll */ POLLFIELD, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "i4bctl", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, - /* bmaj */ -1 -}; -#else -static struct cdevsw i4bctl_cdevsw = - { i4bctlopen, i4bctlclose, noread, nowrite, - i4bctlioctl, nostop, nullreset, nodevtotty, - POLLFIELD, nommap, NULL, "i4bctl", NULL, -1 }; -#endif - -static void i4bctlattach(void *); -PSEUDO_SET(i4bctlattach, i4b_i4bctldrv); - -#define PDEVSTATIC static -#endif /* __FreeBSD__ */ - -#if defined(__FreeBSD__) && __FreeBSD__ == 3 -#ifdef DEVFS -static void *devfs_token; -#endif -#endif - -#ifndef __FreeBSD__ -#define PDEVSTATIC /* */ -void isdnctlattach(void); -int isdnctlopen(dev_t dev, int flag, int fmt, struct lwp *l); -int isdnctlclose(dev_t dev, int flag, int fmt, struct lwp *l); -int isdnctlioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l); -#endif /* !FreeBSD */ - -#ifdef __NetBSD__ -const struct cdevsw isdnctl_cdevsw = { - .d_open = isdnctlopen, - .d_close = isdnctlclose, - .d_read = noread, - .d_write = nowrite, - .d_ioctl = isdnctlioctl, - .d_stop = nostop, - .d_tty = notty, - .d_poll = nopoll, - .d_mmap = nommap, - .d_kqfilter = nokqfilter, - .d_discard = nodiscard, - .d_flag = D_OTHER -}; -#endif /* __NetBSD__ */ - -#if BSD > 199306 && defined(__FreeBSD__) -/*---------------------------------------------------------------------------* - * initialization at kernel load time - *---------------------------------------------------------------------------*/ -static void -i4bctlinit(void *unused) -{ -#if defined(__FreeBSD__) && __FreeBSD__ >= 4 - cdevsw_add(&i4bctl_cdevsw); -#else - dev_t dev = makedev(CDEV_MAJOR, 0); - cdevsw_add(&dev, &i4bctl_cdevsw, NULL); -#endif -} - -SYSINIT(i4bctldev, SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR, &i4bctlinit, NULL); - -#endif /* BSD > 199306 && defined(__FreeBSD__) */ - -#ifdef __bsdi__ -int i4bctlmatch(device_t parent, cfdata_t cf, void *aux); -void dummy_i4bctlattach(struct device*, struct device *, void *); - -#define CDEV_MAJOR 64 - -static struct cfdriver i4bctlcd = - { NULL, "i4bctl", i4bctlmatch, dummy_i4bctlattach, DV_DULL, - sizeof(struct cfdriver) }; -struct devsw i4bctlsw = - { &i4bctlcd, - i4bctlopen, i4bctlclose, noread, nowrite, - i4bctlioctl, seltrue, nommap, nostrat, - nodump, nopsize, 0, nostop -}; - -int -i4bctlmatch(device_t parent, cfdata_t cf, void *aux) -{ - printf("i4bctlmatch: aux=0x%x\n", aux); - return 1; -} -void -dummy_i4bctlattach(device_t parent, device_t self, void *aux) -{ - printf("dummy_i4bctlattach: aux=0x%x\n", aux); -} -#endif /* __bsdi__ */ -/*---------------------------------------------------------------------------* - * interface attach routine - *---------------------------------------------------------------------------*/ -PDEVSTATIC void -#ifdef __FreeBSD__ -isdnctlattach(void *dummy) -#else -isdnctlattach(void) -#endif -{ - -#if defined(__FreeBSD__) -#if __FreeBSD__ == 3 - -#ifdef DEVFS - devfs_token = devfs_add_devswf(&i4bctl_cdevsw, 0, DV_CHR, - UID_ROOT, GID_WHEEL, 0600, - "i4bctl"); -#endif - -#else - make_dev(&i4bctl_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "i4bctl"); -#endif -#endif -} - -/*---------------------------------------------------------------------------* - * i4bctlopen - device driver open routine - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdnctlopen(dev_t dev, int flag, int fmt, - struct lwp *l) -{ - if(minor(dev)) - return (ENXIO); - - if(openflag) - return (EBUSY); - - openflag = 1; - - return (0); -} - -/*---------------------------------------------------------------------------* - * i4bctlclose - device driver close routine - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdnctlclose(dev_t dev, int flag, int fmt, - struct lwp *l) -{ - openflag = 0; - return (0); -} - -/*---------------------------------------------------------------------------* - * i4bctlioctl - device driver ioctl routine - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdnctlioctl(dev_t dev, u_long cmd, void *data, int flag, - struct lwp *l) -{ -#if DO_I4B_DEBUG - ctl_debug_t *cdbg; - int error = 0; -#endif - -#if !DO_I4B_DEBUG - return(ENODEV); -#else - if(minor(dev)) - return(ENODEV); - - switch(cmd) - { - case I4B_CTL_GET_DEBUG: - cdbg = (ctl_debug_t *)data; - cdbg->l1 = i4b_l1_debug; - cdbg->l2 = i4b_l2_debug; - cdbg->l3 = i4b_l3_debug; - cdbg->l4 = i4b_l4_debug; - break; - - case I4B_CTL_SET_DEBUG: - cdbg = (ctl_debug_t *)data; - i4b_l1_debug = cdbg->l1; - i4b_l2_debug = cdbg->l2; - i4b_l3_debug = cdbg->l3; - i4b_l4_debug = cdbg->l4; - break; - - case I4B_CTL_GET_CHIPSTAT: - { - struct chipstat *cst; - l2_softc_t * scl2; - cst = (struct chipstat *)data; - scl2 = (l2_softc_t*)isdn_find_softc_by_isdnif(cst->driver_unit); - scl2->driver->mph_command_req(scl2->l1_token, CMR_GCST, cst); - break; - } - - case I4B_CTL_CLR_CHIPSTAT: - { - struct chipstat *cst; - l2_softc_t * scl2; - cst = (struct chipstat *)data; - scl2 = (l2_softc_t*)isdn_find_softc_by_isdnif(cst->driver_unit); - scl2->driver->mph_command_req(scl2->l1_token, CMR_CCST, cst); - break; - } - - case I4B_CTL_GET_LAPDSTAT: - { - l2stat_t *l2s; - l2_softc_t *sc; - l2s = (l2stat_t *)data; - - sc = (l2_softc_t*)isdn_find_softc_by_isdnif(l2s->unit); - if (sc == NULL) { - error = EINVAL; - break; - } - - memcpy(&l2s->lapdstat, &sc->stat, sizeof(lapdstat_t)); - break; - } - - case I4B_CTL_CLR_LAPDSTAT: - { - int *up; - l2_softc_t *sc; - up = (int *)data; - - sc = (l2_softc_t*)isdn_find_softc_by_isdnif(*up); - if (sc == NULL) { - error = EINVAL; - break; - } - - memset(&sc->stat, 0, sizeof(lapdstat_t)); - break; - } - - default: - error = ENOTTY; - break; - } - return(error); -#endif /* DO_I4B_DEBUG */ -} - -#if defined(__FreeBSD__) && defined(OS_USES_POLL) - -/*---------------------------------------------------------------------------* - * i4bctlpoll - device driver poll routine - *---------------------------------------------------------------------------*/ -static int -isdnctlpoll (dev_t dev, int events, struct lwp *l) -{ - return (ENODEV); -} - -#endif - -#endif /* NISDNCTL > 0 */ diff --git a/sys/netisdn/i4b_debug.h b/sys/netisdn/i4b_debug.h deleted file mode 100644 index 7c17399bc34b..000000000000 --- a/sys/netisdn/i4b_debug.h +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_debug.h - i4b debug header file - * ----------------------------------- - * - * $Id: i4b_debug.h,v 1.10 2015/09/06 06:01:01 dholland Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Wed May 31 09:51:34 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _NETISDN_I4B_DEBUG_H_ -#define _NETISDN_I4B_DEBUG_H_ - -#include - -#if !defined DO_I4B_DEBUG -# define DO_I4B_DEBUG 1 /* default = include debugging code */ -#elif DO_I4B_DEBUG != 0 -# undef DO_I4B_DEBUG -# define DO_I4B_DEBUG 1 -#endif - -#undef DO_I4B_MAXDEBUG /* default = disable ALL debug messages */ - -#if DO_I4B_DEBUG - -extern unsigned int i4b_l1_debug; -extern unsigned int i4b_l2_debug; -extern unsigned int i4b_l3_debug; -extern unsigned int i4b_l4_debug; - -#define NDBGL1(bits, fmt, args...) \ - if(bits & i4b_l1_debug) \ - { printf("%s (L1): %s: " fmt "\n", device_xname(sc->sc_dev), __func__ , ##args ); } - -#define NDBGL2(bits, fmt, args...) \ - if(bits & i4b_l2_debug) \ - { printf("i4b-L2 %s: " fmt "\n", __func__ , ##args ); } - -#define NDBGL3(bits, fmt, args...) \ - if(bits & i4b_l3_debug) \ - { printf("i4b-L3 %s: " fmt "\n", __func__ , ##args ); } - -#define NDBGL4(bits, fmt, args...) \ - if(bits & i4b_l4_debug) \ - { printf("i4b-L4 %s: " fmt "\n", __func__ , ##args ); } - -#else /* !DO_I4B_DEBUG */ - -#define NDBGL1(bits, fmt, args...); -#define NDBGL2(bits, fmt, args...); -#define NDBGL3(bits, fmt, args...); -#define NDBGL4(bits, fmt, args...); - -#endif /* DO_I4B_DEBUG */ - -/* Layer 1 */ - -#define L1_ERROR 0x0001 /* general error message*/ -#define L1_PRIM 0x0002 /* interlayer primitives*/ -#define L1_BCHAN 0x0004 /* B channel action */ -#define L1_H_ERR 0x0008 /* HSCX errors */ -#define L1_H_IRQ 0x0010 /* HSCX IRQ messages */ -#define L1_I_ERR 0x0020 /* ISAC errors */ -#define L1_I_MSG 0x0040 /* ISAC messages */ -#define L1_I_SETUP 0x0080 /* ISAC setup messages */ -#define L1_F_MSG 0x0100 /* FSM messages */ -#define L1_F_ERR 0x0200 /* FSM error messages */ -#define L1_T_MSG 0x0400 /* Timer messages */ -#define L1_T_ERR 0x0800 /* Timer error messages */ -#define L1_H_XFRERR 0x1000 /* HSCX data xfer error */ -#define L1_I_CICO 0x2000 /* ISAC command in/out */ -#define L1_S_MSG 0x4000 /* silent messages (soft-HDLC) */ -#define L1_S_ERR 0x8000 /* error messages (soft-HDLC) */ - -#define L1_DEBUG_MAX 0xffef /* all messages on except IRQ! */ -#define L1_DEBUG_ERR (L1_S_ERR | L1_H_ERR | L1_I_ERR | L1_F_ERR | L1_T_ERR | L1_ERROR) - -#ifndef L1_DEBUG_DEFAULT -#ifdef DO_I4B_MAXDEBUG -#define L1_DEBUG_DEFAULT L1_DEBUG_MAX -#else -#define L1_DEBUG_DEFAULT L1_DEBUG_ERR -#endif -#endif - -/* Layer 2 */ - -#define L2_ERROR 0x0001 /* general error message */ -#define L2_PRIM 0x0002 /* interlayer primitives */ -#define L2_U_MSG 0x0004 /* U frame messages */ -#define L2_U_ERR 0x0008 /* U frame error messages */ -#define L2_S_MSG 0x0010 /* S frame messages */ -#define L2_S_ERR 0x0020 /* S frame error messages */ -#define L2_I_MSG 0x0040 /* I frame messages */ -#define L2_I_ERR 0x0080 /* I frame error messages */ -#define L2_F_MSG 0x0100 /* FSM messages */ -#define L2_F_ERR 0x0200 /* FSM error messages */ -#define L2_T_MSG 0x0400 /* timer messages */ -#define L2_T_ERR 0x0800 /* timer error messages */ -#define L2_TEI_MSG 0x1000 /* TEI messages */ -#define L2_TEI_ERR 0x2000 /* TEI error messages */ - -#define L2_DEBUG_MAX 0x3fff /* all messages on */ -#define L2_DEBUG_ERR (L2_ERROR | L2_I_ERR | L2_F_ERR | L2_T_ERR | L2_S_ERR | L2_TEI_ERR | L2_U_ERR ) - -#ifndef L2_DEBUG_DEFAULT -#ifdef DO_I4B_MAXDEBUG -#define L2_DEBUG_DEFAULT L2_DEBUG_MAX -#else -#define L2_DEBUG_DEFAULT L2_DEBUG_ERR -#endif -#endif - -/* Layer 3 */ - -#define L3_ERR 0x0001 /* general error message */ -#define L3_MSG 0x0002 /* general message */ -#define L3_F_MSG 0x0004 /* FSM messages */ -#define L3_F_ERR 0x0008 /* FSM error messages */ -#define L3_T_MSG 0x0010 /* timer messages */ -#define L3_T_ERR 0x0020 /* timer error messages */ -#define L3_P_MSG 0x0040 /* protocol messages */ -#define L3_P_ERR 0x0080 /* protocol error messages */ -#define L3_A_MSG 0x0100 /* AOC messages */ -#define L3_A_ERR 0x0200 /* AOC error messages */ -#define L3_PRIM 0x0400 /* messages exchanged */ - -#define L3_DEBUG_MAX 0x07ff /* all messages on */ -#define L3_DEBUG_ERR (L3_ERR | L3_F_ERR | L3_T_ERR | L3_P_ERR | L3_A_ERR) - -#ifndef L3_DEBUG_DEFAULT -#ifdef DO_I4B_MAXDEBUG -#define L3_DEBUG_DEFAULT L3_DEBUG_MAX -#else -#define L3_DEBUG_DEFAULT L3_DEBUG_ERR -#endif -#endif - -/* Layer 4 */ - -#define L4_ERR 0x0001 /* general error message */ -#define L4_MSG 0x0002 /* general message */ -#define L4_TIMO 0x0004 /* b channel idle timeout msgs */ -#define L4_DIALST 0x0008 /* network driver dial states */ -#define L4_IPRDBG 0x0010 /* ipr driver debug messages */ -#define L4_RBCHDBG 0x0020 /* rbch driver debug messages */ -#define L4_ISPDBG 0x0040 /* isp driver debug messages */ -#define L4_TELDBG 0x0080 /* tel driver debug messages */ -#define L4_TINADBG 0x0100 /* tina driver debug messages */ -#define L4_TINAMSG 0x0200 /* tina driver messages */ -#define L4_TINAERR 0x0400 /* tina driver error messages */ -#define L4_INGDBG 0x0800 /* ing driver debug messages */ -#define L4_IAVCDBG 0x1000 /* iavc driver debug messages */ - -#define L4_DEBUG_MAX 0x0fff /* all messages on */ -#define L4_DEBUG_ERR (L4_ERR | L4_TINADBG | L4_TINAMSG | L4_TINAERR) - -#ifndef L4_DEBUG_DEFAULT -#ifdef DO_I4B_MAXDEBUG -#define L4_DEBUG_DEFAULT L4_DEBUG_MAX -#else -#define L4_DEBUG_DEFAULT L4_DEBUG_ERR -#endif -#endif - -/*---------------------------------------------------------------------------* - * ioctl via /dev/i4bctl: - * get/set current debug bits settings - *---------------------------------------------------------------------------*/ - -typedef struct { - unsigned int l1; - unsigned int l2; - unsigned int l3; - unsigned int l4; -} ctl_debug_t; - -#define I4B_CTL_GET_DEBUG _IOR('C', 0, ctl_debug_t) - -#define I4B_CTL_SET_DEBUG _IOW('C', 1, ctl_debug_t) - -/*---------------------------------------------------------------------------* - * generic get chipset statistics - *---------------------------------------------------------------------------*/ - -/* for the ihfc-driver: structure for HFC-1/S/SP statistics */ - -typedef struct { - int txframes; - int rxframes; - int xdu; - int rdo; - int crc; - int rab; -} hfcstat_t; - - -/* for the isic-driver: structure for HSCX statistics */ - -typedef struct { - int unit; /* controller number */ - int chan; /* channel number */ - int vfr; - int rdo; - int crc; - int rab; - int xdu; - int rfo; -} hscxstat_t; - -/* generic statistics structure */ - -struct chipstat { - int driver_type; /* type, L1DRVR_XXXX */ - int driver_unit; /* the unit number */ - int driver_bchannel; /* the B-channel */ - union stats { /* union for all drivers */ - hfcstat_t hfcstat; /* for ihfc driver, L1DRVR_IHFC */ - hscxstat_t hscxstat; /* for isic driver, L1DRVR_ISIC */ - } stats; -}; - -/* get statistics */ - -#define I4B_CTL_GET_CHIPSTAT _IOWR('C', 2, struct chipstat) - -/* clear statistics */ - -#define I4B_CTL_CLR_CHIPSTAT _IOW('C', 3, struct chipstat) - -/*---------------------------------------------------------------------------* - * get LAPD/Q.921 statistics - *---------------------------------------------------------------------------*/ -typedef struct { - - /* transmit */ - - u_long tx_i; /* I */ - u_long tx_rr; /* RR */ - u_long tx_rnr; /* RNR */ - u_long tx_rej; /* REJ */ - u_long tx_sabme; /* SABME*/ - u_long tx_dm; /* DM */ - u_long tx_disc; /* DISC */ - u_long tx_ua; /* UA */ - u_long tx_frmr; /* FRMR */ - u_long tx_tei; /* TEI */ - - /* receive */ - - u_long rx_i; /* I */ - u_long rx_rr; /* RR */ - u_long rx_rnr; /* RNR */ - u_long rx_rej; /* REJ */ - u_long rx_sabme; /* SABME*/ - u_long rx_tei; /* TEI */ - u_long rx_ui; /* UI */ - u_long rx_disc; /* DISC */ - u_long rx_xid; /* XID */ - u_long rx_dm; /* DM */ - u_long rx_ua; /* UA */ - u_long rx_frmr; /* FRMR */ - - /* errors */ - - u_long err_rx_len; /* incorrect length */ - u_long err_rx_badf; /* bad frame type */ - u_long err_rx_bads; /* bad s frame */ - u_long err_rx_badu; /* bad u frame */ - u_long err_rx_badui; /* bad ui frame */ -} lapdstat_t; - -typedef struct { - int unit; - lapdstat_t lapdstat; -} l2stat_t; - -#define I4B_CTL_GET_LAPDSTAT _IOWR('C', 4, l2stat_t) - -#define I4B_CTL_CLR_LAPDSTAT _IOW('C', 5, int) - -#endif /* !_NETISDN_I4B_DEUBG_H_ */ -/* EOF */ diff --git a/sys/netisdn/i4b_global.h b/sys/netisdn/i4b_global.h deleted file mode 100644 index fa29280d6cb3..000000000000 --- a/sys/netisdn/i4b_global.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_global.h - i4b global include file - * -------------------------------------- - * - * $Id: i4b_global.h,v 1.8 2007/10/14 23:44:49 martin Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Thu Aug 24 12:38:50 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _NETISDN_I4B_GLOBAL_H_ -#define _NETISDN_I4B_GLOBAL_H_ - -/*---------------------------------------------------------------------------* - * hiding OS differences in the kernel - *---------------------------------------------------------------------------*/ - -/*---------------*/ -/* time handling */ -/*---------------*/ - -#ifdef __FreeBSD__ -#include - -#if defined(__FreeBSD_version) && __FreeBSD_version >= 400000 && __FreeBSD_version < 400011 -#error "Unsupported FreeBSD-current version," -#error "you need a FreeBSD-current >= 400011" -#endif - -#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001 - -#define TIMEOUT_FUNC_T timeout_t * -#define SECOND time_second -#define MICROTIME(x) getmicrotime(&(x)) - -#else /* FreeBSD < 3 */ - -#define TIMEOUT_FUNC_T timeout_func_t -#define SECOND time.tv_sec -#define MICROTIME(x) microtime(&(x)) - -#endif /* >= 3 */ -#endif /* __FreeBSD__ */ - -#if defined(__NetBSD__) /* after timecounter merge */ - -#define TIMEOUT_FUNC_T void * -#define SECOND time_uptime -#define MICROTIME(x) getmicrotime(&(x)) - -#endif /* __NetBSD__ */ - -#if defined (__OpenBSD__) || defined(__bsdi__) - -#define TIMEOUT_FUNC_T void * -#define SECOND time.tv_sec -#define MICROTIME(x) microtime(&(x)) - -#endif /* __OpenBSD__ */ - -/*----------------*/ -/* timer handling */ -/*----------------*/ - -#if defined(__NetBSD__) - -#if __NetBSD_Version__ >= 104230000 -#define START_TIMER(XHANDLE, XF, XSC, XTIME) callout_reset(&XHANDLE, XTIME, (TIMEOUT_FUNC_T)XF, (void*)XSC) -#define STOP_TIMER(XHANDLE, XF, XSC) callout_stop(&XHANDLE) -#else -#define START_TIMER(XHANDLE, XF, XSC, XTIME) timeout((TIMEOUT_FUNC_T)XF, (void*)XSC, XTIME) -#define STOP_TIMER(XHANDLE, XF, XSC) untimeout((TIMEOUT_FUNC_T)XF, (void*)XSC) -#endif - -#else -#define START_TIMER(XHANDLE, XF, XSC, XTIME) XHANDLE = timeout((TIMEOUT_FUNC_T)XF, (void*)XSC, XTIME) -#ifdef __FreeBSD__ -#define STOP_TIMER(XHANDLE, XF, XSC) untimeout((TIMEOUT_FUNC_T)XF, (void*)XSC, XHANDLE) -#else -#define STOP_TIMER(XHANDLE, XF, XSC) untimeout((TIMEOUT_FUNC_T)XF, (void*)XSC) -#endif -#endif - -/*----------------------*/ -/* poll/select handling */ -/*----------------------*/ - -#if (defined(__FreeBSD__) && \ - (!defined(__FreeBSD_version) || (__FreeBSD_version < 300001))) \ - || defined (__OpenBSD__) || defined(__bsdi__) -#define OS_USES_SELECT -#else -#define OS_USES_POLL -#endif - -/*---------------------------------------------------------------------------* - * misc globally used things in the kernel - *---------------------------------------------------------------------------*/ - -/* timer states */ - -#define TIMER_IDLE 1 /* a timer is running */ -#define TIMER_ACTIVE 2 /* a timer is idle */ - -/* definitions for the STATUS indications L1 -> L2 -> L3 */ - -#define STI_ATTACH 0 /* attach at boot time */ -#define STI_L1STAT 1 /* layer 1 status */ -#define STI_L2STAT 2 /* layer 2 status */ -#define STI_TEIASG 3 /* TEI assignments */ -#define STI_PDEACT 4 /* Layer 1 T4 expired = persistent deactivation */ -#define STI_NOL1ACC 5 /* no outgoing L1 access possible */ - -/* definitions for the COMMAND requests L3 -> L2 -> L1 */ - -#define CMR_DOPEN 0 /* daemon opened /dev/i4b */ -#define CMR_DCLOSE 1 /* daemon closed /dev/i4b */ -#define CMR_SETTRACE 2 /* set D-channel and B-channel trace */ -#define CMR_GCST 3 /* get chipset statistics */ -#define CMR_CCST 4 /* clear chipset statistics */ -#define CMR_SETLEDS 5 /* set LEDs (if available) */ - -/* param for CMR_SETLEDS: */ -#define CMRLEDS_TEI 1 /* this controller has a TEI */ -#define CMRLEDS_B0 2 /* first B channel is in use */ -#define CMRLEDS_B0_IN 4 /* first B channel handles an incoming call */ -#define CMRLEDS_B1 8 /* second B channel is in use */ -#define CMRLEDS_B1_IN 16 /* second B channel handles an incoming call */ - -#endif /* !_NETISDN_I4B_GLOBAL_H_ */ diff --git a/sys/netisdn/i4b_i4bdrv.c b/sys/netisdn/i4b_i4bdrv.c deleted file mode 100644 index 0be935185b1a..000000000000 --- a/sys/netisdn/i4b_i4bdrv.c +++ /dev/null @@ -1,1137 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_i4bdrv.c - i4b userland interface driver - * -------------------------------------------- - * - * $Id: i4b_i4bdrv.c,v 1.40 2017/10/25 08:12:40 maya Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_i4bdrv.c,v 1.40 2017/10/25 08:12:40 maya Exp $"); - -#include "isdn.h" - -#if NISDN > 0 - -#include - -#if defined(__FreeBSD__) -#include -#include -#include -#else -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __FreeBSD__ - -#if defined(__FreeBSD__) && __FreeBSD__ == 3 -#include "opt_devfs.h" -#endif - -#ifdef DEVFS -#include -#endif - -#endif /* __FreeBSD__*/ - -#ifdef __FreeBSD__ -#include -#include -#include -#else -#include -#include -#include -#endif - -#include -#include -#include - -#include - -#ifdef OS_USES_POLL -#include -#endif - -struct selinfo select_rd_info; - -static struct ifqueue i4b_rdqueue; -static int openflag = 0; -static int selflag = 0; -static int readflag = 0; - -#if defined(__FreeBSD__) && __FreeBSD__ == 3 -#ifdef DEVFS -static void *devfs_token; -#endif -#endif - -#ifndef __FreeBSD__ - -#define PDEVSTATIC /* - not static - */ -PDEVSTATIC void isdnattach(void); -PDEVSTATIC int isdnopen(dev_t dev, int flag, int fmt, struct lwp *l); -PDEVSTATIC int isdnclose(dev_t dev, int flag, int fmt, struct lwp *l); -PDEVSTATIC int isdnread(dev_t dev, struct uio *uio, int ioflag); -PDEVSTATIC int isdnioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l); - -#ifdef OS_USES_POLL -PDEVSTATIC int isdnpoll(dev_t dev, int events, struct lwp *l); -PDEVSTATIC int isdnkqfilter(dev_t dev, struct knote *kn); -#else -PDEVSTATIC int isdnselect(dev_t dev, int rw, struct lwp *l); -#endif - -#endif /* #ifndef __FreeBSD__ */ - -#if BSD > 199306 && defined(__FreeBSD__) - -#define PDEVSTATIC static - -PDEVSTATIC d_open_t i4bopen; -PDEVSTATIC d_close_t i4bclose; -PDEVSTATIC d_read_t i4bread; -PDEVSTATIC d_ioctl_t i4bioctl; - -#ifdef OS_USES_POLL -PDEVSTATIC d_poll_t i4bpoll; -#define POLLFIELD i4bpoll -#else -PDEVSTATIC d_select_t i4bselect; -#define POLLFIELD i4bselect -#endif - -#define CDEV_MAJOR 60 - -#if defined(__FreeBSD__) && __FreeBSD__ >= 4 -static struct cdevsw i4b_cdevsw = { - /* open */ i4bopen, - /* close */ i4bclose, - /* read */ i4bread, - /* write */ nowrite, - /* ioctl */ i4bioctl, - /* poll */ POLLFIELD, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "i4b", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, - /* bmaj */ -1 -}; -#else -static struct cdevsw i4b_cdevsw = { - i4bopen, i4bclose, i4bread, nowrite, - i4bioctl, nostop, nullreset, nodevtotty, - POLLFIELD, nommap, NULL, "i4b", NULL, -1 -}; -#endif - -PDEVSTATIC void i4battach(void *); -PSEUDO_SET(i4battach, i4b_i4bdrv); - -static void -i4b_drvinit(void *unused) -{ -#if defined(__FreeBSD__) && __FreeBSD__ >= 4 - cdevsw_add(&i4b_cdevsw); -#else - static int i4b_devsw_installed = 0; - dev_t dev; - - if( ! i4b_devsw_installed ) - { - dev = makedev(CDEV_MAJOR,0); - cdevsw_add(&dev,&i4b_cdevsw,NULL); - i4b_devsw_installed = 1; - } -#endif -} - -SYSINIT(i4bdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,i4b_drvinit,NULL) - -#endif /* BSD > 199306 && defined(__FreeBSD__) */ - -#ifdef __NetBSD__ -const struct cdevsw isdn_cdevsw = { - .d_open = isdnopen, - .d_close = isdnclose, - .d_read = isdnread, - .d_write = nowrite, - .d_ioctl = isdnioctl, - .d_stop = nostop, - .d_tty = notty, - .d_poll = isdnpoll, - .d_mmap = nommap, - .d_kqfilter = isdnkqfilter, - .d_discard = nodiscard, - .d_flag = D_OTHER -}; -#endif /* __NetBSD__ */ - -#ifdef __bsdi__ -#include -int i4bmatch(device_t parent, cfdata_t cf, void *aux); -void dummy_i4battach(struct device*, struct device *, void *); - -#define CDEV_MAJOR 65 - -static struct cfdriver i4bcd = - { NULL, "i4b", i4bmatch, dummy_i4battach, DV_DULL, - sizeof(struct cfdriver) }; -struct devsw i4bsw = - { &i4bcd, - i4bopen, i4bclose, i4bread, nowrite, - i4bioctl, i4bselect, nommap, nostrat, - nodump, nopsize, 0, nostop -}; - -int -i4bmatch(device_t parent, cfdata_t cf, void *aux) -{ - printf("i4bmatch: aux=0x%x\n", aux); - return 1; -} -void -dummy_i4battach(device_t parent, device_t self, void *aux) -{ - printf("dummy_i4battach: aux=0x%x\n", aux); -} -#endif /* __bsdi__ */ - -/*---------------------------------------------------------------------------* - * interface attach routine - *---------------------------------------------------------------------------*/ -PDEVSTATIC void -#ifdef __FreeBSD__ -isdnattach(void *dummy) -#else -isdnattach(void) -#endif -{ - i4b_rdqueue.ifq_maxlen = IFQ_MAXLEN; - selinit(&select_rd_info); - -#if defined(__FreeBSD__) -#if __FreeBSD__ == 3 - -#ifdef DEVFS - devfs_token = devfs_add_devswf(&i4b_cdevsw, 0, DV_CHR, - UID_ROOT, GID_WHEEL, 0600, - "i4b"); -#endif - -#else - make_dev(&i4b_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "i4b"); -#endif -#endif -} - -/*---------------------------------------------------------------------------* - * i4bopen - device driver open routine - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdnopen(dev_t dev, int flag, int fmt, struct lwp *l) -{ - int x; - - if(minor(dev)) - return(ENXIO); - - if(openflag) - return(EBUSY); - - x = splnet(); - openflag = 1; - i4b_l4_daemon_attached(); - splx(x); - - return(0); -} - -/*---------------------------------------------------------------------------* - * i4bclose - device driver close routine - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdnclose(dev_t dev, int flag, int fmt, - struct lwp *l) -{ - int x = splnet(); - openflag = 0; - i4b_l4_daemon_detached(); - i4b_Dcleanifq(&i4b_rdqueue); - splx(x); - return(0); -} - -/*---------------------------------------------------------------------------* - * i4bread - device driver read routine - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdnread(dev_t dev, struct uio *uio, int ioflag) -{ - struct mbuf *m; - int x; - int error = 0; - - if(minor(dev)) - return(ENODEV); - - x = splnet(); - while(IF_QEMPTY(&i4b_rdqueue)) - { - readflag = 1; - error = tsleep((void *) &i4b_rdqueue, (PZERO + 1) | PCATCH, "bird", 0); - if (error != 0) { - splx(x); - return error; - } - } - - IF_DEQUEUE(&i4b_rdqueue, m); - - splx(x); - - if(m && m->m_len) - error = uiomove(m->m_data, m->m_len, uio); - else - error = EIO; - - if(m) - i4b_Dfreembuf(m); - - return(error); -} - -/*---------------------------------------------------------------------------* - * i4bioctl - device driver ioctl routine - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdnioctl(dev_t dev, u_long cmd, void *data, int flag, - struct lwp *l) -{ - struct isdn_l3_driver *d; - call_desc_t *cd; - int error = 0; - - if(minor(dev)) - return(ENODEV); - - switch(cmd) - { - /* cdid request, reserve cd and return cdid */ - - case I4B_CDID_REQ: - { - msg_cdid_req_t *mir; - mir = (msg_cdid_req_t *)data; - cd = reserve_cd(); - mir->cdid = cd->cdid; - break; - } - - /* connect request, dial out to remote */ - - case I4B_CONNECT_REQ: - { - msg_connect_req_t *mcr; - mcr = (msg_connect_req_t *)data; /* setup ptr */ - - if((cd = cd_by_cdid(mcr->cdid)) == NULL)/* get cd */ - { - NDBGL4(L4_ERR, "I4B_CONNECT_REQ ioctl, cdid not found!"); - error = EINVAL; - break; - } - cd->isdnif = -1; - cd->l3drv = NULL; - - d = isdn_find_l3_by_isdnif(mcr->controller); - if (d == NULL) { - error = EINVAL; - break; - } - - /* prevent dialling on leased lines */ - if(d->protocol == PROTOCOL_D64S) - { - SET_CAUSE_TYPE(cd->cause_in, CAUSET_I4B); - SET_CAUSE_VAL(cd->cause_in, CAUSE_I4B_LLDIAL); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); - break; - } - - cd->isdnif = mcr->controller; /* fill cd */ - cd->l3drv = d; - cd->bprot = mcr->bprot; - cd->bchan_driver_index = mcr->driver; - cd->bchan_driver_unit = mcr->driver_unit; - cd->cr = get_rand_cr(cd->isdnif); - - cd->shorthold_data.shorthold_algorithm = mcr->shorthold_data.shorthold_algorithm; - cd->shorthold_data.unitlen_time = mcr->shorthold_data.unitlen_time; - cd->shorthold_data.idle_time = mcr->shorthold_data.idle_time; - cd->shorthold_data.earlyhup_time = mcr->shorthold_data.earlyhup_time; - - cd->last_aocd_time = 0; - if(mcr->unitlen_method == ULEN_METHOD_DYNAMIC) - cd->aocd_flag = 1; - else - cd->aocd_flag = 0; - - cd->cunits = 0; - - cd->max_idle_time = 0; /* this is outgoing */ - - cd->dir = DIR_OUTGOING; - - NDBGL4(L4_TIMO, "I4B_CONNECT_REQ times, algorithm=%ld unitlen=%ld idle=%ld earlyhup=%ld", - (long)cd->shorthold_data.shorthold_algorithm, (long)cd->shorthold_data.unitlen_time, - (long)cd->shorthold_data.idle_time, (long)cd->shorthold_data.earlyhup_time); - - strlcpy(cd->dst_telno, mcr->dst_telno, - sizeof(cd->dst_telno)); - strlcpy(cd->src_telno, mcr->src_telno, - sizeof(cd->src_telno)); - cd->display[0] = '\0'; - - SET_CAUSE_TYPE(cd->cause_in, CAUSET_I4B); - SET_CAUSE_VAL(cd->cause_in, CAUSE_I4B_NORMAL); - - /* - * If we want a specific channel, check if that - * one is available. - */ - if ((mcr->channel >= 0) && (mcr->channel < d->nbch)) { - if(d->bch_state[mcr->channel] != BCH_ST_FREE) - SET_CAUSE_VAL(cd->cause_in, - CAUSE_I4B_NOCHAN); - - /* - * If any channel will do, see if any are free. - */ - } else if (mcr->channel == CHAN_ANY) { - int i; - - for (i = 0; i < d->nbch; i++) - if (d->bch_state[i] == BCH_ST_FREE) - break; - - if (i == d->nbch) - SET_CAUSE_VAL(cd->cause_in, - CAUSE_I4B_NOCHAN); - - } else { - SET_CAUSE_VAL(cd->cause_in, CAUSE_I4B_NOCHAN); - } - - cd->channelid = mcr->channel; - - cd->isdntxdelay = mcr->txdelay; - - if((GET_CAUSE_VAL(cd->cause_in)) != CAUSE_I4B_NORMAL) - { - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); - } - else - { - d->l3driver->N_CONNECT_REQUEST(cd); - } - break; - } - - /* connect response, accept/reject/ignore incoming call */ - - case I4B_CONNECT_RESP: - { - msg_connect_resp_t *mcrsp; - - mcrsp = (msg_connect_resp_t *)data; - - if((cd = cd_by_cdid(mcrsp->cdid)) == NULL)/* get cd */ - { - NDBGL4(L4_ERR, "I4B_CONNECT_RESP ioctl, cdid not found!"); - error = EINVAL; - break; - } - - T400_stop(cd); - - cd->bchan_driver_index = mcrsp->driver; - cd->bchan_driver_unit = mcrsp->driver_unit; - cd->max_idle_time = mcrsp->max_idle_time; - - cd->shorthold_data.shorthold_algorithm = SHA_FIXU; - cd->shorthold_data.unitlen_time = 0; /* this is incoming */ - cd->shorthold_data.idle_time = 0; - cd->shorthold_data.earlyhup_time = 0; - - cd->isdntxdelay = mcrsp->txdelay; - - NDBGL4(L4_TIMO, "I4B_CONNECT_RESP max_idle_time set to %ld seconds", (long)cd->max_idle_time); - - d = isdn_find_l3_by_isdnif(cd->isdnif); - if (d == NULL) { - error = EINVAL; - break; - } - d->l3driver->N_CONNECT_RESPONSE(cd, mcrsp->response, mcrsp->cause); - break; - } - - /* disconnect request, actively terminate connection */ - - case I4B_DISCONNECT_REQ: - { - msg_discon_req_t *mdr; - - mdr = (msg_discon_req_t *)data; - - if((cd = cd_by_cdid(mdr->cdid)) == NULL)/* get cd */ - { - NDBGL4(L4_ERR, "I4B_DISCONNECT_REQ ioctl, cdid %d not found!", mdr->cdid); - error = EINVAL; - break; - } - - /* preset causes with our cause */ - cd->cause_in = cd->cause_out = mdr->cause; - - d = isdn_find_l3_by_isdnif(cd->isdnif); - if (d == NULL) { - error = EINVAL; - break; - } - - d->l3driver->N_DISCONNECT_REQUEST(cd, mdr->cause); - break; - } - - /* controller info request */ - - case I4B_CTRL_INFO_REQ: - { - msg_ctrl_info_req_t *mcir; - int isdnif; - - mcir = (msg_ctrl_info_req_t *)data; - isdnif = mcir->controller; - memset(mcir, 0, sizeof(msg_ctrl_info_req_t)); - mcir->controller = isdnif; - mcir->ncontroller - = isdn_count_isdnif(&mcir->max_isdnif); - d = isdn_find_l3_by_isdnif(isdnif); - if (d != NULL) { - mcir->tei = d->tei; - mcir->nbch = d->nbch; - strncpy(mcir->devname, d->devname, sizeof(mcir->devname)-1); - strncpy(mcir->cardname, d->card_name, sizeof(mcir->cardname)-1); - } else { - error = ENODEV; - } - break; - } - - /* dial response */ - - case I4B_DIALOUT_RESP: - { - const struct isdn_l4_driver_functions *drv; - msg_dialout_resp_t *mdrsp; - void *l4_softc; - - mdrsp = (msg_dialout_resp_t *)data; - drv = isdn_l4_get_driver(mdrsp->driver, mdrsp->driver_unit); - - if(drv != NULL) { - l4_softc = (*drv->get_softc)(mdrsp->driver_unit); - (*drv->dial_response)(l4_softc, mdrsp->stat, mdrsp->cause); - } - break; - } - - /* update timeout value */ - - case I4B_TIMEOUT_UPD: - { - msg_timeout_upd_t *mtu; - int x; - - mtu = (msg_timeout_upd_t *)data; - - NDBGL4(L4_TIMO, "I4B_TIMEOUT_UPD ioctl, alg %d, unit %d, idle %d, early %d!", - mtu->shorthold_data.shorthold_algorithm, mtu->shorthold_data.unitlen_time, - mtu->shorthold_data.idle_time, mtu->shorthold_data.earlyhup_time); - - if((cd = cd_by_cdid(mtu->cdid)) == NULL)/* get cd */ - { - NDBGL4(L4_ERR, "I4B_TIMEOUT_UPD ioctl, cdid not found!"); - error = EINVAL; - break; - } - - switch( mtu->shorthold_data.shorthold_algorithm ) - { - case SHA_FIXU: - /* - * For this algorithm unitlen_time, - * idle_time and earlyhup_time are used. - */ - - if(!(mtu->shorthold_data.unitlen_time >= 0 && - mtu->shorthold_data.idle_time >= 0 && - mtu->shorthold_data.earlyhup_time >= 0)) - { - NDBGL4(L4_ERR, "I4B_TIMEOUT_UPD ioctl, invalid args for fix unit algorithm!"); - error = EINVAL; - } - break; - - case SHA_VARU: - /* - * For this algorithm unitlen_time and - * idle_time are used. both must be - * positive integers. earlyhup_time is - * not used and must be 0. - */ - - if(!(mtu->shorthold_data.unitlen_time > 0 && - mtu->shorthold_data.idle_time >= 0 && - mtu->shorthold_data.earlyhup_time == 0)) - { - NDBGL4(L4_ERR, "I4B_TIMEOUT_UPD ioctl, invalid args for var unit algorithm!"); - error = EINVAL; - } - break; - - default: - NDBGL4(L4_ERR, "I4B_TIMEOUT_UPD ioctl, invalid algorithm!"); - error = EINVAL; - break; - } - - /* - * any error set above requires us to break - * out of the outer switch - */ - if(error != 0) - break; - - x = splnet(); - cd->shorthold_data.shorthold_algorithm = mtu->shorthold_data.shorthold_algorithm; - cd->shorthold_data.unitlen_time = mtu->shorthold_data.unitlen_time; - cd->shorthold_data.idle_time = mtu->shorthold_data.idle_time; - cd->shorthold_data.earlyhup_time = mtu->shorthold_data.earlyhup_time; - splx(x); - break; - } - - /* soft enable/disable interface */ - - case I4B_UPDOWN_IND: - { - msg_updown_ind_t *mui; - const struct isdn_l4_driver_functions *drv; - void *l4_softc; - - mui = (msg_updown_ind_t *)data; - drv = isdn_l4_get_driver(mui->driver, mui->driver_unit); - - if (drv) - { - l4_softc = drv->get_softc(mui->driver_unit); - (*drv->updown_ind)(l4_softc, mui->updown); - } - break; - } - - /* send ALERT request */ - - case I4B_ALERT_REQ: - { - msg_alert_req_t *mar; - - mar = (msg_alert_req_t *)data; - - if((cd = cd_by_cdid(mar->cdid)) == NULL) - { - NDBGL4(L4_ERR, "I4B_ALERT_REQ ioctl, cdid not found!"); - error = EINVAL; - break; - } - - T400_stop(cd); - - d = cd->l3drv; - if (d == NULL) { - error = EINVAL; - break; - } - d->l3driver->N_ALERT_REQUEST(cd); - - break; - } - - /* version/release number request */ - - case I4B_VR_REQ: - { - msg_vr_req_t *mvr; - - mvr = (msg_vr_req_t *)data; - - mvr->version = VERSION; - mvr->release = REL; - mvr->step = STEP; - break; - } - - /* set D-channel protocol for a controller */ - - case I4B_PROT_IND: - { - msg_prot_ind_t *mpi; - - mpi = (msg_prot_ind_t *)data; - - d = isdn_find_l3_by_isdnif(mpi->controller); - if (d == NULL) { - error = EINVAL; - break; - } - d->protocol = mpi->protocol; - - break; - } - - case I4B_L4DRIVER_LOOKUP: - { - msg_l4driver_lookup_t *lookup = (msg_l4driver_lookup_t*)data; - lookup->name[L4DRIVER_NAME_SIZ-1] = 0; - lookup->driver_id = isdn_l4_find_driverid(lookup->name); - if (lookup->driver_id < 0) - error = ENXIO; - break; - } - - /* Download request */ - case I4B_CTRL_DOWNLOAD: - { - struct isdn_dr_prot *prots = NULL, *prots2 = NULL; - struct isdn_download_request *r = - (struct isdn_download_request*)data; - int i; - - d = isdn_find_l3_by_isdnif(r->controller); - if (d == NULL) - { - error = ENODEV; - goto download_done; - } - - if(d->l3driver->N_DOWNLOAD == NULL) - { - error = ENODEV; - goto download_done; - } - - prots = malloc(r->numprotos * sizeof(struct isdn_dr_prot), - M_DEVBUF, M_WAITOK); - - prots2 = malloc(r->numprotos * sizeof(struct isdn_dr_prot), - M_DEVBUF, M_WAITOK); - - if(!prots || !prots2) - { - error = ENOMEM; - goto download_done; - } - - copyin(r->protocols, prots, r->numprotos * sizeof(struct isdn_dr_prot)); - - for(i = 0; i < r->numprotos; i++) - { - prots2[i].microcode = malloc(prots[i].bytecount, M_DEVBUF, M_WAITOK); - copyin(prots[i].microcode, prots2[i].microcode, prots[i].bytecount); - prots2[i].bytecount = prots[i].bytecount; - } - - error = d->l3driver->N_DOWNLOAD( - d->l1_token, - r->numprotos, prots2); - -download_done: - if(prots2) - { - for(i = 0; i < r->numprotos; i++) - { - if(prots2[i].microcode) - { - free(prots2[i].microcode, M_DEVBUF); - } - } - free(prots2, M_DEVBUF); - } - - if(prots) - { - free(prots, M_DEVBUF); - } - break; - } - - /* Diagnostic request */ - - case I4B_ACTIVE_DIAGNOSTIC: - { - struct isdn_diagnostic_request req, *r = - (struct isdn_diagnostic_request*)data; - - req.in_param = req.out_param = NULL; - d = isdn_find_l3_by_isdnif(r->controller); - if (d == NULL) - { - error = ENODEV; - goto diag_done; - } - - if (d->l3driver->N_DIAGNOSTICS == NULL) - { - error = ENODEV; - goto diag_done; - } - - memcpy(&req, r, sizeof(req)); - - if(req.in_param_len) - { - /* XXX arbitrary limit */ - if (req.in_param_len > I4B_ACTIVE_DIAGNOSTIC_MAXPARAMLEN) { - error = EINVAL; - goto diag_done; - } - - req.in_param = malloc(r->in_param_len, M_DEVBUF, M_WAITOK); - - if(!req.in_param) - { - error = ENOMEM; - goto diag_done; - } - error = copyin(r->in_param, req.in_param, req.in_param_len); - if (error) - goto diag_done; - } - - if(req.out_param_len) - { - req.out_param = malloc(r->out_param_len, M_DEVBUF, M_WAITOK); - - if(!req.out_param) - { - error = ENOMEM; - goto diag_done; - } - } - - error = d->l3driver->N_DIAGNOSTICS(d->l1_token, &req); - - if(!error && req.out_param_len) - error = copyout(req.out_param, r->out_param, req.out_param_len); - -diag_done: - if(req.in_param) - free(req.in_param, M_DEVBUF); - - if(req.out_param) - free(req.out_param, M_DEVBUF); - - break; - } - - /* default */ - - default: - error = ENOTTY; - break; - } - - return(error); -} - -#ifdef OS_USES_SELECT - -/*---------------------------------------------------------------------------* - * i4bselect - device driver select routine - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -i4bselect(dev_t dev, int rw, struct lwp *l) -{ - int x; - - if(minor(dev)) - return(ENODEV); - - switch(rw) - { - case FREAD: - if(!IF_QEMPTY(&i4b_rdqueue)) - return(1); - x = splnet(); - selrecord(l, &select_rd_info); - selflag = 1; - splx(x); - return(0); - break; - - case FWRITE: - return(1); - break; - } - return(0); -} - -#else /* OS_USES_SELECT */ - -/*---------------------------------------------------------------------------* - * i4bpoll - device driver poll routine - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdnpoll(dev_t dev, int events, struct lwp *l) -{ - int x; - - if(minor(dev)) - return(ENODEV); - - if((events & POLLIN) || (events & POLLRDNORM)) - { - if(!IF_QEMPTY(&i4b_rdqueue)) - return(1); - - x = splnet(); - selrecord(l, &select_rd_info); - selflag = 1; - splx(x); - return(0); - } - else if((events & POLLOUT) || (events & POLLWRNORM)) - { - return(1); - } - - return(0); -} - -static void -filt_i4brdetach(struct knote *kn) -{ - int s; - - s = splnet(); - SLIST_REMOVE(&select_rd_info.sel_klist, kn, knote, kn_selnext); - splx(s); -} - -static int -filt_i4bread(struct knote *kn, long hint) -{ - struct mbuf *m; - - if (IF_QEMPTY(&i4b_rdqueue)) - return (0); - - IF_POLL(&i4b_rdqueue, m); - - kn->kn_data = m->m_len; - return (1); -} - -static const struct filterops i4bread_filtops = { - .f_isfd = 1, - .f_attach = NULL, - .f_detach = filt_i4brdetach, - .f_event = filt_i4bread, -}; - -static const struct filterops i4b_seltrue_filtops = { - .f_isfd = 1, - .f_attach = NULL, - .f_detach = filt_i4brdetach, - .f_event = filt_seltrue, -}; - -int -isdnkqfilter(dev_t dev, struct knote *kn) -{ - struct klist *klist; - int s; - - switch (kn->kn_filter) { - case EVFILT_READ: - klist = &select_rd_info.sel_klist; - kn->kn_fop = &i4bread_filtops; - break; - - case EVFILT_WRITE: - klist = &select_rd_info.sel_klist; - kn->kn_fop = &i4b_seltrue_filtops; - break; - - default: - return (EINVAL); - } - - kn->kn_hook = NULL; - - s = splnet(); - SLIST_INSERT_HEAD(klist, kn, kn_selnext); - splx(s); - - return (0); -} - -#endif /* OS_USES_SELECT */ - -/*---------------------------------------------------------------------------* - * i4bputqueue - put message into queue to userland - *---------------------------------------------------------------------------*/ -void -i4bputqueue(struct mbuf *m) -{ - int x; - - if(!openflag) - { - i4b_Dfreembuf(m); - return; - } - - x = splnet(); - - if(IF_QFULL(&i4b_rdqueue)) - { - struct mbuf *m1; - IF_DEQUEUE(&i4b_rdqueue, m1); - i4b_Dfreembuf(m1); - NDBGL4(L4_ERR, "ERROR, queue full, removing entry!"); - } - - IF_ENQUEUE(&i4b_rdqueue, m); - - splx(x); - - if(readflag) - { - readflag = 0; - wakeup((void *) &i4b_rdqueue); - } - - if(selflag) - { - selflag = 0; - selnotify(&select_rd_info, 0, 0); - } -} - -/*---------------------------------------------------------------------------* - * i4bputqueue_hipri - put message into front of queue to userland - *---------------------------------------------------------------------------*/ -void -i4bputqueue_hipri(struct mbuf *m) -{ - int x; - - if(!openflag) - { - i4b_Dfreembuf(m); - return; - } - - x = splnet(); - - if(IF_QFULL(&i4b_rdqueue)) - { - struct mbuf *m1; - IF_DEQUEUE(&i4b_rdqueue, m1); - i4b_Dfreembuf(m1); - NDBGL4(L4_ERR, "ERROR, queue full, removing entry!"); - } - - IF_PREPEND(&i4b_rdqueue, m); - - splx(x); - - if(readflag) - { - readflag = 0; - wakeup((void *) &i4b_rdqueue); - } - - if(selflag) - { - selflag = 0; - selnotify(&select_rd_info, 0, 0); - } -} - -void -isdn_isdnif_ready(int isdnif) -{ - struct isdn_l3_driver *d = isdn_find_l3_by_isdnif(isdnif); - - if (d == NULL) - return; - - printf("ISDN %d at %s, %d B channels\n", isdnif, d->devname, d->nbch); - if (!openflag) return; - - d->l3driver->N_MGMT_COMMAND(d, CMR_DOPEN, 0); - i4b_l4_contr_ev_ind(isdnif, 1); -} - -#endif /* NISDN > 0 */ diff --git a/sys/netisdn/i4b_iframe.c b/sys/netisdn/i4b_iframe.c deleted file mode 100644 index a15e1e2c910a..000000000000 --- a/sys/netisdn/i4b_iframe.c +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_iframe.c - i frame handling routines - * ------------------------------------------ - * - * $Id: i4b_iframe.c,v 1.8 2005/12/11 12:25:06 christos Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_iframe.c,v 1.8 2005/12/11 12:25:06 christos Exp $"); - -#ifdef __FreeBSD__ -#include "i4bq921.h" -#else -#define NI4BQ921 1 -#endif -#if NI4BQ921 > 0 - -#include -#include -#include -#include -#include -#include - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#include -#else -#include -#include -#include -#endif - -#include -#include -#include -#include -#include -#include - -/*---------------------------------------------------------------------------* - * process i frame - * implements the routine "I COMMAND" Q.921 03/93 pp 68 and pp 77 - *---------------------------------------------------------------------------*/ -void -i4b_rxd_i_frame(l2_softc_t *l2sc, struct isdn_l3_driver *drv, struct mbuf *m) -{ - u_char *ptr = m->m_data; - int nr; - int ns; - int p; - int s; - - if(!((l2sc->tei_valid == TEI_VALID) && - (l2sc->tei == GETTEI(*(ptr+OFF_TEI))))) - { - i4b_Dfreembuf(m); - return; - } - - if((l2sc->Q921_state != ST_MULTIFR) && (l2sc->Q921_state != ST_TIMREC)) - { - i4b_Dfreembuf(m); - NDBGL2(L2_I_ERR, "ERROR, state != (MF || TR)!"); - return; - } - - s = splnet(); - - l2sc->stat.rx_i++; /* update frame count */ - - nr = GETINR(*(ptr + OFF_INR)); - ns = GETINS(*(ptr + OFF_INS)); - p = GETIP(*(ptr + OFF_INR)); - - i4b_rxd_ack(l2sc, drv, nr); /* last packet ack */ - - if(l2sc->own_busy) /* own receiver busy ? */ - { - i4b_Dfreembuf(m); /* yes, discard information */ - - if(p == 1) /* P bit == 1 ? */ - { - i4b_tx_rnr_response(l2sc, p); /* yes, tx RNR */ - l2sc->ack_pend = 0; /* clear ACK pending */ - } - } - else /* own receiver ready */ - { - if(ns == l2sc->vr) /* expected sequence number ? */ - { - M128INC(l2sc->vr); /* yes, update */ - - l2sc->rej_excpt = 0; /* clr reject exception */ - - m_adj(m, I_HDR_LEN); /* strip i frame header */ - - l2sc->iframe_sent = 0; /* reset i acked already */ - - i4b_dl_data_ind(drv, m); /* pass data up */ - - if(!l2sc->iframe_sent) - { - i4b_tx_rr_response(l2sc, p); /* yes, tx RR */ - l2sc->ack_pend = 0; /* clr ACK pending */ - } - } - else /* ERROR, sequence number NOT expected */ - { - i4b_Dfreembuf(m); /* discard information */ - - if(l2sc->rej_excpt == 1) /* already exception ? */ - { - if(p == 1) /* immediate response ? */ - { - i4b_tx_rr_response(l2sc, p); /* yes, tx RR */ - l2sc->ack_pend = 0; /* clr ack pend */ - } - } - else /* not in exception cond */ - { - l2sc->rej_excpt = 1; /* set exception */ - i4b_tx_rej_response(l2sc, p); /* tx REJ */ - l2sc->ack_pend = 0; /* clr ack pending */ - } - } - } - - /* sequence number ranges as expected ? */ - - if(i4b_l2_nr_ok(nr, l2sc->va, l2sc->vs)) - { - if(l2sc->Q921_state == ST_TIMREC) - { - l2sc->va = nr; - - splx(s); - - return; - } - - if(l2sc->peer_busy) /* yes, other side busy ? */ - { - l2sc->va = nr; /* yes, update ack count */ - } - else /* other side ready */ - { - if(nr == l2sc->vs) /* count expected ? */ - { - l2sc->va = nr; /* update ack */ - i4b_T200_stop(l2sc); - i4b_T203_restart(l2sc); - } - else - { - if(nr != l2sc->va) - { - l2sc->va = nr; - i4b_T200_restart(l2sc); - } - } - } - } - else - { - i4b_nr_error_recovery(l2sc); /* sequence error */ - l2sc->Q921_state = ST_AW_EST; - } - - splx(s); -} - -/*---------------------------------------------------------------------------* - * internal I FRAME QUEUED UP routine (Q.921 03/93 p 61) - *---------------------------------------------------------------------------*/ -void -i4b_i_frame_queued_up(l2_softc_t *l2sc) -{ - struct mbuf *m; - u_char *ptr; - int s; - - s = splnet(); - - if((l2sc->peer_busy) || (l2sc->vs == ((l2sc->va + MAX_K_VALUE) & 127))) - { - if(l2sc->peer_busy) - { - NDBGL2(L2_I_MSG, "regen IFQUP, cause: peer busy!"); - } - - if(l2sc->vs == ((l2sc->va + MAX_K_VALUE) & 127)) - { - NDBGL2(L2_I_MSG, "regen IFQUP, cause: vs=va+k!"); - } - - /* - * XXX see: Q.921, page 36, 5.6.1 ".. may retransmit an I - * frame ...", shall we retransmit the last i frame ? - */ - - if(!(IF_QEMPTY(&l2sc->i_queue))) - { - NDBGL2(L2_I_MSG, "re-scheduling IFQU call!"); - START_TIMER(l2sc->IFQU_callout, i4b_i_frame_queued_up, l2sc, IFQU_DLY); - } - splx(s); - return; - } - - IF_DEQUEUE(&l2sc->i_queue, m); /* fetch next frame to tx */ - - if(!m) - { - NDBGL2(L2_I_ERR, "ERROR, mbuf NULL after IF_DEQUEUE"); - splx(s); - return; - } - - ptr = m->m_data; - - PUTSAPI(SAPI_CCP, CR_CMD_TO_NT, *(ptr + OFF_SAPI)); - PUTTEI(l2sc->tei, *(ptr + OFF_TEI)); - - *(ptr + OFF_INS) = (l2sc->vs << 1) & 0xfe; /* bit 0 = 0 */ - *(ptr + OFF_INR) = (l2sc->vr << 1) & 0xfe; /* P bit = 0 */ - - l2sc->stat.tx_i++; /* update frame counter */ - - l2sc->driver->ph_data_req(l2sc->l1_token, m, MBUF_DONTFREE); /* free'd when ack'd ! */ - - l2sc->iframe_sent = 1; /* in case we ack an I frame with another I frame */ - - if(l2sc->ua_num != UA_EMPTY) /* failsafe */ - { - NDBGL2(L2_I_ERR, "ERROR, l2sc->ua_num: %d != UA_EMPTY", l2sc->ua_num); - i4b_print_l2var(l2sc); - i4b_Dfreembuf(l2sc->ua_frame); - } - - l2sc->ua_frame = m; /* save unacked frame */ - l2sc->ua_num = l2sc->vs; /* save frame number */ - - M128INC(l2sc->vs); - - l2sc->ack_pend = 0; - - splx(s); - - if(l2sc->T200 == TIMER_IDLE) - { - i4b_T203_stop(l2sc); - i4b_T200_start(l2sc); - } -} - -#endif /* NI4BQ921 > 0 */ diff --git a/sys/netisdn/i4b_ioctl.h b/sys/netisdn/i4b_ioctl.h deleted file mode 100644 index b29d29067c54..000000000000 --- a/sys/netisdn/i4b_ioctl.h +++ /dev/null @@ -1,630 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_ioctl.h - messages kernel <--> userland - * ------------------------------------------- - * - * $Id: i4b_ioctl.h,v 1.14 2016/12/12 15:58:45 maya Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Tue Oct 10 15:30:55 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _NETISDN_I4B_IOCTL_H_ -#define _NETISDN_I4B_IOCTL_H_ - -#if defined(__FreeBSD__) && __FreeBSD__ >= 3 -#ifndef _MACHINE_TYPES_H_ -#include -#endif /* _MACHINE_TYPES_H_ */ -#endif /* __FreeBSD__ */ - -#include - -/*---------------------------------------------------------------------------* - * version and release number for isdn4bsd package - *---------------------------------------------------------------------------*/ -#define VERSION 0 /* version number */ -#define REL 96 /* release number */ -#define STEP 00 /* release step */ - -/*---------------------------------------------------------------------------* - * date/time format in i4b log messages - * ------------------------------------ - * Being year 2000 clean is not easy with the current state of the - * ANSI C library standard and its implementation for some locales. - * You might like to use the "%c" format of "strftime" sometimes, - * but this breaks Y2K in some locales. Also the old standard logfile - * format "%d.%m.%y %H:%M:%S" is non compliant. - * NetBSD's current toolset warns about this problems, and we compile - * with -Werror, so this problems need to be resolved. - *---------------------------------------------------------------------------*/ -#define I4B_TIME_FORMAT "%d.%m.%Y %H:%M:%S" - -/*---------------------------------------------------------------------------* - * ISDN D-channel protocols - *---------------------------------------------------------------------------*/ -#define PROTOCOL_DSS1 0 /* default, Euro-ISDN/DSS1 */ -#define PROTOCOL_D64S 1 /* 64k leased line, no protocol */ - -/*---------------------------------------------------------------------------* - * max length of some strings - *---------------------------------------------------------------------------*/ -#define TELNO_MAX 41 /* max length of a telephone number (+ '\0') */ -#define SUBADDR_MAX 22 /* max length of subaddres IE */ -#define DISPLAY_MAX 91 /* max length of display information (+ '\0') */ -#define DATETIME_MAX 21 /* max length of datetime information (+ '\0')*/ - -/*---------------------------------------------------------------------------* - * in case the src or dst telephone number is empty - *---------------------------------------------------------------------------*/ -#define TELNO_EMPTY "NotAvailable" - -/*---------------------------------------------------------------------------* - * B channel parameters - *---------------------------------------------------------------------------*/ -#define BCH_MAX_DATALEN 2048 /* max length of a B channel frame */ - -/*---------------------------------------------------------------------------* - * B channel protocol - *---------------------------------------------------------------------------*/ -#define BPROT_NONE 0 /* no protocol at all, raw data */ -#define BPROT_RHDLC 1 /* raw HDLC: flag, data, crc, flag */ - -/*---------------------------------------------------------------------------* - * causes data type - *---------------------------------------------------------------------------*/ -typedef unsigned int cause_t; /* 32 bit unsigned int */ - -/*---------------------------------------------------------------------------* - * call descriptor id (cdid) definitions - *---------------------------------------------------------------------------*/ -#define CDID_UNUSED 0 /* cdid is invalid and unused */ -#define CDID_MAX 99999 /* highest valid cdid, wraparound to 1 */ - -/*---------------------------------------------------------------------------* - * The shorthold algorithm to use - *---------------------------------------------------------------------------*/ -#define SHA_FIXU 0 /* timeout algorithm for fix unit charging */ -#define SHA_VARU 1 /* timeout algorithm for variable unit charging */ - -/*---------------------------------------------------------------------------* - * The shorthold data struct - *---------------------------------------------------------------------------*/ -typedef struct { - int shorthold_algorithm; /* shorthold algorithm to use */ - int unitlen_time; /* length of a charging unit */ - int idle_time; /* time without activity on b ch*/ - int earlyhup_time; /* safety area at end of unit */ -} msg_shorthold_t; - - -/**************************************************************************** - - outgoing call: - -------------- - - userland kernel - -------- ------ - - CDID_REQ -----------------> - - <------------------ cdid - - CONNECT_REQ --------------> - - <------------------ PROCEEDING_IND (if connect req ok) - - <------------------ CONNECT_ACTIVE_IND (if connection ok) - - or - - <------------------ DISCONNECT_IND (if connection failed) - - - - incoming call: - -------------- - - userland kernel - -------- ------ - - <------------------ CONNECT_IND - - CONNECT_RESP -------------> - - <------------------ CONNECT_ACTIVE_IND (if accepted) - - - - active disconnect: - ------------------ - - userland kernel - -------- ------ - - DISCONNECT_REQ ------------> - - <------------------ DISCONNECT_IND - - - passive disconnect: - ------------------- - - userland kernel - -------- ------ - - <------------------ DISCONNECT_IND - - -****************************************************************************/ - - -/*===========================================================================* - *===========================================================================* - * "read" messages from kernel -> userland - *===========================================================================* - *===========================================================================*/ - - -/*---------------------------------------------------------------------------* - * message header, included in every message - *---------------------------------------------------------------------------*/ -typedef struct { - char type; /* message identifier */ -#define MSG_CONNECT_IND 'a' -#define MSG_CONNECT_ACTIVE_IND 'b' -#define MSG_DISCONNECT_IND 'c' -#define MSG_DIALOUT_IND 'd' -#define MSG_IDLE_TIMEOUT_IND 'e' -#define MSG_ACCT_IND 'f' -#define MSG_CHARGING_IND 'g' -#define MSG_PROCEEDING_IND 'h' -#define MSG_ALERT_IND 'i' -#define MSG_DRVRDISC_REQ 'j' -#define MSG_L12STAT_IND 'k' -#define MSG_TEIASG_IND 'l' -#define MSG_PDEACT_IND 'm' -#define MSG_NEGCOMP_IND 'n' -#define MSG_IFSTATE_CHANGED_IND 'o' -#define MSG_DIALOUTNUMBER_IND 'p' -#define MSG_PACKET_IND 'q' -#define MSG_CONTR_EV_IND 'r' - int cdid; /* call descriptor id */ -} msg_hdr_t; - -/*---------------------------------------------------------------------------* - * connect indication - * indicates incoming connection - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int controller; /* controller number */ - int channel; /* channel number */ -#define CHAN_B1 0 /* this _must_ be 0, HSCX B1 is also 0 */ -#define CHAN_B2 1 /* this _must_ be 1, HSCX B2 is also 1 */ -#define CHAN_ANY (-1) /* outgoing, not possible for incoming */ -#define CHAN_NO (-2) /* call waiting (CW) for incoming */ - int bprot; /* b channel protocot, see BPROT_XXX */ - char dst_telno[TELNO_MAX]; /* destination telno */ - char src_telno[TELNO_MAX]; /* source telno */ - int scr_ind;/* screening indicator */ -#define SCR_NONE 0 /* no screening indicator transmitted */ -#define SCR_USR_NOSC 1 /* screening user provided, not screened*/ -#define SCR_USR_PASS 2 /* screening user provided, verified & passed */ -#define SCR_USR_FAIL 3 /* screening user provided, verified & failed */ -#define SCR_NET 4 /* screening network provided */ - int prs_ind;/* presentation indicator */ -#define PRS_NONE 0 /* no presentation indicator transmitted*/ -#define PRS_ALLOWED 1 /* presentation allowed */ -#define PRS_RESTRICT 2 /* presentation restricted */ -#define PRS_NNINTERW 3 /* number not available due to interworking */ -#define PRS_RESERVED 4 /* reserved */ - char display[DISPLAY_MAX]; /* content of display IE*/ - u_int8_t src_subaddr[SUBADDR_MAX]; - u_int8_t dest_subaddr[SUBADDR_MAX]; - u_int8_t type_plan; -} msg_connect_ind_t; - -/*---------------------------------------------------------------------------* - * connect active indication - * indicates active connection - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int controller; /* controller number actually used */ - int channel; /* channel number actually used */ - char datetime[DATETIME_MAX]; /* content of date/time IE */ -} msg_connect_active_ind_t; - -/*---------------------------------------------------------------------------* - * disconnect indication - * indicates a disconnect - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - cause_t cause; /* cause code */ -} msg_disconnect_ind_t; - -/*---------------------------------------------------------------------------* - * negotiation complete - * indicates an interface is completely up & running - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ -} msg_negcomplete_ind_t; - -/*---------------------------------------------------------------------------* - * interface changes internal state - * indicates an interface has somehow switched its FSM - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int state; /* new interface state */ -} msg_ifstatechg_ind_t; - -/*---------------------------------------------------------------------------* - * initiate a call to a remote site - * i.e. the IP driver got a packet and wants a connection - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int driver; /* driver type */ - int driver_unit; /* driver unit number */ -} msg_dialout_ind_t; - -/*---------------------------------------------------------------------------* - * dial a number - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int driver; /* driver type */ - int driver_unit; /* driver unit number */ - int cmdlen; /* length of string */ - char cmd[TELNO_MAX]; /* the number to dial */ -} msg_dialoutnumber_ind_t; - -/*---------------------------------------------------------------------------* - * idle timeout disconnect sent indication - * kernel has sent disconnect request because of b-ch idle - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ -} msg_idle_timeout_ind_t; - -/*---------------------------------------------------------------------------* - * accounting information from userland interface driver to daemon - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int accttype; /* accounting type */ -#define ACCT_DURING 0 -#define ACCT_FINAL 1 - int ioutbytes; /* ISDN # of bytes sent */ - int iinbytes; /* ISDN # of bytes received */ - int outbps; /* bytes per sec out */ - int inbps; /* bytes per sec in */ - int outbytes; /* driver # of bytes sent */ - int inbytes; /* driver # of bytes received */ -} msg_accounting_ind_t; - -/*---------------------------------------------------------------------------* - * charging information from isdn driver to daemon - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int units; /* number of units */ - int units_type; /* type of units info */ -#define CHARGE_INVALID 0 /* invalid, unknown */ -#define CHARGE_AOCD 1 /* advice of charge during call */ -#define CHARGE_AOCE 2 /* advice of charge at end of call */ -#define CHARGE_CALC 3 /* locally calculated from rates information */ -} msg_charging_ind_t; - -/*---------------------------------------------------------------------------* - * call proceeding indication - * indicates outgoing SETUP has been acknowledged - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int controller; /* controller number actually used */ - int channel; /* channel number actually used */ -} msg_proceeding_ind_t; - -/*---------------------------------------------------------------------------* - * alert indication - * indicates remote user side "rings" - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ -} msg_alert_ind_t; - -/*---------------------------------------------------------------------------* - * driver requests to disconnect line - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ -} msg_drvrdisc_req_t; - -/*---------------------------------------------------------------------------* - * connect packet logging - *---------------------------------------------------------------------------*/ - -typedef struct { - msg_hdr_t header; /* common header */ - int driver; /* driver type */ - int driver_unit; /* driver unit number */ - int direction; /* 0=in 1=out */ -#define DIRECTION_IN 0 /* sending packet to remote */ -#define DIRECTION_OUT 1 /* received packet from remote */ -#define MAX_PACKET_LOG 40 /* space for IP and TCP header */ - u_int8_t pktdata[MAX_PACKET_LOG]; -} msg_packet_ind_t; - -/*---------------------------------------------------------------------------* - * state of layer 1/2 - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int controller; /* controller unit */ - int layer; /* layer number (1/2) */ -#define LAYER_ONE 1 -#define LAYER_TWO 2 - int state; /* state info */ -#define LAYER_IDLE 0 -#define LAYER_ACTIVE 1 -} msg_l12stat_ind_t; - -/*---------------------------------------------------------------------------* - * TEI assignment messages - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int controller; /* controller unit */ - int tei; /* TEI or -1 if invalid */ -} msg_teiasg_ind_t; - -/*---------------------------------------------------------------------------* - * persistent deactivation state of stack - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int controller; /* controller unit */ - int numactive; /* number of active connections */ -} msg_pdeact_ind_t; - -/*---------------------------------------------------------------------------* - * connect indication - * indicates incoming connection - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int controller; /* controller number */ - int event; -#define CTRL_EV_IND_DETACH 0 -#define CTRL_EV_IND_ATTACH 1 -} msg_ctrl_ev_ind_t; - -/*===========================================================================* - *===========================================================================* - * "ioctl" messages from userland -> kernel - *===========================================================================* - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * request a unique cdid (to setup an outgoing call) - *---------------------------------------------------------------------------*/ -typedef struct { - int cdid; /* call descriptor id */ -} msg_cdid_req_t; - -#define I4B_CDID_REQ _IOWR('4', 0, int) - -/*---------------------------------------------------------------------------* - * connect request - * requests an outgoing connection - *---------------------------------------------------------------------------*/ -typedef struct { - int cdid; /* call descriptor id */ - int controller; /* controller to use */ - int channel; /* channel to use */ - int txdelay; /* tx delay after connect */ - int bprot; /* b channel protocol */ - int driver; /* driver to route b channel data to */ - int driver_unit; /* unit number for above driver */ - msg_shorthold_t shorthold_data; /* the shorthold data */ - int unitlen_method; /* how to calculate the unitlength */ -#define ULEN_METHOD_STATIC 0 /* use unitlen_time value (see above) */ -#define ULEN_METHOD_DYNAMIC 1 /* use AOCD */ - char dst_telno[TELNO_MAX]; /* destination telephone no */ - char src_telno[TELNO_MAX]; /* source telephone number */ -} msg_connect_req_t; - -#define I4B_CONNECT_REQ _IOW('4', 1, msg_connect_req_t) - -/*---------------------------------------------------------------------------* - * connect response - * this is the answer to an incoming connect indication - *---------------------------------------------------------------------------*/ -typedef struct { - int cdid; /* call descriptor id */ - int response; /* what to do with incoming call */ -#define SETUP_RESP_DNTCRE 0 /* dont care, call is not for me */ -#define SETUP_RESP_REJECT 1 /* reject call */ -#define SETUP_RESP_ACCEPT 2 /* accept call */ - cause_t cause; /* cause for case SETUP_RESP_REJECT */ - /* the following are only used for SETUP_RESP_ACCEPT !! */ - int txdelay; /* tx delay after connect */ - int bprot; /* B chan protocol */ - int driver; /* driver to route b channel data to */ - int driver_unit; /* unit number for above driver */ - int max_idle_time; /* max time without activity on b ch */ -} msg_connect_resp_t; - -#define I4B_CONNECT_RESP _IOW('4', 2, msg_connect_resp_t) - -/*---------------------------------------------------------------------------* - * disconnect request - * active disconnect request - *---------------------------------------------------------------------------*/ -typedef struct { - int cdid; /* call descriptor id */ - cause_t cause; /* protocol independent cause */ -} msg_discon_req_t; - -#define I4B_DISCONNECT_REQ _IOW('4', 3, msg_discon_req_t) - -/*---------------------------------------------------------------------------* - * controller info request - *---------------------------------------------------------------------------*/ -typedef struct { - int controller; /* controller number */ - int ncontroller; /* number of controllers in system */ - int max_isdnif; /* highest available ISDN interface num */ - int tei; /* tei controller probably has */ - char devname[64]; /* autoconfig device name, i.e. "isic0" */ - char cardname[80]; /* human readable brand / version */ - int nbch; /* number of b channels provided */ -} msg_ctrl_info_req_t; - -#define I4B_CTRL_INFO_REQ _IOWR('4', 4, msg_ctrl_info_req_t) - -/*---------------------------------------------------------------------------* - * dialout response - * status report to driver who requested a dialout - *---------------------------------------------------------------------------*/ -typedef struct { - int driver; /* driver to route b channel data to */ - int driver_unit; /* unit number for above driver */ - int stat; /* state of dialout request */ -#define DSTAT_NONE 0 -#define DSTAT_TFAIL 1 /* transient failure */ -#define DSTAT_PFAIL 2 /* permanent failure */ -#define DSTAT_INONLY 3 /* no outgoing dials allowed */ - cause_t cause; /* exact i4b cause */ -} msg_dialout_resp_t; - -#define I4B_DIALOUT_RESP _IOW('4', 5, msg_dialout_resp_t) - -/*---------------------------------------------------------------------------* - * timeout value update - *---------------------------------------------------------------------------*/ -typedef struct { - int cdid; /* call descriptor id */ - msg_shorthold_t shorthold_data; -} msg_timeout_upd_t; - -#define I4B_TIMEOUT_UPD _IOW('4', 6, msg_timeout_upd_t) - -/*---------------------------------------------------------------------------* - * soft enable/disable - *---------------------------------------------------------------------------*/ -typedef struct { - int driver; /* driver to route b channel data to */ - int driver_unit; /* unit number for above driver */ - int updown; /* what to do */ -#define SOFT_ENA 0 /* enable interface */ -#define SOFT_DIS 1 /* disable interface */ -} msg_updown_ind_t; - -#define I4B_UPDOWN_IND _IOW('4', 7, msg_updown_ind_t) - -/*---------------------------------------------------------------------------* - * send alert request - *---------------------------------------------------------------------------*/ -typedef struct { - int cdid; /* call descriptor id */ -} msg_alert_req_t; - -#define I4B_ALERT_REQ _IOW('4', 8, msg_alert_req_t) - -/*---------------------------------------------------------------------------* - * request version and release info from kernel part - * (msg_vr_req_t is also used by tel & rbch drivers) - *---------------------------------------------------------------------------*/ -typedef struct { - int version; /* version number */ - int release; /* release number */ - int step; /* release step number */ -} msg_vr_req_t; - -#define I4B_VR_REQ _IOR('4', 9, msg_vr_req_t) - -/*---------------------------------------------------------------------------* - * set ISDN protocol used by a controller - *---------------------------------------------------------------------------*/ -typedef struct { - int controller; /* controller number */ - int protocol; /* ISDN D-channel protocol type */ -} msg_prot_ind_t; - -#define I4B_PROT_IND _IOW('4', 10, msg_prot_ind_t) - -/*---------------------------------------------------------------------------* - * Query the identifier for a B channel driver - *---------------------------------------------------------------------------*/ -#define L4DRIVER_NAME_SIZ 16 -typedef struct { - char name[L4DRIVER_NAME_SIZ]; /* lookup this driver */ - int driver_id; /* returned driver id */ -} msg_l4driver_lookup_t; - -#define I4B_L4DRIVER_LOOKUP _IOWR('4', 11, msg_l4driver_lookup_t) - -/*---------------------------------------------------------------------------* - * Protocol download to active cards - *---------------------------------------------------------------------------*/ -struct isdn_dr_prot { - size_t bytecount; /* length of code */ - u_int8_t *microcode; /* pointer to microcode */ -}; - -struct isdn_download_request { - int controller; /* controller number */ - int numprotos; /* number of protocols in 'protocols' */ - struct isdn_dr_prot *protocols; -}; - -#define I4B_CTRL_DOWNLOAD _IOW('4', 100, struct isdn_download_request) - -/*---------------------------------------------------------------------------* - * Generic diagnostic interface for active cards - *---------------------------------------------------------------------------*/ -struct isdn_diagnostic_request { - int controller; /* controller number */ - u_int32_t cmd; /* diagnostic command to execute */ - size_t in_param_len; /* length of additional input parameter */ -#define I4B_ACTIVE_DIAGNOSTIC_MAXPARAMLEN 65536 - void *in_param; /* optional input parameter */ - size_t out_param_len; /* available output space */ - void *out_param; /* output data goes here */ -}; - -#define I4B_ACTIVE_DIAGNOSTIC _IOW('4', 102, struct isdn_diagnostic_request) - -#endif /* !_NETISDN_I4B_IOCTL_H_ */ diff --git a/sys/netisdn/i4b_ipr.c b/sys/netisdn/i4b_ipr.c deleted file mode 100644 index 9add6f314b56..000000000000 --- a/sys/netisdn/i4b_ipr.c +++ /dev/null @@ -1,1202 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_ipr.c - isdn4bsd IP over raw HDLC ISDN network driver - * --------------------------------------------------------- - * - * $Id: i4b_ipr.c,v 1.46 2018/07/25 07:55:45 msaitoh Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------* - * - * statistics counter usage (interface lifetime): - * ---------------------------------------------- - * sc->sc_if.if_ipackets # of received packets - * sc->sc_if.if_ierrors # of error packets not going to upper layers - * sc->sc_if.if_opackets # of transmitted packets - * sc->sc_if.if_oerrors # of error packets not being transmitted - * sc->sc_if.if_collisions # of invalid ip packets after VJ decompression - * sc->sc_if.if_ibytes # of bytes coming in from the line (before VJ) - * sc->sc_if.if_obytes # of bytes going out to the line (after VJ) - * sc->sc_if.if_imcasts (currently unused) - * sc->sc_if.if_omcasts # of frames sent out of the fastqueue - * sc->sc_if.if_iqdrops # of frames dropped on input because queue full - * sc->sc_if.if_noproto # of frames dropped on output because !AF_INET - * - * statistics counter usage (connection lifetime): - * ----------------------------------------------- - * sc->sc_iinb # of ISDN incoming bytes from HSCX - * sc->sc_ioutb # of ISDN outgoing bytes from HSCX - * sc->sc_inb # of incoming bytes after decompression - * sc->sc_outb # of outgoing bytes before compression - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_ipr.c,v 1.46 2018/07/25 07:55:45 msaitoh Exp $"); - -#include "irip.h" -#include "opt_irip.h" - -#if NIRIP > 0 - -#ifdef __FreeBSD__ -#include "opt_i4b.h" -#endif - -#include -#include -#include -#include -#include -#if defined(__FreeBSD__) && __FreeBSD__ >= 3 -#include -#include -#ifdef IPR_VJ -#include -#endif -#else -#include -#endif - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -#ifdef IRIP_VJ -#include -#define IPR_COMPRESS IFF_LINK0 /* compress TCP traffic */ -#define IPR_AUTOCOMP IFF_LINK1 /* auto-enable TCP compression */ - -/*--------------------------------------------------------------------------- - * NOTICE: using NO separate buffer relies on the assumption, that the HSCX - * IRQ handler _always_ allocates a single, continuous mbuf cluster large - * enough to hold the maximum MTU size if the ipr interface ! - * - * CAUTION: i have re-defined IPR_VJ_USEBUFFER because it makes problems - * with 2 i4b's back to back running cvs over ssh, cvs simply - * aborts because it gets bad data. Everything else (telnet/ftp?etc) - * functions fine. - *---------------------------------------------------------------------------*/ -#define IPR_VJ_USEBUFFER /* define to use an allocated separate buffer*/ - /* undef to uncompress in the mbuf itself */ -#endif /* IRIP_VJ */ - -#if defined(__FreeBSD_version) && __FreeBSD_version >= 400008 -#include "bpf.h" -#else -#define NBPFILTER 1 -#endif -#if NBPFILTER > 0 || NBPF > 0 -#include -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#else -#include -#include -#endif - -#include -#include -#include - -#include - -#ifndef __FreeBSD__ -#include /* For softnet */ -#endif - -#ifdef __FreeBSD__ -#define IPR_FMT "irip%d: " -#define IPR_ARG(sc) ((sc)->sc_if.if_unit) -#define PDEVSTATIC static -#elif defined(__bsdi__) -#define IPR_FMT "irip%d: " -#define IPR_ARG(sc) ((sc)->sc_if.if_unit) -#define PDEVSTATIC /* not static */ -#else -#define IPR_FMT "%s: " -#define IPR_ARG(sc) ((sc)->sc_if.if_xname) -#define PDEVSTATIC /* not static */ -#endif - -#define I4BIPRMTU 1500 /* regular MTU */ -#define I4BIPRMAXMTU 2000 /* max MTU */ -#define I4BIPRMINMTU 500 /* min MTU */ - -#define I4BIPRMAXQLEN 50 /* max queue length */ - -#define I4BIPRACCT 1 /* enable accounting messages */ -#define I4BIPRACCTINTVL 2 /* accounting msg interval in secs */ -#define I4BIPRADJFRXP 1 /* adjust 1st rxd packet */ - - -struct ipr_softc { - struct ifnet sc_if; /* network-visible interface */ - int sc_state; /* state of the interface */ - - call_desc_t *sc_cdp; /* ptr to call descriptor */ - isdn_link_t *sc_ilt; /* ptr to B channel driver/state */ - - int sc_unit; /* which instance are we? */ - int sc_updown; /* soft state of interface */ - struct ifqueue sc_fastq; /* interactive traffic */ - int sc_dialresp; /* dialresponse */ - int sc_lastdialresp;/* last dialresponse */ - -#if I4BIPRACCT - int sc_iinb; /* isdn driver # of inbytes */ - int sc_ioutb; /* isdn driver # of outbytes */ - int sc_inb; /* # of bytes rx'd */ - int sc_outb; /* # of bytes tx'd */ - int sc_linb; /* last # of bytes rx'd */ - int sc_loutb; /* last # of bytes tx'd */ - int sc_fn; /* flag, first null acct */ -#endif - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 - struct callout sc_callout; -#endif -#if defined(__FreeBSD__) - struct callout_handle sc_callout; -#endif - -#ifdef I4BIPRADJFRXP - int sc_first_pkt; /* flag, first rxd packet */ -#endif -#if IPR_LOG - int sc_log_first; /* log first n packets */ -#endif - -#ifdef IRIP_VJ - struct slcompress sc_compr; /* tcp compression data */ -#ifdef IPR_VJ_USEBUFFER - u_char *sc_cbuf; /* tcp decompression buffer */ -#endif -#endif - -} ipr_softc[NIRIP]; - -enum ipr_states { - ST_IDLE, /* initialized, ready, idle */ - ST_DIALING, /* dialling out to remote */ - ST_CONNECTED_W, /* connected to remote */ - ST_CONNECTED_A, /* connected to remote */ -}; - -#if defined(__FreeBSD__) || defined(__bsdi__) -#define THE_UNIT sc->sc_if.if_unit -#else -#define THE_UNIT sc->sc_unit -#endif - -#ifdef __FreeBSD__ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001 -# define IOCTL_CMD_T u_long -#else -#ifdef __NetBSD__ -# define IOCTL_CMD_T u_long -#else -# define IOCTL_CMD_T int -#endif -#endif -PDEVSTATIC void iripattach(void *); -PSEUDO_SET(iripattach, i4b_ipr); -static int irpioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, void *data); -#else -PDEVSTATIC void iripattach(void); -static int iripioctl(struct ifnet *ifp, u_long cmd, void *data); -#endif - -#ifdef __bsdi__ -static int iprwatchdog(int unit); -#else -static void iprwatchdog(struct ifnet *ifp); -#endif -static void ipr_tx_queue_empty(void *); -static int iripoutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, - const struct rtentry *rtp); -static void iripclearqueues(struct ipr_softc *sc); -static void ipr_set_linktab(void *softc, isdn_link_t *ilt); -static void ipr_activity(void *softc, int rxtx); -static void ipr_rx_data_rdy(void *softc); -static void ipr_disconnect(void *softc, void *cdp); -static void ipr_connect(void *softc, void *cdp); -static void ipr_dialresponse(void *softc, int status, cause_t cause); -static void ipr_updown(void *softc, int updown); -static void* ipr_get_softc(int unit); - -static const struct isdn_l4_driver_functions -ipr_l4_functions = { - ipr_rx_data_rdy, - ipr_tx_queue_empty, - ipr_activity, - ipr_connect, - ipr_disconnect, - ipr_dialresponse, - ipr_updown, - ipr_get_softc, - ipr_set_linktab, - NULL -}; - -static int irip_driver_id = -1; - -/*===========================================================================* - * DEVICE DRIVER ROUTINES - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * interface attach routine at kernel boot time - *---------------------------------------------------------------------------*/ -PDEVSTATIC void -#ifdef __FreeBSD__ -iripattach(void *dummy) -#else -iripattach(void) -#endif -{ - struct ipr_softc *sc = ipr_softc; - int i; - - irip_driver_id = isdn_l4_driver_attach("irip", NIRIP, &ipr_l4_functions); - - for(i=0; i < NIRIP; sc++, i++) - { - NDBGL4(L4_DIALST, "setting dial state to ST_IDLE"); - - sc->sc_state = ST_IDLE; - sc->sc_unit = i; - -#ifdef __FreeBSD__ - sc->sc_if.if_name = "irip"; -#if __FreeBSD__ < 3 - sc->sc_if.if_next = NULL; -#endif - sc->sc_if.if_unit = i; -#elif defined(__bsdi__) - sc->sc_if.if_name = "irip"; - sc->sc_if.if_unit = i; -#else - snprintf(sc->sc_if.if_xname, sizeof(sc->sc_if.if_xname), - "irip%d", i); - sc->sc_if.if_softc = sc; -#endif - -#ifdef IRIP_VJ - sc->sc_if.if_flags = IFF_POINTOPOINT | IFF_SIMPLEX | IPR_AUTOCOMP; -#else - sc->sc_if.if_flags = IFF_POINTOPOINT | IFF_SIMPLEX; -#endif - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 - callout_init(&sc->sc_callout, 0); -#endif - - sc->sc_if.if_mtu = I4BIPRMTU; - sc->sc_if.if_type = IFT_ISDNBASIC; - sc->sc_if.if_ioctl = iripioctl; - sc->sc_if.if_output = iripoutput; - - IFQ_SET_MAXLEN(&sc->sc_if.if_snd, I4BIPRMAXQLEN); - sc->sc_fastq.ifq_maxlen = I4BIPRMAXQLEN; - IFQ_SET_READY(&sc->sc_if.if_snd); - - sc->sc_if.if_ipackets = 0; - sc->sc_if.if_ierrors = 0; - sc->sc_if.if_opackets = 0; - sc->sc_if.if_oerrors = 0; - sc->sc_if.if_collisions = 0; - sc->sc_if.if_ibytes = 0; - sc->sc_if.if_obytes = 0; - sc->sc_if.if_imcasts = 0; - sc->sc_if.if_omcasts = 0; - sc->sc_if.if_iqdrops = 0; - sc->sc_if.if_noproto = 0; - -#if I4BIPRACCT - sc->sc_if.if_timer = 0; - sc->sc_if.if_watchdog = iprwatchdog; - sc->sc_iinb = 0; - sc->sc_ioutb = 0; - sc->sc_inb = 0; - sc->sc_outb = 0; - sc->sc_linb = 0; - sc->sc_loutb = 0; - sc->sc_fn = 1; -#endif -#if IPR_LOG - sc->sc_log_first = IPR_LOG; -#endif - -#ifdef IRIP_VJ -#ifdef __FreeBSD__ - sl_compress_init(&sc->sc_compr, -1); -#else - sl_compress_init(&sc->sc_compr); -#endif - -#ifdef IPR_VJ_USEBUFFER - if(!((sc->sc_cbuf = - (u_char *)malloc(I4BIPRMAXMTU+128, M_DEVBUF, M_WAITOK)))) - { - panic("if_ipr.c, ipr_attach: VJ malloc failed"); - } -#endif -#endif - - sc->sc_updown = SOFT_ENA; /* soft enabled */ - - sc->sc_dialresp = DSTAT_NONE; /* no response */ - sc->sc_lastdialresp = DSTAT_NONE; - -#if defined(__FreeBSD_version) && ((__FreeBSD_version >= 500009) || (410000 <= __FreeBSD_version && __FreeBSD_version < 500000)) - /* do not call bpfattach in ether_ifattach */ - ether_ifattach(&sc->sc_if, 0); -#else - if_attach(&sc->sc_if); - if_alloc_sadl(&sc->sc_if); -#endif - -#if NBPFILTER > 0 || NBPF > 0 -#ifdef __FreeBSD__ - bpfattach(&sc->sc_if, DLT_NULL, sizeof(u_int)); -#else - bpf_attach(&sc->sc_if, DLT_NULL, sizeof(u_int)); - bpf_mtap_softint_init(&sc->sc_if); -#endif -#endif - } -} - -/*---------------------------------------------------------------------------* - * output a packet to the ISDN B-channel - *---------------------------------------------------------------------------*/ -static int -iripoutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, - const struct rtentry *rtp) -{ - struct ipr_softc *sc; - int s, rv; - struct ifqueue *ifq = NULL; - struct ip *ip; - - s = splnet(); - -#if defined(__FreeBSD__) || defined(__bsdi__) - unit = ifp->if_unit; - sc = &ipr_softc[unit]; -#else - sc = ifp->if_softc; -#endif - - /* check for IP */ - - if(dst->sa_family != AF_INET) - { - printf(IPR_FMT "af%d not supported\n", IPR_ARG(sc), dst->sa_family); - m_freem(m); - splx(s); - sc->sc_if.if_noproto++; - sc->sc_if.if_oerrors++; - return(EAFNOSUPPORT); - } - - /* check interface state = UP */ - - if(!(ifp->if_flags & IFF_UP)) - { - NDBGL4(L4_IPRDBG, "%s: interface is DOWN!", sc->sc_if.if_xname); - m_freem(m); - splx(s); - sc->sc_if.if_oerrors++; - return(ENETDOWN); - } - - /* dial if necessary */ - - if(sc->sc_state == ST_IDLE || sc->sc_state == ST_DIALING) - { - -#ifdef NOTDEF - switch(sc->sc_dialresp) - { - case DSTAT_TFAIL: /* transient failure */ - NDBGL4(L4_IPRDBG, "%s: transient dial failure!", sc->sc_if.if_xname); - m_freem(m); - iripclearqueues(sc); - sc->sc_dialresp = DSTAT_NONE; - splx(s); - sc->sc_if.if_oerrors++; - return(ENETUNREACH); - break; - - case DSTAT_PFAIL: /* permanent failure */ - NDBGL4(L4_IPRDBG, "%s: permanent dial failure!", sc->sc_if.if_xname); - m_freem(m); - iripclearqueues(sc); - sc->sc_dialresp = DSTAT_NONE; - splx(s); - sc->sc_if.if_oerrors++; - return(EHOSTUNREACH); - break; - - case DSTAT_INONLY: /* no dialout allowed*/ - NDBGL4(L4_IPRDBG, "%s: dialout not allowed failure!", sc->sc_if.if_xname); - m_freem(m); - iripclearqueues(sc); - sc->sc_dialresp = DSTAT_NONE; - splx(s); - sc->sc_if.if_oerrors++; - return(EHOSTUNREACH); - break; - } -#endif - - NDBGL4(L4_IPRDBG, "%s: send dial request message!", sc->sc_if.if_xname); - NDBGL4(L4_DIALST, "%s: setting dial state to ST_DIALING", sc->sc_if.if_xname); - i4b_l4_dialout(irip_driver_id, sc->sc_unit); - sc->sc_state = ST_DIALING; - } - -#if IPR_LOG - if(sc->sc_log_first > 0) - { - --(sc->sc_log_first); - i4b_l4_packet_ind(irip_driver_id, sc->sc_unit, 1, m ); - } -#endif - - /* - * check, if type of service indicates interactive, i.e. telnet, - * traffic. in case it is interactive, put it into the fast queue, - * else (i.e. ftp traffic) put it into the "normal" queue - */ - - IFQ_CLASSIFY(&ifp->if_snd, m, dst->sa_family); - - ip = mtod(m, struct ip *); /* get ptr to ip header */ - - if(ip->ip_tos & IPTOS_LOWDELAY) - ifq = &sc->sc_fastq; - - /* check for space in choosen send queue */ - - if ((ifq != NULL) -#ifdef ALTQ - && ALTQ_IS_ENABLED(&sc->sc_if.if_snd) == 0 -#endif - ) { - if(IF_QFULL(ifq)) - { - NDBGL4(L4_IPRDBG, "%s: send queue full!", sc->sc_if.if_xname); - IF_DROP(ifq); - m_freem(m); - sc->sc_if.if_oerrors++; - splx(s); - return(ENOBUFS); - } - IF_ENQUEUE(ifq, m); - } else { - IFQ_ENQUEUE(&sc->sc_if.if_snd, m, rv); - if (rv != 0) { - sc->sc_if.if_oerrors++; - splx(s); - return rv; - } - } - - NDBGL4(L4_IPRDBG, "%s: added packet to send queue!", sc->sc_if.if_xname); - - ipr_tx_queue_empty(sc); - - splx(s); - - return (0); -} - -/*---------------------------------------------------------------------------* - * process ioctl - *---------------------------------------------------------------------------*/ -static int -iripioctl(struct ifnet *ifp, u_long cmd, void *data) -{ - struct ipr_softc *sc = ifp->if_softc; - - struct ifreq *ifr = (struct ifreq *)data; - int s; - int error = 0; - - s = splnet(); - - switch (cmd) - { - case SIOCAIFADDR: /* add interface address */ - case SIOCINITIFADDR: /* set interface address */ - case SIOCSIFDSTADDR: /* set interface destination address */ - if (ifreq_getaddr(cmd, ifr)->sa_family != AF_INET) - error = EAFNOSUPPORT; - else - sc->sc_if.if_flags |= IFF_UP; - break; - - case SIOCSIFFLAGS: /* set interface flags */ - if ((error = ifioctl_common(ifp, cmd, data)) != 0) - break; - if ((ifr->ifr_flags & IFF_UP) == 0) { - if (sc->sc_if.if_flags & IFF_RUNNING) { - /* disconnect ISDN line */ - i4b_l4_drvrdisc(sc->sc_cdp->cdid); - sc->sc_if.if_flags &= ~IFF_RUNNING; - } - - sc->sc_state = ST_IDLE; - - /* empty queues */ - - iripclearqueues(sc); - } - -#if 0 - if(ifr->ifr_flags & IFF_DEBUG) - ; /* enable debug messages */ -#endif - - break; - -#if !defined(__OpenBSD__) - case SIOCSIFMTU: /* set interface MTU */ - if(ifr->ifr_mtu > I4BIPRMAXMTU) - error = EINVAL; - else if(ifr->ifr_mtu < I4BIPRMINMTU) - error = EINVAL; - else if ((error = ifioctl_common(ifp, cmd, data)) == ENETRESET) - error = 0; - break; -#endif /* __OPENBSD__ */ - -#if 0 - /* not needed for FreeBSD, done in sl_compress_init() (-hm) */ - - /* need to add an ioctl: set VJ max slot ID - * #define IPRIOCSMAXCID _IOW('I', XXX, int) - */ -#ifdef IPR_VJ - case IPRIOCSMAXCID: - { - struct lwp *l = curlwp; /* XXX */ - - if((error = kauth_authorize_network(l->l_cred, - KAUTH_NETWORK_INTERFACE, - KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, - (void *)cmd, NULL)) != 0) - break; - sl_compress_setup(sc->sc_compr, *(int *)data); - } - break; -#endif -#endif - default: - error = ifioctl_common(ifp, cmd, data); - if (error == ENETRESET) - error = 0; - break; - } - - splx(s); - - return(error); -} - -/*---------------------------------------------------------------------------* - * clear the interface's send queues - *---------------------------------------------------------------------------*/ -static void -iripclearqueues(struct ipr_softc *sc) -{ - int x; - struct mbuf *m; - - for(;;) - { - x = splnet(); - IF_DEQUEUE(&sc->sc_fastq, m); - splx(x); - - if(m) - m_freem(m); - else - break; - } - - for(;;) - { - x = splnet(); - IFQ_DEQUEUE(&sc->sc_if.if_snd, m); - splx(x); - - if(m) - m_freem(m); - else - break; - } -} - -#if I4BIPRACCT -/*---------------------------------------------------------------------------* - * watchdog routine - *---------------------------------------------------------------------------*/ -#ifdef __bsdi__ -static int -iprwatchdog(int unit) -{ -#else -static void -iprwatchdog(struct ifnet *ifp) -{ -#endif -#ifdef __FreeBSD__ - int unit = ifp->if_unit; - struct ipr_softc *sc = &ipr_softc[unit]; -#elif defined(__bsdi__) - struct ipr_softc *sc = &ipr_softc[unit]; - struct ifnet *ifp = &ipr_softc[unit].sc_if; -#else - struct ipr_softc *sc = ifp->if_softc; -#endif - bchan_statistics_t bs; - - /* get # of bytes in and out from the HSCX driver */ - - (*sc->sc_ilt->bchannel_driver->bch_stat) - (sc->sc_ilt->l1token, sc->sc_ilt->channel, &bs); - - sc->sc_ioutb += bs.outbytes; - sc->sc_iinb += bs.inbytes; - - if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn) - { - int ri = (sc->sc_iinb - sc->sc_linb)/I4BIPRACCTINTVL; - int ro = (sc->sc_ioutb - sc->sc_loutb)/I4BIPRACCTINTVL; - - if((sc->sc_iinb == sc->sc_linb) && (sc->sc_ioutb == sc->sc_loutb)) - sc->sc_fn = 0; - else - sc->sc_fn = 1; - - sc->sc_linb = sc->sc_iinb; - sc->sc_loutb = sc->sc_ioutb; - - if (sc->sc_cdp) - i4b_l4_accounting(sc->sc_cdp->cdid, ACCT_DURING, - sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_outb, sc->sc_inb); - } - sc->sc_if.if_timer = I4BIPRACCTINTVL; -#ifdef __bsdi__ - return 0; -#endif -} -#endif /* I4BIPRACCT */ - -/*===========================================================================* - * ISDN INTERFACE ROUTINES - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * start transmitting after connect - *---------------------------------------------------------------------------*/ -static void -i4bipr_connect_startio(struct ipr_softc *sc) -{ - int s = splnet(); - - if(sc->sc_state == ST_CONNECTED_W) - { - sc->sc_state = ST_CONNECTED_A; - ipr_tx_queue_empty(sc); - } - - splx(s); -} - -/*---------------------------------------------------------------------------* - * this routine is called from L4 handler at connect time - *---------------------------------------------------------------------------*/ -static void -ipr_connect(void *softc, void *cdp) -{ - struct ipr_softc *sc = softc; - int s; - - sc->sc_cdp = (call_desc_t *)cdp; - - s = splnet(); - - NDBGL4(L4_DIALST, "%s: setting dial state to ST_CONNECTED", sc->sc_if.if_xname); - - sc->sc_if.if_flags |= IFF_RUNNING; - sc->sc_state = ST_CONNECTED_W; - - sc->sc_dialresp = DSTAT_NONE; - sc->sc_lastdialresp = DSTAT_NONE; - -#if I4BIPRACCT - sc->sc_iinb = 0; - sc->sc_ioutb = 0; - sc->sc_inb = 0; - sc->sc_outb = 0; - sc->sc_linb = 0; - sc->sc_loutb = 0; - sc->sc_if.if_timer = I4BIPRACCTINTVL; -#endif - -#ifdef I4BIPRADJFRXP - sc->sc_first_pkt = 1; -#endif - - /* - * Sometimes ISDN B-channels are switched thru asymmetic. This - * means that under such circumstances B-channel data (the first - * three packets of a TCP connection in my case) may get lost, - * causing a large delay until the connection is started. - * When the sending of the very first packet of a TCP connection - * is delayed for a to be empirically determined delay (close - * to a second in my case) those packets go thru and the TCP - * connection comes up "almost" immediately (-hm). - */ - - if(sc->sc_cdp->isdntxdelay > 0) - { - int xdelay; - - if (hz == 100) { - xdelay = sc->sc_cdp->isdntxdelay; /* avoid any rounding */ - } else { - xdelay = sc->sc_cdp->isdntxdelay*hz; - xdelay /= 100; - } - - START_TIMER(sc->sc_callout, (TIMEOUT_FUNC_T)i4bipr_connect_startio, (void *)sc, xdelay); - } - else - { - sc->sc_state = ST_CONNECTED_A; - ipr_tx_queue_empty(sc); - } - - splx(s); - - /* we don't need any negotiation - pass event back right now */ - i4b_l4_negcomplete(sc->sc_cdp); -} - -/*---------------------------------------------------------------------------* - * this routine is called from L4 handler at disconnect time - *---------------------------------------------------------------------------*/ -static void -ipr_disconnect(void *softc, void *cdp) -{ - call_desc_t *cd = (call_desc_t *)cdp; - struct ipr_softc *sc = softc; - - /* new stuff to check that the active channel is being closed */ - - if (cd != sc->sc_cdp) - { - NDBGL4(L4_IPRDBG, "%s: channel %d not active", - sc->sc_if.if_xname, cd->channelid); - return; - } - -#if I4BIPRACCT - sc->sc_if.if_timer = 0; -#endif -#if IPR_LOG - /* show next IPR_LOG packets again */ - sc->sc_log_first = IPR_LOG; -#endif - - i4b_l4_accounting(cd->cdid, ACCT_FINAL, - sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_outb, sc->sc_inb); - - sc->sc_cdp = NULL; - - NDBGL4(L4_DIALST, "setting dial state to ST_IDLE"); - - sc->sc_dialresp = DSTAT_NONE; - sc->sc_lastdialresp = DSTAT_NONE; - - sc->sc_if.if_flags &= ~IFF_RUNNING; - sc->sc_state = ST_IDLE; -} - -/*---------------------------------------------------------------------------* - * this routine is used to give a feedback from userland daemon - * in case of dial problems - *---------------------------------------------------------------------------*/ -static void -ipr_dialresponse(void *softc, int status, cause_t cause) -{ - struct ipr_softc *sc = softc; - sc->sc_dialresp = status; - - NDBGL4(L4_IPRDBG, "%s: last=%d, this=%d", - sc->sc_if.if_xname, sc->sc_lastdialresp, sc->sc_dialresp); - - if(status != DSTAT_NONE) - { - NDBGL4(L4_IPRDBG, "%s: clearing queues", sc->sc_if.if_xname); - iripclearqueues(sc); - } -} - -/*---------------------------------------------------------------------------* - * interface soft up/down - *---------------------------------------------------------------------------*/ -static void -ipr_updown(void *softc, int updown) -{ - struct ipr_softc *sc = softc; - sc->sc_updown = updown; -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * when a new frame (mbuf) has been received and was put on - * the rx queue. It is assumed that this routines runs at - * appropriate protection level! Keep it short ! - *---------------------------------------------------------------------------*/ -static void -ipr_rx_data_rdy(void *softc) -{ - register struct ipr_softc *sc = softc; - register struct mbuf *m; -#ifdef IRIP_VJ -#ifdef IPR_VJ_USEBUFFER - u_char *cp = sc->sc_cbuf; -#endif - int len, c; -#endif - - if((m = *sc->sc_ilt->rx_mbuf) == NULL) - return; - - m_set_rcvif(m, &sc->sc_if); - - m->m_pkthdr.len = m->m_len; - -#ifdef I4BIPRADJFRXP - - /* - * The very first packet after the B channel is switched thru - * has very often several bytes of random data prepended. This - * routine looks where the IP header starts and removes the - * the bad data. - */ - - if(sc->sc_first_pkt) - { - unsigned char *mp = m->m_data; - int i; - - sc->sc_first_pkt = 0; - - for(i = 0; i < m->m_len; i++, mp++) - { - if( ((*mp & 0xf0) == 0x40) && - ((*mp & 0x0f) >= 0x05) ) - { - m->m_data = mp; - m->m_pkthdr.len -= i; - break; - } - } - } -#endif - - sc->sc_if.if_ipackets++; - sc->sc_if.if_ibytes += m->m_pkthdr.len; - -#ifdef IRIP_VJ - if((c = (*(mtod(m, u_char *)) & 0xf0)) != (IPVERSION << 4)) - { - /* copy data to buffer */ - - len = m->m_len; - -#ifdef IPR_VJ_USEBUFFER -/* XXX */ m_copydata(m, 0, len, cp); -#endif - - if(c & 0x80) - { - c = TYPE_COMPRESSED_TCP; - } - else if(c == TYPE_UNCOMPRESSED_TCP) - { -#ifdef IPR_VJ_USEBUFFER - *cp &= 0x4f; /* XXX */ -#else - *(mtod(m, u_char *)) &= 0x4f; -#endif - } - - /* - * We've got something that's not an IP packet. - * If compression is enabled, try to decompress it. - * Otherwise, if `auto-enable' compression is on and - * it's a reasonable packet, decompress it and then - * enable compression. Otherwise, drop it. - */ - if(sc->sc_if.if_flags & IPR_COMPRESS) - { -#ifdef IPR_VJ_USEBUFFER - len = sl_uncompress_tcp(&cp,len,(u_int)c,&sc->sc_compr); -#else - len = sl_uncompress_tcp((u_char **)&m->m_data, len, - (u_int)c, &sc->sc_compr); -#endif - - if(len <= 0) - { -#ifdef DEBUG_IPR_VJ - printf("i4b_ipr, ipr_rx_data_rdy: len <= 0 IPR_COMPRESS!\n"); -#endif - goto error; - } - } - else if((sc->sc_if.if_flags & IPR_AUTOCOMP) && - (c == TYPE_UNCOMPRESSED_TCP) && (len >= 40)) - { -#ifdef IPR_VJ_USEBUFFER - len = sl_uncompress_tcp(&cp,len,(u_int)c,&sc->sc_compr); -#else - len = sl_uncompress_tcp((u_char **)&m->m_data, len, - (u_int)c, &sc->sc_compr); -#endif - - if(len <= 0) - { -#ifdef DEBUG_IPR_VJ - printf("i4b_ipr, ipr_rx_data_rdy: len <= 0 IPR_AUTOCOMP!\n"); -#endif - goto error; - } - - sc->sc_if.if_flags |= IPR_COMPRESS; - } - else - { -#ifdef DEBUG_IPR_VJ - printf("i4b_ipr, ipr_input: invalid ip packet!\n"); -#endif - -error: - sc->sc_if.if_ierrors++; - sc->sc_if.if_collisions++; - m_freem(m); - return; - } -#ifdef IPR_VJ_USEBUFFER -/* XXX */ m_copyback(m, 0, len, cp); -#else - m->m_len = m->m_pkthdr.len = len; -#endif - } -#endif - -#if I4BIPRACCT - /* NB. do the accounting after decompression! */ - sc->sc_inb += m->m_pkthdr.len; -#endif -#if IPR_LOG - if(sc->sc_log_first > 0) - { - --(sc->sc_log_first); - i4b_l4_packet_ind(irip_driver_id, sc->sc_unit, 0, m ); - } -#endif - -#if NBPFILTER > 0 || NBPF > 0 - if(sc->sc_if.if_bpf) - { - /* prepend the address family as a four byte field */ - struct mbuf mm; - u_int af = AF_INET; - - mm.m_type = MT_DATA; - mm.m_flags = 0; - mm.m_next = m; - mm.m_nextpkt = NULL; - mm.m_owner = NULL; - mm.m_len = 4; - mm.m_data = (char *)⁡ - - bpf_mtap_softint(&sc->sc_if, &mm); - } -#endif /* NBPFILTER > 0 || NBPF > 0 */ - - if (__predict_false(!pktq_enqueue(ip_pktq, m, 0))) { - sc->sc_if.if_ierrors++; - sc->sc_if.if_iqdrops++; - m_freem(m); - } -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * when the last frame has been sent out and there is no - * further frame (mbuf) in the tx queue. - *---------------------------------------------------------------------------*/ -static void -ipr_tx_queue_empty(void *softc) -{ - register struct ipr_softc *sc = softc; - register struct mbuf *m; -#ifdef IRIP_VJ - struct ip *ip; -#endif - int x = 0; - - if(sc->sc_state != ST_CONNECTED_A) - return; - - for(;;) - { - IF_DEQUEUE(&sc->sc_fastq, m); - if(m) - { - sc->sc_if.if_omcasts++; - } - else - { - IFQ_DEQUEUE(&sc->sc_if.if_snd, m); - if(m == NULL) - break; - } - -#if NBPFILTER > 0 || NBPF > 0 - if(sc->sc_if.if_bpf) - { - /* prepend the address family as a four byte field */ - - struct mbuf mm; - u_int af = AF_INET; - mm.m_next = m; - mm.m_len = 4; - mm.m_data = (char *)⁡ - - bpf_mtap(&sc->sc_if, &mm, BPF_D_OUT); - } -#endif /* NBPFILTER */ - -#if I4BIPRACCT - sc->sc_outb += m->m_pkthdr.len; /* size before compression */ -#endif - -#ifdef IRIP_VJ - if((ip = mtod(m, struct ip *))->ip_p == IPPROTO_TCP) - { - if(sc->sc_if.if_flags & IPR_COMPRESS) - { - *mtod(m, u_char *) |= sl_compress_tcp(m, ip, - &sc->sc_compr, 1); - } - } -#endif - x = 1; - - if(IF_QFULL(sc->sc_ilt->tx_queue)) - { - NDBGL4(L4_IPRDBG, "%s: tx queue full!", sc->sc_if.if_xname); - m_freem(m); - } - else - { - sc->sc_if.if_obytes += m->m_pkthdr.len; - sc->sc_if.if_opackets++; - IF_ENQUEUE(sc->sc_ilt->tx_queue, m); - } - } - - if(x) - (*sc->sc_ilt->bchannel_driver->bch_tx_start)(sc->sc_ilt->l1token, sc->sc_ilt->channel); -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * each time a packet is received or transmitted. It should - * be used to implement an activity timeout mechanism. - *---------------------------------------------------------------------------*/ -static void -ipr_activity(void *softc, int rxtx) -{ - struct ipr_softc *sc = softc; - sc->sc_cdp->last_active_time = SECOND; -} - -/*---------------------------------------------------------------------------* - * return this drivers linktab address - *---------------------------------------------------------------------------*/ -static void* -ipr_get_softc(int unit) -{ - return &ipr_softc[unit]; -} - -/*---------------------------------------------------------------------------* - * setup the isdn_linktab for this driver - *---------------------------------------------------------------------------*/ -static void -ipr_set_linktab(void *softc, isdn_link_t *ilt) -{ - struct ipr_softc *sc = softc; - sc->sc_ilt = ilt; -} - -/*===========================================================================*/ - -#endif /* NIRIP > 0 */ diff --git a/sys/netisdn/i4b_isdnq931.h b/sys/netisdn/i4b_isdnq931.h deleted file mode 100644 index 66ef21e0daec..000000000000 --- a/sys/netisdn/i4b_isdnq931.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_isdnq931.h - DSS1 layer 3 message types - * ------------------------------------------- - * - * $Id: i4b_isdnq931.h,v 1.2 2005/12/10 23:51:50 elad Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Thu Apr 27 09:46:13 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _NETISDN_I4B_ISDBQ931_H_ -#define _NETISDN_I4B_ISDBQ931_H_ - -/* protocol discriminators */ - -#define PD_Q931 0x08 /* Q.931/I.451 */ - -/* Q.931 single octett information element identifiers */ - -#define IEI_SENDCOMPL 0xa1 /* sending complete */ - -/* Q.931 variable length information element identifiers */ - -#define IEI_SEGMMSG 0x00 /* segmented message */ -#define IEI_BEARERCAP 0x04 /* bearer capabilities */ -#define IEI_CAUSE 0x08 /* cause */ -#define IEI_CALLID 0x10 /* call identity */ -#define IEI_CALLSTATE 0x14 /* call state */ -#define IEI_CHANNELID 0x18 /* channel identification */ -#define IEI_PROGRESSI 0x1e /* progress indicator */ -#define IEI_NETSPCFAC 0x20 /* network specific facilities */ -#define IEI_NOTIFIND 0x27 /* notification indicator */ -#define IEI_DISPLAY 0x28 /* display */ -#define IEI_DATETIME 0x29 /* date/time */ -#define IEI_KEYPAD 0x2c /* keypad facility */ -#define IEI_SIGNAL 0x34 /* signal */ -#define IEI_INFRATE 0x40 /* information rate */ -#define IEI_ETETDEL 0x42 /* end to end transit delay */ -#define IEI_TDELSELIND 0x43 /* transit delay selection and indication */ -#define IEI_PLBPARMS 0x44 /* packet layer binary parameters */ -#define IEI_PLWSIZE 0x45 /* packet layer window size */ -#define IEI_PSIZE 0x46 /* packet size */ -#define IEI_CUG 0x47 /* closed user group */ -#define IEI_REVCHRGI 0x4a /* reverse charge indication */ -#define IEI_CALLINGPN 0x6c /* calling party number */ -#define IEI_CALLINGPS 0x6d /* calling party subaddress */ -#define IEI_CALLEDPN 0x70 /* called party number */ -#define IEI_CALLEDPS 0x71 /* called party subaddress */ -#define IEI_REDIRNO 0x74 /* redirecting number */ -#define IEI_TRNSEL 0x78 /* transit network selection */ -#define IEI_RESTARTI 0x79 /* restart indicator */ -#define IEI_LLCOMPAT 0x7c /* low layer compatibility */ -#define IEI_HLCOMPAT 0x7d /* high layer compatibility */ -#define IEI_USERUSER 0x7e /* user-user */ -#define IEI_ESCAPE 0x7f /* escape for extension */ - -/* Q.932 variable length information element identifiers */ - -#define IEI_EXTFAC 0x0d /* extended facility */ -#define IEI_FACILITY 0x1c /* facility */ -#define IEI_INFOREQ 0x32 /* information request */ -#define IEI_FEATACT 0x38 /* feature activation */ -#define IEI_FEATIND 0x39 /* feature indication */ -#define IEI_SERVPID 0x3a /* service profile identification */ -#define IEI_ENDPTID 0x3b /* endpoint identifier */ - -/* Q.933 variable length information element identifiers */ - -#define IEI_DATALCID 0x19 /* data link connection identifier */ -#define IEI_LLCOREP 0x48 /* link layer core parameters */ -#define IEI_LLPROTP 0x49 /* link layer protocol parameters */ -#define IEI_X213PRI 0x50 /* X.213 priority */ -#define IEI_REPORTT 0x51 /* report type */ -#define IEI_LNKITYVERF 0x53 /* link integrity verification */ -#define IEI_PVCSTAT 0x57 /* PVC status */ - -/* Q.95x variable length information element identifiers */ - -#define IEI_PRECLEV 0x41 /* precedence level */ -#define IEI_CONCTDNO 0x4c /* connected number */ -#define IEI_CONCTDSA 0x4d /* connected subaddress */ -#define IEI_REDICNNO 0x76 /* redirection number */ - -/* single octett information elements */ - -#define SOIE_SHIFT 0x90 /* shift codeset */ -#define SHIFT_LOCK 0x08 /* shift codeset, locking shift bit */ -#define SOIE_MDSC 0xa0 /* more data AND/OR sending complete */ -#define SOIE_SENDC 0xa1 /* sending complete */ -#define SOIE_CONGL 0xb0 /* congestion level */ -#define SOIE_REPTI 0xd0 /* repeat indicator */ - -/* codesets */ - -#define CODESET_0 0 /* codeset 0, normal DSS1 codeset */ - -/* Q.931/Q.932 message types (see Q.931 03/93 p10 and p311) */ - -/* call establishment messages */ - -#define ALERT 0x01 -#define CALL_PROCEEDING 0x02 -#define PROGRESS 0x03 -#define SETUP 0x05 -#define CONNECT 0x07 -#define SETUP_ACKNOWLEDGE 0x0d -#define CONNECT_ACKNOWLEDGE 0x0f - -/* call information phase messages */ - -#define USER_INFORMATION 0x20 -#define SUSPEND_REJECT 0x21 -#define RESUME_REJECT 0x22 -#define HOLD 0x24 -#define SUSPEND 0x25 -#define RESUME 0x26 -#define HOLD_ACKNOWLEDGE 0x28 -#define SUSPEND_ACKNOWLEDGE 0x2d -#define RESUME_ACKNOWLEDGE 0x2e -#define HOLD_REJECT 0x30 -#define RETRIEVE 0x31 -#define RETRIEVE_ACKNOWLEDGE 0x32 -#define RETRIEVE_REJECT 0x37 - -/* call clearing */ - -#define DISCONNECT 0x45 -#define RESTART 0x46 -#define RELEASE 0x4d -#define RESTART_ACKNOWLEDGE 0x4e -#define RELEASE_COMPLETE 0x5a - -/* misc messages */ - -#define SEGMENT 0x60 -#define FACILITY 0x62 -#define REGISTER 0x64 -#define NOTIFY 0x6e -#define STATUS_ENQUIRY 0x75 -#define CONGESTION_CONTROL 0x79 -#define INFORMATION 0x7b -#define STATUS 0x7d - -/* EOF */ - -#endif /* !_NETISDN_I4B_ISDBQ931_H_ */ diff --git a/sys/netisdn/i4b_isppp.c b/sys/netisdn/i4b_isppp.c deleted file mode 100644 index 9f0f7b1d7f1f..000000000000 --- a/sys/netisdn/i4b_isppp.c +++ /dev/null @@ -1,751 +0,0 @@ -/* - * Copyright (c) 1997 Joerg Wunsch. All rights reserved. - * - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_isppp.c - isdn4bsd kernel SyncPPP driver - * -------------------------------------------- - * - * Uses Serge Vakulenko's sppp backend (originally contributed with - * the "cx" driver for Cronyx's HDLC-in-hardware device). This driver - * is only the glue between sppp and i4b. - * - * $Id: i4b_isppp.c,v 1.32 2018/06/26 06:48:03 msaitoh Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_isppp.c,v 1.32 2018/06/26 06:48:03 msaitoh Exp $"); - -#ifndef __NetBSD__ -#define USE_ISPPP -#endif -#include "ippp.h" - -#ifndef USE_ISPPP - -#ifdef __FreeBSD__ -#include "sppp.h" -#endif - -#ifndef __NetBSD__ -#if NI4BISPPP == 0 -# error "You need to define `pseudo-device sppp ' with options ISPPP" -#endif -#endif - -#endif - -#include -/* - * XXX - sys/param.h on alpha (indirectly) includes sys/signal.h, which - * defines sc_sp - interfering with our use of this identifier. - * Just undef it for now. - */ -#undef sc_sp - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include - -#if defined(__FreeBSD_version) && __FreeBSD_version >= 400008 -#include "bpf.h" -#else -#define NBPFILTER 1 -#endif -#if NBPFILTER > 0 || NBPF > 0 -#include -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#include -#else -#include -#include -#include -#endif - -#include -#include -#include - -#include - -#ifdef __FreeBSD__ -#define ISPPP_FMT "ippp%d: " -#define ISPPP_ARG(sc) ((sc)->sc_if.if_unit) -#define PDEVSTATIC static - -# if __FreeBSD_version >= 300001 -# define CALLOUT_INIT(chan) callout_handle_init(chan) -# define TIMEOUT(fun, arg, chan, tick) chan = timeout(fun, arg, tick) -# define UNTIMEOUT(fun, arg, chan) untimeout(fun, arg, chan) -# define IOCTL_CMD_T u_long -# else -# define CALLOUT_INIT(chan) do {} while(0) -# define TIMEOUT(fun, arg, chan, tick) timeout(fun, arg, tick) -# define UNTIMEOUT(fun, arg, chan) untimeout(fun, arg) -# define IOCTL_CMD_T int -# endif - -#elif defined __NetBSD__ || defined __OpenBSD__ -#define ISPPP_FMT "%s: " -#define ISPPP_ARG(sc) ((sc)->sc_sp.pp_if.if_xname) -#define PDEVSTATIC /* not static */ -#define IOCTL_CMD_T u_long -#else -# error "What system are you using?" -#endif - -#ifdef __FreeBSD__ -PDEVSTATIC void ipppattach(void *); -PSEUDO_SET(ipppattach, i4b_isppp); -#else -PDEVSTATIC void ipppattach(void); -#endif - -#define I4BISPPPACCT 1 /* enable accounting messages */ -#define I4BISPPPACCTINTVL 2 /* accounting msg interval in secs */ -#define I4BISPPPDISCDEBUG 1 - -#define PPP_HDRLEN 4 /* 4 octetts PPP header length */ - -struct i4bisppp_softc { - struct sppp sc_sp; /* we are derived from struct sppp */ - - int sc_state; /* state of the interface */ - -#ifndef __FreeBSD__ - int sc_unit; /* unit number for Net/OpenBSD */ -#endif - - call_desc_t *sc_cdp; /* ptr to call descriptor */ - isdn_link_t *sc_ilt; /* B channel driver and state */ - -#ifdef I4BISPPPACCT - int sc_iinb; /* isdn driver # of inbytes */ - int sc_ioutb; /* isdn driver # of outbytes */ - int sc_inb; /* # of bytes rx'd */ - int sc_outb; /* # of bytes tx'd */ - int sc_linb; /* last # of bytes rx'd */ - int sc_loutb; /* last # of bytes tx'd */ - int sc_fn; /* flag, first null acct */ -#endif - -#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001 - struct callout_handle sc_ch; -#endif - -} i4bisppp_softc[NIPPP]; - -static int i4bisppp_ioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, void *data); - -#if 0 -static void i4bisppp_send(struct ifnet *ifp); -#endif - -static void i4bisppp_start(struct ifnet *ifp); - -#if 0 /* never used ??? */ -static void i4bisppp_timeout(void *cookie); -#endif - -static void i4bisppp_tls(struct sppp *sp); -static void i4bisppp_tlf(struct sppp *sp); -static void i4bisppp_state_changed(struct sppp *sp, int new_state); -static void i4bisppp_negotiation_complete(struct sppp *sp); -static void i4bisppp_watchdog(struct ifnet *ifp); -time_t i4bisppp_idletime(void *softc); -static void i4bisppp_rx_data_rdy(void *softc); -static void i4bisppp_tx_queue_empty(void *softc); -static void i4bisppp_activity(void *softc, int rxtx); -static void i4bisppp_connect(void *softc, void *cdp); -static void i4bisppp_disconnect(void *softc, void *cdp); -static void i4bisppp_dialresponse(void *softc, int status, cause_t cause); -static void i4bisppp_updown(void *softc, int updown); -static void* i4bisppp_ret_softc(int unit); -static void i4bisppp_set_linktab(void *softc, isdn_link_t *ilt); - -static const struct isdn_l4_driver_functions -ippp_l4_functions = { - /* L4<->B-channel functions */ - i4bisppp_rx_data_rdy, - i4bisppp_tx_queue_empty, - i4bisppp_activity, - i4bisppp_connect, - i4bisppp_disconnect, - i4bisppp_dialresponse, - i4bisppp_updown, - /* Management functions */ - i4bisppp_ret_softc, - i4bisppp_set_linktab, - i4bisppp_idletime -}; - -static int ippp_drvr_id = -1; - -enum i4bisppp_states { - ST_IDLE, /* initialized, ready, idle */ - ST_DIALING, /* dialling out to remote */ - ST_CONNECTED, /* connected to remote */ -}; - -/*===========================================================================* - * DEVICE DRIVER ROUTINES - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * interface attach routine at kernel boot time - *---------------------------------------------------------------------------*/ -PDEVSTATIC void -#ifdef __FreeBSD__ -ipppattach(void *dummy) -#else -ipppattach(void) -#endif -{ - struct i4bisppp_softc *sc = i4bisppp_softc; - int i; - - ippp_drvr_id = isdn_l4_driver_attach("ippp", NIPPP, &ippp_l4_functions); - - for(i = 0; i < NIPPP; sc++, i++) { - sc->sc_sp.pp_if.if_softc = sc; - sc->sc_ilt = NULL; - -#ifdef __FreeBSD__ - sc->sc_sp.pp_if.if_name = "ippp"; -#if defined(__FreeBSD_version) && __FreeBSD_version < 300001 - sc->sc_sp.pp_if.if_next = NULL; -#endif - sc->sc_sp.pp_if.if_unit = i; -#else - snprintf(sc->sc_sp.pp_if.if_xname, - sizeof(sc->sc_sp.pp_if.if_xname), "ippp%d", i); - sc->sc_unit = i; -#endif - - sc->sc_sp.pp_if.if_mtu = PP_MTU; - -#ifdef __NetBSD__ - sc->sc_sp.pp_if.if_flags = IFF_SIMPLEX | IFF_POINTOPOINT | - IFF_MULTICAST; -#else - sc->sc_sp.pp_if.if_flags = IFF_SIMPLEX | IFF_POINTOPOINT; -#endif - - sc->sc_sp.pp_if.if_type = IFT_ISDNBASIC; - sc->sc_state = ST_IDLE; - - sc->sc_sp.pp_if.if_ioctl = i4bisppp_ioctl; - - /* actually initialized by sppp_attach() */ - /* sc->sc_sp.pp_if.if_output = sppp_output; */ - - sc->sc_sp.pp_if.if_start = i4bisppp_start; - - sc->sc_sp.pp_if.if_hdrlen = 0; - sc->sc_sp.pp_if.if_addrlen = 0; - IFQ_SET_MAXLEN(&sc->sc_sp.pp_if.if_snd, IFQ_MAXLEN); - IFQ_SET_READY(&sc->sc_sp.pp_if.if_snd); - - sc->sc_sp.pp_if.if_ipackets = 0; - sc->sc_sp.pp_if.if_ierrors = 0; - sc->sc_sp.pp_if.if_opackets = 0; - sc->sc_sp.pp_if.if_oerrors = 0; - sc->sc_sp.pp_if.if_collisions = 0; - sc->sc_sp.pp_if.if_ibytes = 0; - sc->sc_sp.pp_if.if_obytes = 0; - sc->sc_sp.pp_if.if_imcasts = 0; - sc->sc_sp.pp_if.if_omcasts = 0; - sc->sc_sp.pp_if.if_iqdrops = 0; - sc->sc_sp.pp_if.if_noproto = 0; - -#if I4BISPPPACCT - sc->sc_sp.pp_if.if_timer = 0; - sc->sc_sp.pp_if.if_watchdog = i4bisppp_watchdog; - sc->sc_iinb = 0; - sc->sc_ioutb = 0; - sc->sc_inb = 0; - sc->sc_outb = 0; - sc->sc_linb = 0; - sc->sc_loutb = 0; - sc->sc_fn = 1; -#endif - - sc->sc_sp.pp_tls = i4bisppp_tls; - sc->sc_sp.pp_tlf = i4bisppp_tlf; - sc->sc_sp.pp_con = i4bisppp_negotiation_complete; - sc->sc_sp.pp_chg = i4bisppp_state_changed; - sc->sc_sp.pp_framebytes = 0; /* no framing added by hardware */ - -#if defined(__FreeBSD_version) && ((__FreeBSD_version >= 500009) || (410000 <= __FreeBSD_version && __FreeBSD_version < 500000)) - /* do not call bpfattach in ether_ifattach */ - ether_ifattach(&sc->sc_sp.pp_if, 0); -#else - if_attach(&sc->sc_sp.pp_if); -#ifndef USE_ISPPP - sc->sc_sp.pp_if._if_input = sppp_input; -#else - sc->sc_sp.pp_if._if_input = isppp_input; -#endif -#endif -#ifndef USE_ISPPP - sppp_attach(&sc->sc_sp.pp_if); -#else - isppp_attach(&sc->sc_sp.pp_if); -#endif - -#if NBPFILTER > 0 || NBPF > 0 -#ifdef __FreeBSD__ - bpfattach(&sc->sc_sp.pp_if, DLT_PPP, PPP_HDRLEN); - CALLOUT_INIT(&sc->sc_ch); -#endif /* __FreeBSD__ */ -#ifdef __NetBSD__ - bpf_attach(&sc->sc_sp.pp_if, DLT_PPP, sizeof(u_int)); -#endif -#endif - } -} - -/*---------------------------------------------------------------------------* - * process ioctl - *---------------------------------------------------------------------------*/ -static int -i4bisppp_ioctl(struct ifnet *ifp, unsigned long cmd, void *data) -{ - struct i4bisppp_softc *sc = ifp->if_softc; - -#ifndef USE_ISPPP - return sppp_ioctl(&sc->sc_sp.pp_if, cmd, data); -#else - return isppp_ioctl(&sc->sc_sp.pp_if, cmd, data); -#endif -} - -/*---------------------------------------------------------------------------* - * start output to ISDN B-channel - *---------------------------------------------------------------------------*/ -static void -i4bisppp_start(struct ifnet *ifp) -{ - struct i4bisppp_softc *sc = ifp->if_softc; - struct mbuf *m; - -#ifndef USE_ISPPP - if (sppp_isempty(ifp)) -#else - if (isppp_isempty(ifp)) -#endif - return; - - if(sc->sc_state != ST_CONNECTED) - return; - - /* - * s = splnet(); - * ifp->if_flags |= IFF_OACTIVE; // - need to clear this somewhere - * splx(s); - */ - -#ifndef USE_ISPPP - while ((m = sppp_dequeue(&sc->sc_sp.pp_if)) != NULL) -#else - while ((m = isppp_dequeue(&sc->sc_sp.pp_if)) != NULL) -#endif - { - -#if NBPFILTER > 0 || NBPF > 0 -#ifdef __FreeBSD__ - if (ifp->if_bpf) - bpf_mtap(ifp, m); -#endif /* __FreeBSD__ */ - -#ifdef __NetBSD__ - bpf_mtap(ifp, m, BPF_D_OUT); -#endif -#endif /* NBPFILTER > 0 || NBPF > 0 */ - - if(IF_QFULL(sc->sc_ilt->tx_queue)) - { - NDBGL4(L4_ISPDBG, "%s, tx queue full!", sc->sc_sp.pp_if.if_xname); - m_freem(m); - } - else - { -#if 0 - sc->sc_sp.pp_if.if_obytes += m->m_pkthdr.len; -#endif - sc->sc_outb += m->m_pkthdr.len; - sc->sc_sp.pp_if.if_opackets++; - IF_ENQUEUE(sc->sc_ilt->tx_queue, m); - } - } - sc->sc_ilt->bchannel_driver->bch_tx_start(sc->sc_ilt->l1token, - sc->sc_ilt->channel); -} - -#ifdef I4BISPPPACCT -/*---------------------------------------------------------------------------* - * watchdog routine - *---------------------------------------------------------------------------*/ -static void -i4bisppp_watchdog(struct ifnet *ifp) -{ - struct i4bisppp_softc *sc = ifp->if_softc; - bchan_statistics_t bs; - - (*sc->sc_ilt->bchannel_driver->bch_stat) - (sc->sc_ilt->l1token, sc->sc_ilt->channel, &bs); - - sc->sc_ioutb += bs.outbytes; - sc->sc_iinb += bs.inbytes; - - if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn) - { - int ri = (sc->sc_iinb - sc->sc_linb)/I4BISPPPACCTINTVL; - int ro = (sc->sc_ioutb - sc->sc_loutb)/I4BISPPPACCTINTVL; - - if((sc->sc_iinb == sc->sc_linb) && (sc->sc_ioutb == sc->sc_loutb)) - sc->sc_fn = 0; - else - sc->sc_fn = 1; - - sc->sc_linb = sc->sc_iinb; - sc->sc_loutb = sc->sc_ioutb; - - if (sc->sc_cdp) - i4b_l4_accounting(sc->sc_cdp->cdid, ACCT_DURING, - sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_outb, sc->sc_inb); - } - sc->sc_sp.pp_if.if_timer = I4BISPPPACCTINTVL; - -#if 0 /* old stuff, keep it around */ - printf(ISPPP_FMT "transmit timeout\n", ISPPP_ARG(sc)); - i4bisppp_start(ifp); -#endif -} -#endif /* I4BISPPPACCT */ - -/* - *===========================================================================* - * SyncPPP layer interface routines - *===========================================================================* - */ - -/*---------------------------------------------------------------------------* - * PPP this-layer-started action - *---------------------------------------------------------------------------* - */ -static void -i4bisppp_tls(struct sppp *sp) -{ - struct i4bisppp_softc *sc = sp->pp_if.if_softc; - - if(sc->sc_state == ST_CONNECTED) - return; - - i4b_l4_dialout(ippp_drvr_id, sc->sc_unit); -} - -/*---------------------------------------------------------------------------* - * PPP this-layer-finished action - *---------------------------------------------------------------------------* - */ -static void -i4bisppp_tlf(struct sppp *sp) -{ - struct i4bisppp_softc *sc = sp->pp_if.if_softc; - - if(sc->sc_state != ST_CONNECTED) - return; - - i4b_l4_drvrdisc(sc->sc_cdp->cdid); -} -/*---------------------------------------------------------------------------* - * PPP interface phase change - *---------------------------------------------------------------------------* - */ -static void -i4bisppp_state_changed(struct sppp *sp, int new_state) -{ - struct i4bisppp_softc *sc = sp->pp_if.if_softc; - - i4b_l4_ifstate_changed(sc->sc_cdp, new_state); -} - -/*---------------------------------------------------------------------------* - * PPP control protocol negotiation complete (run ip-up script now) - *---------------------------------------------------------------------------* - */ -static void -i4bisppp_negotiation_complete(struct sppp *sp) -{ - struct i4bisppp_softc *sc = sp->pp_if.if_softc; - - i4b_l4_negcomplete(sc->sc_cdp); -} - -/*===========================================================================* - * ISDN INTERFACE ROUTINES - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * this routine is called from L4 handler at connect time - *---------------------------------------------------------------------------*/ -static void -i4bisppp_connect(void *softc, void *cdp) -{ - struct i4bisppp_softc *sc = softc; - struct sppp *sp = &sc->sc_sp; - int s = splnet(); - - sc->sc_cdp = (call_desc_t *)cdp; - sc->sc_state = ST_CONNECTED; - -#if I4BISPPPACCT - sc->sc_iinb = 0; - sc->sc_ioutb = 0; - sc->sc_inb = 0; - sc->sc_outb = 0; - sc->sc_linb = 0; - sc->sc_loutb = 0; - sc->sc_sp.pp_if.if_timer = I4BISPPPACCTINTVL; -#endif - -#if 0 /* never used ??? */ - UNTIMEOUT(i4bisppp_timeout, (void *)sp, sc->sc_ch); -#endif - - sp->pp_up(sp); /* tell PPP we are ready */ -#ifndef __NetBSD__ - sp->pp_last_sent = sp->pp_last_recv = SECOND; -#endif - splx(s); -} - -/*---------------------------------------------------------------------------* - * this routine is called from L4 handler at disconnect time - *---------------------------------------------------------------------------*/ -static void -i4bisppp_disconnect(void *softc, void *cdp) -{ - call_desc_t *cd = (call_desc_t *)cdp; - struct i4bisppp_softc *sc = softc; - struct sppp *sp = &sc->sc_sp; - - int s = splnet(); - - /* new stuff to check that the active channel is being closed */ - if (cd != sc->sc_cdp) - { - NDBGL4(L4_ISPDBG, "%s: channel%d not active!", sp->pp_if.if_xname, - cd->channelid); - splx(s); - return; - } - -#if I4BISPPPACCT - sc->sc_sp.pp_if.if_timer = 0; -#endif - - i4b_l4_accounting(cd->cdid, ACCT_FINAL, - sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_outb, sc->sc_inb); - - if (sc->sc_state == ST_CONNECTED) - { -#if 0 /* never used ??? */ - UNTIMEOUT(i4bisppp_timeout, (void *)sp, sc->sc_ch); -#endif - sc->sc_cdp = (call_desc_t *)0; - /* do thhis here because pp_down calls i4bisppp_tlf */ - sc->sc_state = ST_IDLE; - sp->pp_down(sp); /* tell PPP we have hung up */ - } - - splx(s); -} - -/*---------------------------------------------------------------------------* - * this routine is used to give a feedback from userland demon - * in case of dial problems - *---------------------------------------------------------------------------*/ -static void -i4bisppp_dialresponse(void *softc, int status, cause_t cause) -{ - struct i4bisppp_softc *sc = softc; - - NDBGL4(L4_ISPDBG, "%s: status=%d, cause=%d", sc->sc_sp.pp_if.if_xname, status, cause); - - if(status != DSTAT_NONE) - { - struct mbuf *m; - - NDBGL4(L4_ISPDBG, "%s: clearing queues", sc->sc_sp.pp_if.if_xname); - -#ifndef USE_ISPPP - if(!(sppp_isempty(&sc->sc_sp.pp_if))) -#else - if(!(isppp_isempty(&sc->sc_sp.pp_if))) -#endif - { -#ifndef USE_ISPPP - while((m = sppp_dequeue(&sc->sc_sp.pp_if)) != NULL) -#else - while((m = isppp_dequeue(&sc->sc_sp.pp_if)) != NULL) -#endif - m_freem(m); - } - } -} - -/*---------------------------------------------------------------------------* - * interface up/down - *---------------------------------------------------------------------------*/ -static void -i4bisppp_updown(void *softc, int updown) -{ - (void)softc; - (void)updown; - /* could probably do something useful here */ -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * when a new frame (mbuf) has been received and was put on - * the rx queue. - *---------------------------------------------------------------------------*/ -static void -i4bisppp_rx_data_rdy(void *softc) -{ - struct i4bisppp_softc *sc = softc; - struct mbuf *m; - - if((m = *sc->sc_ilt->rx_mbuf) == NULL) - return; - - m_set_rcvif(m, &sc->sc_sp.pp_if); - m->m_pkthdr.len = m->m_len; - -#if I4BISPPPACCT - sc->sc_inb += m->m_pkthdr.len; -#endif - -#ifdef I4BISPPPDEBUG - printf("i4bisppp_rx_data_ready: received packet!\n"); -#endif - - if_percpuq_enqueue(sc->sc_sp.pp_if.if_percpuq, m); -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * when the last frame has been sent out and there is no - * further frame (mbuf) in the tx queue. - *---------------------------------------------------------------------------*/ -static void -i4bisppp_tx_queue_empty(void *softc) -{ - struct sppp *sp = &((struct i4bisppp_softc *)softc)->sc_sp; - i4bisppp_start(&sp->pp_if); -} - -/*---------------------------------------------------------------------------* - * THIS should be used instead of last_active_time to implement - * an activity timeout mechanism. - * - * Sending back the time difference unneccessarily complicates the - * idletime checks in i4b_l4.c. Return the largest time instead. - * That way the code in i4b_l4.c needs only minimal changes. - *---------------------------------------------------------------------------*/ -time_t -i4bisppp_idletime(void *softc) -{ - struct sppp *sp = &((struct i4bisppp_softc *)softc)->sc_sp; - - return sp->pp_last_activity; -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * each time a packet is received or transmitted. It should - * be used to implement an activity timeout mechanism. - *---------------------------------------------------------------------------*/ -static void -i4bisppp_activity(void *softc, int rxtx) -{ - struct i4bisppp_softc *sc = softc; - sc->sc_cdp->last_active_time = SECOND; -} - -/*---------------------------------------------------------------------------* - * return this drivers linktab address - *---------------------------------------------------------------------------*/ -static void * -i4bisppp_ret_softc(int unit) -{ - return &i4bisppp_softc[unit]; -} - -/*---------------------------------------------------------------------------* - * setup the isdn_linktab for this driver - *---------------------------------------------------------------------------*/ -static void -i4bisppp_set_linktab(void *softc, isdn_link_t *ilt) -{ - struct i4bisppp_softc *sc = softc; - sc->sc_ilt = ilt; -} - -/*===========================================================================*/ diff --git a/sys/netisdn/i4b_isppp.h b/sys/netisdn/i4b_isppp.h deleted file mode 100644 index 0c2647243e49..000000000000 --- a/sys/netisdn/i4b_isppp.h +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Defines for synchronous PPP/Cisco link level subroutines. - * - * Copyright (C) 1994 Cronyx Ltd. - * Author: Serge Vakulenko, - * - * Heavily revamped to conform to RFC 1661. - * Copyright (C) 1997, Joerg Wunsch. - * - * This software is distributed with NO WARRANTIES, not even the implied - * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Authors grant any other persons or organizations permission to use - * or modify this software as long as this message is kept with the software, - * all derivative works or modified versions. - * - * From: Version 2.0, Fri Oct 6 20:39:21 MSK 1995 - * - * From: if_sppp.h,v 1.14 1999/03/30 13:28:26 phk Exp - * - * $Id: i4b_isppp.h,v 1.4 2015/09/06 06:01:01 dholland Exp $ - */ - -#ifndef _NETISDN_I4B_ISPPP_H_ -#define _NETISDN_I4B_ISPPP_H_ - -#define SPPP_VJ /* use VJ compression */ - -#include - - -#ifdef SPPP_VJ -#if !(defined (KERNEL) || defined (_KERNEL)) -#ifdef __FreeBSD__ -#if 0 -/* - * this is needed on FreeBSD to make /usr/src/usr.bin/kdump and - * /usr/src/usr.bin/truss compile. - */ -#include -#endif -#include -#include -#include -#endif -#endif -#endif - -#define IDX_LCP 0 /* idx into state table */ - -struct slcp { - u_long opts; /* LCP options to send (bitfield) */ - u_long magic; /* local magic number */ - u_long mru; /* our max receive unit */ - u_long their_mru; /* their max receive unit */ - u_long protos; /* bitmask of protos that are started */ - u_char echoid; /* id of last keepalive echo request */ - /* restart max values, see RFC 1661 */ - int timeout; - int max_terminate; - int max_configure; - int max_failure; -}; - -#define IDX_IPCP 1 /* idx into state table */ - -struct sipcp { - u_long opts; /* IPCP options to send (bitfield) */ - u_int flags; -#define IPCP_HISADDR_SEEN 1 /* have seen his address already */ -#define IPCP_MYADDR_DYN 2 /* my address is dynamically assigned */ -#define IPCP_MYADDR_SEEN 4 /* have seen his address already */ -#define IPCP_VJ 8 /* We can use VJ compression */ - int max_state; /* Max-Slot-Id */ - int compress_cid; /* Comp-Slot-Id */ -}; - -#define AUTHNAMELEN 32 -#define AUTHKEYLEN 16 - -struct sauth { - u_short proto; /* authentication protocol to use */ - u_short flags; -#define AUTHFLAG_NOCALLOUT 1 /* do not require authentication on */ - /* callouts */ -#define AUTHFLAG_NORECHALLENGE 2 /* do not re-challenge CHAP */ - u_char name[AUTHNAMELEN]; /* system identification name */ - u_char secret[AUTHKEYLEN]; /* secret password */ - u_char challenge[AUTHKEYLEN]; /* random challenge */ -}; - -#define IDX_PAP 2 -#define IDX_CHAP 3 - -#define IDX_COUNT (IDX_CHAP + 1) /* bump this when adding cp's! */ - -/* - * Don't change the order of this. Ordering the phases this way allows - * for a comparision of ``pp_phase >= PHASE_AUTHENTICATE'' in order to - * know whether LCP is up. - */ -enum ppp_phase { - PHASE_DEAD, PHASE_ESTABLISH, PHASE_TERMINATE, - PHASE_AUTHENTICATE, PHASE_NETWORK -}; - -struct sppp { - /* NB: pp_if _must_ be first */ - struct ifnet pp_if; /* network interface data */ - struct ifqueue pp_fastq; /* fast output queue */ - struct ifqueue pp_cpq; /* PPP control protocol queue */ - struct sppp *pp_next; /* next interface in keepalive list */ - u_int pp_mode; /* major protocol modes (cisco/ppp/...) */ - u_int pp_flags; /* sub modes */ - u_short pp_alivecnt; /* keepalive packets counter */ - u_short pp_loopcnt; /* loopback detection counter */ - u_long pp_seq; /* local sequence number */ - u_long pp_rseq; /* remote sequence number */ - time_t pp_last_sent; - time_t pp_last_recv; - enum ppp_phase pp_phase; /* phase we're currently in */ - int state[IDX_COUNT]; /* state machine */ - u_char confid[IDX_COUNT]; /* id of last configuration request */ - int rst_counter[IDX_COUNT]; /* restart counter */ - int fail_counter[IDX_COUNT]; /* negotiation failure counter */ -#if defined(__FreeBSD__) && __FreeBSD__ >= 3 - struct callout_handle ch[IDX_COUNT]; /* per-proto and if callouts */ - struct callout_handle pap_my_to_ch; /* PAP needs one more... */ -#endif - struct slcp lcp; /* LCP params */ - struct sipcp ipcp; /* IPCP params */ - struct sauth myauth; /* auth params, i'm peer */ - struct sauth hisauth; /* auth params, i'm authenticator */ -#ifdef SPPP_VJ - int enable_vj; /* enable VJ negotiation */ - struct slcompress pp_comp; /* for VJ compression */ -#endif - /* - * These functions are filled in by sppp_attach(), and are - * expected to be used by the lower layer (hardware) drivers - * in order to communicate the (un)availability of the - * communication link. Lower layer drivers that are always - * ready to communicate (like hardware HDLC) can shortcut - * pp_up from pp_tls, and pp_down from pp_tlf. - */ - void (*pp_up)(struct sppp *sp); - void (*pp_down)(struct sppp *sp); - /* - * These functions need to be filled in by the lower layer - * (hardware) drivers if they request notification from the - * PPP layer whether the link is actually required. They - * correspond to the tls and tlf actions. - */ - void (*pp_tls)(struct sppp *sp); - void (*pp_tlf)(struct sppp *sp); - /* - * These (optional) functions may be filled by the hardware - * driver if any notification of established connections - * (currently: IPCP up) is desired (pp_con) or any internal - * state change of the interface state machine should be - * signaled for monitoring purposes (pp_chg). - */ - void (*pp_con)(struct sppp *sp); - void (*pp_chg)(struct sppp *sp, int new_state); - /* These two fields are for use by the lower layer */ - void *pp_lowerp; - int pp_loweri; -}; - -#define PP_KEEPALIVE 0x01 /* use keepalive protocol */ -#define PP_CALLIN 0x08 /* we are being called */ -#define PP_NEEDAUTH 0x10 /* remote requested authentication */ - - -#define PP_MTU 1500 /* default/minimal MRU */ -#define PP_MAX_MRU 2048 /* maximal MRU we want to negotiate */ - -/* - * Definitions to pass struct sppp data down into the kernel using the - * SIOC[SG]IFGENERIC ioctl interface. - * - * In order to use this, create a struct spppreq, fill in the cmd - * field with SPPPIOGDEFS, and put the address of this structure into - * the ifr_data portion of a struct ifreq. Pass this struct to a - * SIOCGIFGENERIC ioctl. Then replace the cmd field by SPPPIOCDEFS, - * modify the defs field as desired, and pass the struct ifreq now - * to a SIOCSIFGENERIC ioctl. - */ - -#define SPPPIOGDEFS ((void *)(('S' << 24) + (1 << 16) + sizeof(struct sppp))) -#define SPPPIOSDEFS ((void *)(('S' << 24) + (2 << 16) + sizeof(struct sppp))) - -struct spppreq { - u_long cmd; - struct sppp defs; -}; - -#ifndef SIOCSIFGENERIC -#define SIOCSIFGENERIC _IOW('i', 57, struct ifreq) /* generic IF set op */ -#endif - -#ifndef SIOCGIFGENERIC -#define SIOCGIFGENERIC _IOWR('i', 58, struct ifreq) /* generic IF get op */ -#endif - -#if defined(KERNEL) || defined(_KERNEL) - -#ifndef USE_ISPPP - -void sppp_attach (struct ifnet *ifp); -void sppp_detach (struct ifnet *ifp); -void sppp_input (struct ifnet *ifp, struct mbuf *m); - -#if defined(__FreeBSD_version) && __FreeBSD_version >= 300003 -int sppp_ioctl (struct ifnet *ifp, u_long cmd, void *data); -#else -#ifdef __FreeBSD__ -int sppp_ioctl (struct ifnet *ifp, int cmd, void *data); -#else -int sppp_ioctl (struct ifnet *ifp, u_long cmd, void *data); -#endif -#endif - -struct mbuf *sppp_dequeue (struct ifnet *ifp); -struct mbuf *sppp_pick(struct ifnet *ifp); -int sppp_isempty (struct ifnet *ifp); -void sppp_flush (struct ifnet *ifp); - -#else /* USE_ISPPP */ - -void isppp_attach (struct ifnet *ifp); -void isppp_detach (struct ifnet *ifp); -void isppp_input (struct ifnet *ifp, struct mbuf *m); - -#if defined(__FreeBSD_version) && __FreeBSD_version >= 300003 -int isppp_ioctl (struct ifnet *ifp, u_long cmd, void *data); -#else -#ifdef __FreeBSD__ -int isppp_ioctl (struct ifnet *ifp, int cmd, void *data); -#else -int isppp_ioctl (struct ifnet *ifp, u_long cmd, void *data); -#endif -#endif - -struct mbuf *isppp_dequeue (struct ifnet *ifp); -struct mbuf *isppp_pick(struct ifnet *ifp); -int isppp_isempty (struct ifnet *ifp); -void isppp_flush (struct ifnet *ifp); -#endif /* USE_ISPPP */ - -#endif /* KERNEL */ - -#endif /* !_NETISDN_I4B_ISPPP_H_ */ diff --git a/sys/netisdn/i4b_l1l2.h b/sys/netisdn/i4b_l1l2.h deleted file mode 100644 index e60f8a857dda..000000000000 --- a/sys/netisdn/i4b_l1l2.h +++ /dev/null @@ -1,85 +0,0 @@ -/* $NetBSD: i4b_l1l2.h,v 1.14 2014/10/18 08:33:29 snj Exp $ */ - -/*- - * Copyright (c) 2002 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Martin Husemann . - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _NETISDN_I4B_L1L2_H_ -#define _NETISDN_I4B_L1L2_H_ - -/* - * This file defines the D-channel interface between layer 1 (physical - * card hardware) and layer 2 of a passive ISDN card (i.e. a card that - * does not run its own ISDN stack in firmware). - * - * Since each layer 1 driver knows in advance it will need to attach - * to this layer 2, the whole layer 2 softc struct is typically included - * in the layer 1 softc. - * - * A back-pointer to the layer 1 softc is included (as void*) in this - * structure. - */ - -typedef void *isdn_layer1token; - -/* - * Each driver attaching to layer 2 via this interface provides a pointer - * to a struct of function pointers used to communicate with layer 1, while - * layer 1 calls layer 2 functions directly (see below). - * - * Layer 1 functions called from layer 2: - */ -struct isdn_layer1_isdnif_driver { - /* Request to transmit data. */ - int (*ph_data_req)(isdn_layer1token, struct mbuf *, int); - - /* Request to activate layer 1. */ - int (*ph_activate_req)(isdn_layer1token); - - /* Request to execute an internal command. */ - int (*mph_command_req)(isdn_layer1token, int, void *); -}; - -/* - * Layer 2 functions called by layer 1: - */ - -/* Process a rx'd frame */ -int isdn_layer2_data_ind(struct l2_softc * t, struct isdn_l3_driver *, struct mbuf *m); - -/* Pass a layer 1 activation/deactivation to layer 2. */ -int isdn_layer2_activate_ind(struct l2_softc *, struct isdn_l3_driver *, int); - -/* Pass trace data to layer 2. */ -struct i4b_trace_hdr; /* from i4b_trace.h */ -int isdn_layer2_trace_ind(struct l2_softc *, struct isdn_l3_driver *, struct i4b_trace_hdr *, size_t, unsigned char *); - -/* Pass status informations to layer 2. */ -int isdn_layer2_status_ind(struct l2_softc *, struct isdn_l3_driver *, int, int); - -#endif /* !_NETISDN_I4B_L1L2_H_ */ diff --git a/sys/netisdn/i4b_l2.c b/sys/netisdn/i4b_l2.c deleted file mode 100644 index 0a2a855adcc1..000000000000 --- a/sys/netisdn/i4b_l2.c +++ /dev/null @@ -1,403 +0,0 @@ -/* $NetBSD: i4b_l2.c,v 1.24 2008/07/20 01:05:27 martin Exp $ */ - -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_l2.c - ISDN layer 2 (Q.921) - * ------------------------------- - * - * $Id: i4b_l2.c,v 1.24 2008/07/20 01:05:27 martin Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_l2.c,v 1.24 2008/07/20 01:05:27 martin Exp $"); - -#ifdef __FreeBSD__ -#include "i4bq921.h" -#else -#define NI4BQ921 1 -#endif -#if NI4BQ921 > 0 - -#include -#include -#include -#include -#include -#include - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#else -#include -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include - -/* this layers debug level */ - -unsigned int i4b_l2_debug = L2_DEBUG_DEFAULT; - -/*---------------------------------------------------------------------------* - * DL_ESTABLISH_REQ from layer 3 - *---------------------------------------------------------------------------*/ -int i4b_dl_establish_req(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_PRIM, "isdnif %d", l2sc->drv->isdnif); - i4b_l1_activate(l2sc); - i4b_next_l2state(l2sc, drv, EV_DLESTRQ); - return(0); -} - -/*---------------------------------------------------------------------------* - * DL_RELEASE_REQ from layer 3 - *---------------------------------------------------------------------------*/ -int i4b_dl_release_req(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_PRIM, "isdnif %d", l2sc->drv->isdnif); - i4b_next_l2state(l2sc, drv, EV_DLRELRQ); - return(0); -} - -/*---------------------------------------------------------------------------* - * DL UNIT DATA REQUEST from Layer 3 - *---------------------------------------------------------------------------*/ -int i4b_dl_unit_data_req(l2_softc_t *l2sc, struct isdn_l3_driver *drv, struct mbuf *m) -{ -#ifdef NOTDEF - NDBGL2(L2_PRIM, "isdnif %d", l2sc->isdnif); -#endif - return(0); -} - -/*---------------------------------------------------------------------------* - * DL DATA REQUEST from Layer 3 - *---------------------------------------------------------------------------*/ -int i4b_dl_data_req(l2_softc_t *l2sc, struct isdn_l3_driver *drv, struct mbuf *m) -{ - switch(l2sc->Q921_state) - { - case ST_AW_EST: - case ST_MULTIFR: - case ST_TIMREC: - - if(IF_QFULL(&l2sc->i_queue)) - { - NDBGL2(L2_ERROR, "i_queue full!!"); - i4b_Dfreembuf(m); - } - else - { - int s; - - s = splnet(); - IF_ENQUEUE(&l2sc->i_queue, m); - splx(s); - - i4b_i_frame_queued_up(l2sc); - } - break; - - default: - NDBGL2(L2_ERROR, "isdnif %d ERROR in state [%s], freeing mbuf", l2sc->drv->isdnif, i4b_print_l2state(l2sc)); - i4b_Dfreembuf(m); - break; - } - return(0); -} - -/*---------------------------------------------------------------------------* - * isdn_layer2_activate_ind - link activation/deactivation indication from layer 1 - *---------------------------------------------------------------------------*/ -int -isdn_layer2_activate_ind(struct l2_softc *l2sc, struct isdn_l3_driver *drv, int event_activate) -{ - if (event_activate) { - l2sc->ph_active = PH_ACTIVE; - } else { - l2sc->ph_active = PH_INACTIVE; - } - return(0); -} - -/*---------------------------------------------------------------------------* - * i4b_l2_unit_init - place layer 2 unit into known state - *---------------------------------------------------------------------------*/ -static void -i4b_l2_unit_init(l2_softc_t *l2sc) -{ - int s; - - s = splnet(); - l2sc->Q921_state = ST_TEI_UNAS; - l2sc->tei_valid = TEI_INVALID; - l2sc->vr = 0; - l2sc->vs = 0; - l2sc->va = 0; - l2sc->ack_pend = 0; - l2sc->rej_excpt = 0; - l2sc->peer_busy = 0; - l2sc->own_busy = 0; - l2sc->l3initiated = 0; - - l2sc->rxd_CR = 0; - l2sc->rxd_PF = 0; - l2sc->rxd_NR = 0; - l2sc->RC = 0; - l2sc->iframe_sent = 0; - - l2sc->postfsmfunc = NULL; - - if(l2sc->ua_num != UA_EMPTY) - { - i4b_Dfreembuf(l2sc->ua_frame); - l2sc->ua_num = UA_EMPTY; - l2sc->ua_frame = NULL; - } - - i4b_T200_stop(l2sc); - i4b_T202_stop(l2sc); - i4b_T203_stop(l2sc); - - splx(s); -} - -/*---------------------------------------------------------------------------* - * isdn_layer2_status_ind - status indication upward - *---------------------------------------------------------------------------*/ -int -isdn_layer2_status_ind(l2_softc_t *l2sc, struct isdn_l3_driver *drv, int status, int parm) -{ - int s; - int sendup = 1; - - s = splnet(); - - NDBGL2(L2_PRIM, "isdnif %d, status=%d, parm=%d", l2sc->drv->isdnif, status, parm); - - switch(status) - { - case STI_ATTACH: - if (parm == 0) { - /* detach */ - callout_stop(&l2sc->T200_callout); - callout_stop(&l2sc->T202_callout); - callout_stop(&l2sc->T203_callout); - callout_stop(&l2sc->IFQU_callout); - break; - } - - l2sc->i_queue.ifq_maxlen = IQUEUE_MAXLEN; - l2sc->ua_frame = NULL; - memset(&l2sc->stat, 0, sizeof(lapdstat_t)); - - /* initialize the callout handles for timeout routines */ - callout_init(&l2sc->T200_callout, 0); - callout_init(&l2sc->T202_callout, 0); - callout_init(&l2sc->T203_callout, 0); - callout_init(&l2sc->IFQU_callout, 0); - - i4b_l2_unit_init(l2sc); - break; - - case STI_L1STAT: /* state of layer 1 */ - break; - - case STI_PDEACT: /* Timer 4 expired */ -/*XXX*/ if((l2sc->Q921_state >= ST_AW_EST) && - (l2sc->Q921_state <= ST_TIMREC)) - { - NDBGL2(L2_ERROR, "isdnif %d, persistent deactivation!", l2sc->drv->isdnif); - i4b_l2_unit_init(l2sc); - parm = -1; /* this is passed as the new - * TEI to upper layers */ - } - else - { - sendup = 0; - } - break; - - case STI_NOL1ACC: - i4b_l2_unit_init(l2sc); - NDBGL2(L2_ERROR, "isdnif %d, cannot access S0 bus!", l2sc->drv->isdnif); - break; - - default: - NDBGL2(L2_ERROR, "ERROR, isdnif %d, unknown status message!", l2sc->drv->isdnif); - break; - } - - if(sendup) - i4b_mdl_status_ind(l2sc->drv, status, parm); /* send up to layer 3 */ - - splx(s); - - return(0); -} - -/*---------------------------------------------------------------------------* - * MDL_COMMAND_REQ from layer 3 - *---------------------------------------------------------------------------*/ -int i4b_mdl_command_req(struct isdn_l3_driver *drv, int command, void *parm) -{ - struct l2_softc *sc = (l2_softc_t*)drv->l1_token; - - NDBGL2(L2_PRIM, "isdnif %d, command=%d, parm=%p", drv->isdnif, command, parm); - - switch(command) - { - case CMR_DOPEN: - i4b_l2_unit_init(sc); - /* XXX - enable interrupts */ - break; - case CMR_DCLOSE: - /* XXX - disable interrupts */ - break; - } - - /* pass down to layer 1 driver */ - if (sc->driver) - sc->driver->mph_command_req(sc->l1_token, command, parm); - - return(0); -} - -/*---------------------------------------------------------------------------* - * isdn_layer2_data_ind - process a rx'd frame got from layer 1 - *---------------------------------------------------------------------------*/ -int -isdn_layer2_data_ind(l2_softc_t *l2sc, struct isdn_l3_driver *drv, struct mbuf *m) -{ - u_char *ptr = m->m_data; - - if ( (*(ptr + OFF_CNTL) & 0x01) == 0 ) - { - if(m->m_len < 4) /* 6 oct - 2 chksum oct */ - { - l2sc->stat.err_rx_len++; - NDBGL2(L2_ERROR, "ERROR, I-frame < 6 octetts!"); - i4b_Dfreembuf(m); - return(0); - } - i4b_rxd_i_frame(l2sc, drv, m); - } - else if ( (*(ptr + OFF_CNTL) & 0x03) == 0x01 ) - { - if(m->m_len < 4) /* 6 oct - 2 chksum oct */ - { - l2sc->stat.err_rx_len++; - NDBGL2(L2_ERROR, "ERROR, S-frame < 6 octetts!"); - i4b_Dfreembuf(m); - return(0); - } - i4b_rxd_s_frame(l2sc, drv, m); - } - else if ( (*(ptr + OFF_CNTL) & 0x03) == 0x03 ) - { - if(m->m_len < 3) /* 5 oct - 2 chksum oct */ - { - l2sc->stat.err_rx_len++; - NDBGL2(L2_ERROR, "ERROR, U-frame < 5 octetts!"); - i4b_Dfreembuf(m); - return(0); - } - i4b_rxd_u_frame(l2sc, drv, m); - } - else - { - l2sc->stat.err_rx_badf++; - NDBGL2(L2_ERROR, "ERROR, bad frame rx'd - "); - i4b_print_frame(m->m_len, m->m_data); - i4b_Dfreembuf(m); - } - return(0); -} - -int i4b_l2_channel_get_state(struct isdn_l3_driver *drv, int b_chanid) -{ - l2_softc_t *sc = drv->l1_token; - return sc->bchan_state[b_chanid]; -} - -void i4b_l2_channel_set_state(struct isdn_l3_driver *drv, int b_chanid, int state) -{ - l2_softc_t *sc = drv->l1_token; - sc->bchan_state[b_chanid] = state; -} - -/*---------------------------------------------------------------------------* - * telephony silence detection - *---------------------------------------------------------------------------*/ - -#define TEL_IDLE_MIN (BCH_MAX_DATALEN/2) - -int -isdn_bchan_silence(unsigned char *data, int len) -{ - register int i = 0; - register int j = 0; - - /* count idle bytes */ - - for(;i < len; i++) - { - if((*data >= 0xaa) && (*data <= 0xac)) - j++; - data++; - } - -#ifdef NOTDEF - printf("isic_hscx_silence: got %d silence bytes in frame\n", j); -#endif - - if(j < (TEL_IDLE_MIN)) - return(0); - else - return(1); - -} - - -#endif /* NI4BQ921 > 0 */ diff --git a/sys/netisdn/i4b_l2.h b/sys/netisdn/i4b_l2.h deleted file mode 100644 index b1ccc7db6aed..000000000000 --- a/sys/netisdn/i4b_l2.h +++ /dev/null @@ -1,367 +0,0 @@ -/* $NetBSD: i4b_l2.h,v 1.14 2009/03/14 14:46:11 dsl Exp $ */ - -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_l2.h - ISDN layer 2 (Q.921) definitions - * --------------------------------------------- - * - * $Id: i4b_l2.h,v 1.14 2009/03/14 14:46:11 dsl Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Sat Mar 18 10:28:22 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _NETISDN_I4B_L2_H_ -#define _NETISDN_I4B_L2_H_ - -typedef struct l2_softc { - const struct isdn_layer1_isdnif_driver * driver; - void* l1_token; - struct isdn_l3_driver *drv; - - int Q921_state; /* state according to Q.921 */ - - u_char last_ril; /* last reference number from TEI management */ - u_char last_rih; - - int tei_valid; /* tei is valid flag */ -#define TEI_INVALID 0 -#define TEI_VALID 1 - int tei; /* tei, if tei flag valid */ - - int ph_active; /* Layer 1 active flag */ -#define PH_INACTIVE 0 /* layer 1 inactive */ -#define PH_ACTIVEPEND 1 /* already tried to activate */ -#define PH_ACTIVE 2 /* layer 1 active */ - - int T200; /* Multiframe timeout timer */ - int T201; /* min time between TEI ID check */ - int T202; /* min time between TEI ID Req messages */ - int N202; /* TEI ID Req tx counter */ - void(*T202func)(void *);/* function to be called when T202 expires */ - int T203; /* max line idle time */ - struct callout T200_callout; - struct callout T202_callout; - struct callout T203_callout; - struct callout IFQU_callout; - -/* - * i4b_iframe.c, i4b_i_frame_queued_up(): value of IFQU_DLY - * some experimentation Gary did showed a minimal value of (hz/20) was - * possible to let this work, Gary suggested using (hz/10) but i settled - * down to using (hz/5) for now (-hm). - */ -#define IFQU_DLY (hz/5) /* reschedule I-FRAME-QUEUED-UP 0.2 sec */ - - int vr; /* receive sequence frame counter */ - int vs; /* transmit sequence frame counter */ - int va; /* acknowledge sequence frame counter */ - - int ack_pend; /* acknowledge pending */ - int rej_excpt; /* reject exception */ - int peer_busy; /* peer receiver busy */ - int own_busy; /* own receiver busy */ - int l3initiated; /* layer 3 initiated */ - - int bchan_state[2]; - - struct ifqueue i_queue; /* queue of outgoing i frames */ -#define IQUEUE_MAXLEN 20 - - /* this implementation only supports a k-value of 1 !!! */ - struct mbuf *ua_frame; /* last unacked frame */ - int ua_num; /* last unacked frame number */ -#define UA_EMPTY (-1) /* ua_frame is unused */ - - int rxd_CR; /* received Command Response bit */ - int rxd_PF; /* received Poll/Final bit */ - int rxd_NR; /* received N(R) field */ - int RC; /* Retry Counter */ - - int iframe_sent; /* check if i frame acked by another i frame */ - - int (*postfsmfunc)(struct isdn_l3_driver *drv);/* function to be called at fsm exit */ - struct isdn_l3_driver *postfsmarg; /* argument for above function */ - - /* statistics */ - - lapdstat_t stat; /* lapd protocol statistics */ - -} l2_softc_t; - -/* Q.912 system parameters (Q.921 03/93 pp 43) */ - -#define MAX_K_VALUE 1 /* BRI - # of outstanding frames */ - -#define N200 3 /* max no of retransmissions */ -#define N201DEF 260 /* max no of octetts in information field */ -#define N202DEF 3 /* max no of TEI ID Request message transmissions */ - -#define T200DEF (hz*1) /* default T200 timer value = 1 second */ -#define T201DEF T200DEF /* default T201 timer value = T200DEF */ -#define T202DEF (hz*2) /* default T202 timer value = 2 seconds */ -#define T203DEF (hz*10) /* default T203 timer value = 10 seconds*/ - -/* modulo 128 operations */ - -#define M128INC(v) (v)++; \ - if((v)>127) \ - { \ - v = 0; \ - } - -#define M128DEC(v) (v)--; \ - if((v)<0) \ - { \ - v = 127;\ - } - -/* P-bit values */ - -typedef enum { - P0, - P1 -} pbit_t; - -/* F-bit values */ - -typedef enum { - F0, - F1 -} fbit_t; - -/* CR-bit values to NT */ - -typedef enum { - CR_CMD_TO_NT, - CR_RSP_TO_NT -} crbit_to_nt_t; - -/* CR-bit values from NT */ - -typedef enum { - CR_RSP_FROM_NT, - CR_CMD_FROM_NT -} crbit_from_nt_t; - -/* address field - octett 2 */ - -#define OFF_SAPI 0 /* SAPI offset, HDLC flag is eaten by L1 */ -#define SAPI_CCP 0 /* SAPI = 0 - call control procedures */ -#define SAPI_X25 16 /* SAPI = 16 - X.25 packet procedures */ -#define SAPI_L2M 63 /* SAPI = 63 - Layer 2 management procedures */ - -/* extract and insert macros for SAPI octett */ - -#define GETSAPI(octett) (((octett) >> 2) & 0x3f) -#define PUTSAPI(sapi,cr,octett) ((octett) = (((sapi << 2) & 0xfc) | ((cr & 0x01) << 1))) -#define GETCR(octett) (((octett) >> 1) & 0x01) -#define GETEA(octett) ((octett) & 0x01) - -/* address field - octett 3 */ - -#define OFF_TEI 1 /* TEI offset */ -#define GETTEI(octett) (((octett) >> 1) & 0x7f) -#define PUTTEI(tei, octett) ((octett) = ((((tei) << 1) & 0xfe)) | 0x01) -#define GROUP_TEI 127 /* broadcast TEI for LME */ - -/* control field - octett 4 */ - -#define OFF_CNTL 2 /* 1st byte of control field */ - -/* S frames */ - -#define S_FRAME_LEN 4 /* length of a U-frame */ -#define OFF_SRCR 2 /* 1st byte of control field, */ - /* R-commands and R-responses */ -#define OFF_SNR 3 /* 2nd byte of control field, N(R) and PF */ -#define SPFBIT 0x01 /* poll/final bit mask */ -#define SPBITSET SPFBIT -#define SFBITSET SPFBIT -#define GETSNR(octett) (((octett) >> 1) & 0x7f) -#define GETSPF(octett) ((octett) & SPFBIT) -#define RR 0x01 /* RR and bit 0 set */ -#define RNR 0x05 /* RNR and bit 0 set */ -#define REJ 0x09 /* REJ and bit 0 set */ - -/* U frames */ - -#define UI_HDR_LEN 3 /* length of UI header in front of L3 frame */ -#define U_FRAME_LEN 3 /* length of a U-frame */ -#define UPFBIT 0x10 /* poll/final bit mask */ -#define UPBITSET UPFBIT -#define UFBITSET UPFBIT -#define GETUPF(octett) (((octett) >> 4) & 0x01) - -/* commands/responses with pf bit set to 0 */ - -#define SABME 0x6f -#define DM 0x0f -#define UI 0x03 -#define DISC 0x43 -#define UA 0x63 -#define FRMR 0x87 -#define XID 0xaf - -/* control field - octett 3 */ - -#define OFF_MEI 3 /* 2nd byte of control field */ - -/* control field - octett 4,5 */ - -#define OFF_RIL 4 /* Ri low byte */ -#define OFF_RIH 5 /* Ri high byte */ - -/* control field - octett 6 */ - -#define OFF_MT 6 /* Message Type */ -#define OFF_AI 7 /* Action Indicator */ -#define GET_TEIFROMAI(octett) (((octett) >> 1) & 0x7f) - -/* I frame */ - -#define I_HDR_LEN 4 /* length of I header in front of L3 frame */ -#define OFF_INS 2 /* transmit sequence number */ -#define OFF_INR 3 /* receive sequence number */ -#define IPFBIT 0x01 /* poll/final bit mask */ -#define IPBITSET 0x01 -#define GETINR(octett) (((octett) >> 1) & 0x7f) -#define GETINS(octett) (((octett) >> 1) & 0x7f) -#define GETIP(octett) ((octett) & IPFBIT) - -/* structure of a TEI management frame */ - -#define TEI_MGMT_FRM_LEN 8 /* frame length */ -#define TEIM_SAPIO 0x00 /* SAPI, CR, EA */ -#define TEIM_TEIO 0x01 /* TEI, EA */ -#define TEIM_UIO 0x02 /* frame type = UI = 0x03 */ -#define TEIM_MEIO 0x03 /* management entity id = 0x0f */ -#define MEI 0x0f -#define TEIM_RILO 0x04 /* reference number, low */ -#define TEIM_RIHO 0x05 /* reference number, high */ -#define TEIM_MTO 0x06 /* message type */ -#define MT_ID_REQEST 0x01 -#define MT_ID_ASSIGN 0x02 -#define MT_ID_DENY 0x03 -#define MT_ID_CHK_REQ 0x04 -#define MT_ID_CHK_RSP 0x05 -#define MT_ID_REMOVE 0x06 -#define MT_ID_VERIFY 0x07 -#define TEIM_AIO 0x07 /* action indicator */ - -/* i4b_mdl_error_ind codes */ - -enum MDL_ERROR_CODES { - MDL_ERR_A, - MDL_ERR_B, - MDL_ERR_C, - MDL_ERR_D, - MDL_ERR_E, - MDL_ERR_F, - MDL_ERR_G, - MDL_ERR_H, - MDL_ERR_I, - MDL_ERR_J, - MDL_ERR_K, - MDL_ERR_L, - MDL_ERR_M, - MDL_ERR_N, - MDL_ERR_O, - MDL_ERR_MAX -}; - -/* forward decl */ -struct isdn_l3_driver; -extern void i4b_acknowledge_pending ( l2_softc_t *l2sc ); -extern struct mbuf * i4b_build_s_frame ( l2_softc_t *l2sc, crbit_to_nt_t crbit, pbit_t pbit, u_char type ); -extern struct mbuf * i4b_build_u_frame ( l2_softc_t *l2sc, crbit_to_nt_t crbit, pbit_t pbit, u_char type ); -extern void i4b_clear_exception_conditions ( l2_softc_t *l2sc ); -extern int i4b_dl_data_req ( l2_softc_t*, struct isdn_l3_driver *drv, struct mbuf *m ); -extern int i4b_dl_establish_req ( l2_softc_t*, struct isdn_l3_driver *drv ); -extern int i4b_dl_release_req ( l2_softc_t*, struct isdn_l3_driver *drv ); -extern int i4b_dl_unit_data_req ( l2_softc_t*, struct isdn_l3_driver *drv, struct mbuf *m ); -extern void i4b_enquiry_response ( l2_softc_t *l2sc ); -extern void i4b_establish_data_link ( l2_softc_t *l2sc ); -extern void i4b_invoke_retransmission ( l2_softc_t *l2sc, int nr ); -extern void i4b_i_frame_queued_up ( l2_softc_t *l2sc ); -extern void i4b_l1_activate ( l2_softc_t *l2sc ); -extern int i4b_l2_nr_ok ( int nr, int va, int vs ); -extern void i4b_make_rand_ri ( l2_softc_t *l2sc ); -extern void i4b_mdl_assign_ind ( l2_softc_t *l2sc ); -extern void i4b_mdl_error_ind ( l2_softc_t *l2sc, const char *where, int errorcode ); -extern void i4b_next_l2state ( l2_softc_t *l2sc, struct isdn_l3_driver *drv, int event ); -extern void i4b_nr_error_recovery ( l2_softc_t *l2sc ); -extern int i4b_ph_activate_ind ( l2_softc_t* ); -extern int i4b_ph_deactivate_ind ( l2_softc_t* ); -extern void i4b_print_frame ( int len, u_char *buf ); -extern const char *i4b_print_l2state ( l2_softc_t *l2sc ); -extern void i4b_print_l2var ( l2_softc_t *l2sc ); -extern void i4b_rxd_ack(l2_softc_t *l2sc, struct isdn_l3_driver *drv, int nr); -extern void i4b_rxd_i_frame ( l2_softc_t *, struct isdn_l3_driver *drv, struct mbuf *m ); -extern void i4b_rxd_s_frame ( l2_softc_t *, struct isdn_l3_driver *drv, struct mbuf *m ); -extern void i4b_rxd_u_frame ( l2_softc_t *, struct isdn_l3_driver *drv, struct mbuf *m ); -extern void i4b_T200_restart ( l2_softc_t *l2sc ); -extern void i4b_T200_start ( l2_softc_t *l2sc ); -extern void i4b_T200_stop ( l2_softc_t *l2sc ); -extern void i4b_T202_start ( l2_softc_t *l2sc ); -extern void i4b_T202_stop ( l2_softc_t *l2sc ); -extern void i4b_T203_restart ( l2_softc_t *l2sc ); -extern void i4b_T203_start ( l2_softc_t *l2sc ); -extern void i4b_T203_stop ( l2_softc_t *l2sc ); -extern void i4b_tei_assign ( l2_softc_t *l2sc ); -extern void i4b_tei_chkresp ( l2_softc_t *l2sc ); -extern void i4b_tei_rxframe ( l2_softc_t *, struct isdn_l3_driver *, struct mbuf *m ); -extern void i4b_tei_verify ( l2_softc_t *l2sc ); -extern void i4b_transmit_enquire ( l2_softc_t *l2sc ); -extern void i4b_tx_disc ( l2_softc_t *l2sc, pbit_t pbit ); -extern void i4b_tx_dm ( l2_softc_t *l2sc, fbit_t fbit ); -extern void i4b_tx_frmr ( l2_softc_t *l2sc, fbit_t fbit ); -extern void i4b_tx_rej_response ( l2_softc_t *l2sc, fbit_t fbit ); -extern void i4b_tx_rnr_command ( l2_softc_t *l2sc, pbit_t pbit ); -extern void i4b_tx_rnr_response ( l2_softc_t *l2sc, fbit_t fbit ); -extern void i4b_tx_rr_command ( l2_softc_t *l2sc, pbit_t pbit ); -extern void i4b_tx_rr_response ( l2_softc_t *l2sc, fbit_t fbit ); -extern void i4b_tx_sabme ( l2_softc_t *l2sc, pbit_t pbit ); -extern void i4b_tx_ua ( l2_softc_t *l2sc, fbit_t fbit ); - -struct isdn_l3_driver; -extern int i4b_l2_channel_get_state(struct isdn_l3_driver *drv, int b_chanid); -extern void i4b_l2_channel_set_state(struct isdn_l3_driver *drv, int b_chanid, int state); -extern int i4b_mdl_status_ind ( struct isdn_l3_driver *drv, int status, int parm); -extern int i4b_dl_release_ind ( struct isdn_l3_driver *drv ); -extern int i4b_dl_establish_ind ( struct isdn_l3_driver *drv ); -extern int i4b_dl_release_cnf ( struct isdn_l3_driver *drv ); -extern int i4b_dl_establish_cnf ( struct isdn_l3_driver *drv ); -extern int i4b_dl_unit_data_ind ( struct isdn_l3_driver *drv, struct mbuf *m ); -extern int i4b_dl_data_ind ( struct isdn_l3_driver *drv, struct mbuf *m ); -int i4b_mdl_command_req(struct isdn_l3_driver *drv, int, void *); -void *isdn_find_softc_by_isdnif(int isdnif); -extern int isdn_bchan_silence( unsigned char *data, int len ); - -#endif /* !_NETISDN_I4B_L2_H_ */ diff --git a/sys/netisdn/i4b_l2fsm.c b/sys/netisdn/i4b_l2fsm.c deleted file mode 100644 index 595588cf7505..000000000000 --- a/sys/netisdn/i4b_l2fsm.c +++ /dev/null @@ -1,1602 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_l2fsm.c - layer 2 FSM - * ------------------------- - * - * $Id: i4b_l2fsm.c,v 1.13 2009/03/14 14:46:11 dsl Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_l2fsm.c,v 1.13 2009/03/14 14:46:11 dsl Exp $"); - -#ifdef __FreeBSD__ -#include "i4bq921.h" -#else -#define NI4BQ921 1 -#endif -#if NI4BQ921 > 0 - -#include -#include -#include -#include -#include -#include - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#else -#include -#include -#endif - -#include -#include -#include -#include -#include - -#include - - -#if DO_I4B_DEBUG -static const char *l2state_text[N_STATES] = { - "ST_TEI_UNAS", - "ST_ASG_AW_TEI", - "ST_EST_AW_TEI", - "ST_TEI_ASGD", - - "ST_AW_EST", - "ST_AW_REL", - "ST_MULTIFR", - "ST_TIMREC", - - "ST_SUBSET", - "Illegal State" -}; - -static const char *l2event_text[N_EVENTS] = { - "EV_DLESTRQ", - "EV_DLUDTRQ", - "EV_MDASGRQ", - "EV_MDERRRS", - "EV_PSDEACT", - "EV_MDREMRQ", - "EV_RXSABME", - "EV_RXDISC", - "EV_RXUA", - "EV_RXDM", - "EV_T200EXP", - "EV_DLDATRQ", - "EV_DLRELRQ", - "EV_T203EXP", - "EV_OWNBUSY", - "EV_OWNRDY", - "EV_RXRR", - "EV_RXREJ", - "EV_RXRNR", - "EV_RXFRMR", - "Illegal Event" -}; -#endif - -static void F_TU01(l2_softc_t *, struct isdn_l3_driver *); -static void F_TU03(l2_softc_t *, struct isdn_l3_driver *); - -static void F_TA03(l2_softc_t *, struct isdn_l3_driver *); -static void F_TA04(l2_softc_t *, struct isdn_l3_driver *); -static void F_TA05(l2_softc_t *, struct isdn_l3_driver *); - -static void F_TE03(l2_softc_t *, struct isdn_l3_driver *); -static void F_TE04(l2_softc_t *, struct isdn_l3_driver *); -static void F_TE05(l2_softc_t *, struct isdn_l3_driver *); - -static void F_T01(l2_softc_t *, struct isdn_l3_driver *); -static void F_T05(l2_softc_t *, struct isdn_l3_driver *); -static void F_T06(l2_softc_t *, struct isdn_l3_driver *); -static void F_T07(l2_softc_t *, struct isdn_l3_driver *); -static void F_T08(l2_softc_t *, struct isdn_l3_driver *); -static void F_T09(l2_softc_t *, struct isdn_l3_driver *); -static void F_T10(l2_softc_t *, struct isdn_l3_driver *); -static void F_T13(l2_softc_t *, struct isdn_l3_driver *); - -static void F_AE01(l2_softc_t *, struct isdn_l3_driver *); -static void F_AE05(l2_softc_t *, struct isdn_l3_driver *); -static void F_AE06(l2_softc_t *, struct isdn_l3_driver *); -static void F_AE07(l2_softc_t *, struct isdn_l3_driver *); -static void F_AE08(l2_softc_t *, struct isdn_l3_driver *); -static void F_AE09(l2_softc_t *, struct isdn_l3_driver *); -static void F_AE10(l2_softc_t *, struct isdn_l3_driver *); -static void F_AE11(l2_softc_t *, struct isdn_l3_driver *); -static void F_AE12(l2_softc_t *, struct isdn_l3_driver *); - -static void F_AR05(l2_softc_t *, struct isdn_l3_driver *); -static void F_AR06(l2_softc_t *, struct isdn_l3_driver *); -static void F_AR07(l2_softc_t *, struct isdn_l3_driver *); -static void F_AR08(l2_softc_t *, struct isdn_l3_driver *); -static void F_AR09(l2_softc_t *, struct isdn_l3_driver *); -static void F_AR10(l2_softc_t *, struct isdn_l3_driver *); -static void F_AR11(l2_softc_t *, struct isdn_l3_driver *); - -static void F_MF01(l2_softc_t *, struct isdn_l3_driver *); -static void F_MF05(l2_softc_t *, struct isdn_l3_driver *); -static void F_MF06(l2_softc_t *, struct isdn_l3_driver *); -static void F_MF07(l2_softc_t *, struct isdn_l3_driver *); -static void F_MF08(l2_softc_t *, struct isdn_l3_driver *); -static void F_MF09(l2_softc_t *, struct isdn_l3_driver *); -static void F_MF10(l2_softc_t *, struct isdn_l3_driver *); -static void F_MF11(l2_softc_t *, struct isdn_l3_driver *); -static void F_MF12(l2_softc_t *, struct isdn_l3_driver *); -static void F_MF13(l2_softc_t *, struct isdn_l3_driver *); -static void F_MF14(l2_softc_t *, struct isdn_l3_driver *); -static void F_MF15(l2_softc_t *, struct isdn_l3_driver *); -static void F_MF16(l2_softc_t *, struct isdn_l3_driver *); -static void F_MF17(l2_softc_t *, struct isdn_l3_driver *); -static void F_MF18(l2_softc_t *, struct isdn_l3_driver *); -static void F_MF19(l2_softc_t *, struct isdn_l3_driver *); -static void F_MF20(l2_softc_t *, struct isdn_l3_driver *); - -static void F_TR01(l2_softc_t *, struct isdn_l3_driver *); -static void F_TR05(l2_softc_t *, struct isdn_l3_driver *); -static void F_TR06(l2_softc_t *, struct isdn_l3_driver *); -static void F_TR07(l2_softc_t *, struct isdn_l3_driver *); -static void F_TR08(l2_softc_t *, struct isdn_l3_driver *); -static void F_TR09(l2_softc_t *, struct isdn_l3_driver *); -static void F_TR10(l2_softc_t *, struct isdn_l3_driver *); -static void F_TR11(l2_softc_t *, struct isdn_l3_driver *); -static void F_TR12(l2_softc_t *, struct isdn_l3_driver *); -static void F_TR13(l2_softc_t *, struct isdn_l3_driver *); -static void F_TR15(l2_softc_t *, struct isdn_l3_driver *); -static void F_TR16(l2_softc_t *, struct isdn_l3_driver *); -static void F_TR17(l2_softc_t *, struct isdn_l3_driver *); -static void F_TR18(l2_softc_t *, struct isdn_l3_driver *); -static void F_TR19(l2_softc_t *, struct isdn_l3_driver *); -static void F_TR20(l2_softc_t *, struct isdn_l3_driver *); -static void F_ILL(l2_softc_t *, struct isdn_l3_driver *); -static void F_NCNA(l2_softc_t *, struct isdn_l3_driver *); - -/*---------------------------------------------------------------------------* - * FSM illegal state default action - *---------------------------------------------------------------------------*/ -static void -F_ILL(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_ERR, "FSM function F_ILL executing"); -} - -/*---------------------------------------------------------------------------* - * FSM No change, No action - *---------------------------------------------------------------------------*/ -static void -F_NCNA(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_NCNA executing"); -} - -/*---------------------------------------------------------------------------* - * layer 2 state transition table - *---------------------------------------------------------------------------*/ -struct l2state_tab { - void (*func)(l2_softc_t *, struct isdn_l3_driver *); /* function to execute */ - int newstate; /* next state */ -} l2state_tab[N_EVENTS][N_STATES] = { - -/* STATE: ST_TEI_UNAS, ST_ASG_AW_TEI, ST_EST_AW_TEI, ST_TEI_ASGD, ST_AW_EST, ST_AW_REL, ST_MULTIFR, ST_TIMREC, ST_SUBSET, ILLEGAL STATE */ -/* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/*EV_DLESTRQ*/{ {F_TU01, ST_EST_AW_TEI}, {F_NCNA, ST_EST_AW_TEI}, {F_ILL, ST_ILL}, {F_T01, ST_AW_EST}, {F_AE01, ST_AW_EST}, {F_ILL, ST_ILL}, {F_MF01, ST_AW_EST}, {F_TR01, ST_AW_EST}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_DLUDTRQ*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_MDASGRQ*/{ {F_TU03, ST_TEI_ASGD}, {F_TA03, ST_TEI_ASGD}, {F_TE03, ST_AW_EST}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_MDERRRS*/{ {F_ILL, ST_ILL}, {F_TA04, ST_TEI_UNAS}, {F_TE04, ST_TEI_UNAS}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_PSDEACT*/{ {F_ILL, ST_ILL}, {F_TA05, ST_TEI_UNAS}, {F_TE05, ST_TEI_UNAS}, {F_T05, ST_TEI_ASGD}, {F_AE05, ST_TEI_ASGD}, {F_AR05, ST_TEI_ASGD}, {F_MF05, ST_TEI_ASGD}, {F_TR05, ST_TEI_ASGD}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_MDREMRQ*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_T06, ST_TEI_UNAS}, {F_AE06, ST_TEI_UNAS}, {F_AR06, ST_TEI_UNAS}, {F_MF06, ST_TEI_UNAS}, {F_TR06, ST_TEI_UNAS}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_RXSABME*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_T07, ST_SUBSET}, {F_AE07, ST_AW_EST}, {F_AR07, ST_AW_REL}, {F_MF07, ST_MULTIFR}, {F_TR07, ST_MULTIFR}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_RXDISC */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_T08, ST_TEI_ASGD}, {F_AE08, ST_AW_EST}, {F_AR08, ST_AW_REL}, {F_MF08, ST_TEI_ASGD}, {F_TR08, ST_TEI_ASGD}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_RXUA */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_T09, ST_TEI_ASGD}, {F_AE09, ST_SUBSET}, {F_AR09, ST_SUBSET}, {F_MF09, ST_MULTIFR}, {F_TR09, ST_TIMREC}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_RXDM */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_T10, ST_SUBSET}, {F_AE10, ST_SUBSET}, {F_AR10, ST_SUBSET}, {F_MF10, ST_SUBSET}, {F_TR10, ST_AW_EST}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_T200EXP*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_AE11, ST_SUBSET}, {F_AR11, ST_SUBSET}, {F_MF11, ST_TIMREC}, {F_TR11, ST_SUBSET}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_DLDATRQ*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_AE12, ST_AW_EST}, {F_ILL, ST_ILL}, {F_MF12, ST_MULTIFR}, {F_TR12, ST_TIMREC}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_DLRELRQ*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_T13, ST_TEI_ASGD}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF13, ST_AW_REL}, {F_TR13, ST_AW_REL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_T203EXP*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF14, ST_TIMREC}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_OWNBUSY*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF15, ST_MULTIFR}, {F_TR15, ST_TIMREC}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_OWNRDY */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF16, ST_MULTIFR}, {F_TR16, ST_TIMREC}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_RXRR */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF17, ST_SUBSET}, {F_TR17, ST_SUBSET}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_RXREJ */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF18, ST_SUBSET}, {F_TR18, ST_SUBSET}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_RXRNR */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF19, ST_SUBSET}, {F_TR19, ST_SUBSET}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_RXFRMR */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF20, ST_AW_EST}, {F_TR20, ST_AW_EST}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_ILL */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} } -}; - -/*---------------------------------------------------------------------------* - * event handler, executes function and sets new state - *---------------------------------------------------------------------------*/ -void i4b_next_l2state(l2_softc_t *l2sc, struct isdn_l3_driver *drv, int event) -{ - int currstate, newstate; - int (*savpostfsmfunc)(struct isdn_l3_driver *) = NULL; - - /* check event number */ - if(event > N_EVENTS) - panic("i4b_l2fsm.c: event > N_EVENTS"); - - /* get current state and check it */ - if((currstate = l2sc->Q921_state) > N_STATES) /* failsafe */ - panic("i4b_l2fsm.c: currstate > N_STATES"); - - /* get new state and check it */ - if((newstate = l2state_tab[event][currstate].newstate) > N_STATES) - panic("i4b_l2fsm.c: newstate > N_STATES"); - - - if(newstate != ST_SUBSET) - { /* state function does NOT set new state */ - NDBGL2(L2_F_MSG, "FSM event [%s]: [%s/%d => %s/%d]", - l2event_text[event], - l2state_text[currstate], currstate, - l2state_text[newstate], newstate); - } - - /* execute state transition function */ - (*l2state_tab[event][currstate].func)(l2sc, drv); - - if(newstate == ST_SUBSET) - { /* state function DOES set new state */ - NDBGL2(L2_F_MSG, "FSM S-event [%s]: [%s => %s]", l2event_text[event], - l2state_text[currstate], - l2state_text[l2sc->Q921_state]); - } - - /* check for illegal new state */ - - if(newstate == ST_ILL) - { - newstate = currstate; - NDBGL2(L2_F_ERR, "FSM illegal state, state = %s, event = %s!", - l2state_text[currstate], - l2event_text[event]); - } - - /* check if state machine function has to set new state */ - - if(newstate != ST_SUBSET) - l2sc->Q921_state = newstate; /* no, we set new state */ - - if(l2sc->postfsmfunc != NULL) - { - NDBGL2(L2_F_MSG, "FSM executing postfsmfunc!"); - /* try to avoid an endless loop */ - savpostfsmfunc = l2sc->postfsmfunc; - l2sc->postfsmfunc = NULL; - (*savpostfsmfunc)(l2sc->postfsmarg); - } -} - -#if DO_I4B_DEBUG -/*---------------------------------------------------------------------------* - * return pointer to current state description - *---------------------------------------------------------------------------*/ -const char *i4b_print_l2state(l2_softc_t *l2sc) -{ - return(l2state_text[l2sc->Q921_state]); -} -#endif - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_UNAS event dl establish request - *---------------------------------------------------------------------------*/ -static void -F_TU01(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TU01 executing"); - i4b_mdl_assign_ind(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_UNAS event mdl assign request - *---------------------------------------------------------------------------*/ -static void -F_TU03(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TU03 executing"); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_ASG_AW_TEI event mdl assign request - *---------------------------------------------------------------------------*/ -static void -F_TA03(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TA03 executing"); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_ASG_AW_TEI event mdl error response - *---------------------------------------------------------------------------*/ -static void -F_TA04(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TA04 executing"); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_ASG_AW_TEI event persistent deactivation - *---------------------------------------------------------------------------*/ -static void -F_TA05(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TA05 executing"); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_EST_AW_TEI event mdl assign request - *---------------------------------------------------------------------------*/ -static void -F_TE03(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TE03 executing"); - i4b_establish_data_link(l2sc); - l2sc->l3initiated = 1; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_EST_AW_TEI event mdl error response - *---------------------------------------------------------------------------*/ -static void -F_TE04(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TE04 executing"); - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_release_ind; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_EST_AW_TEI event persistent deactivation - *---------------------------------------------------------------------------*/ -static void -F_TE05(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TE05 executing"); - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_release_ind; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_ASGD event dl establish request - *---------------------------------------------------------------------------*/ -static void -F_T01(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_T01 executing"); - i4b_establish_data_link(l2sc); - l2sc->l3initiated = 1; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_ASGD event persistent deactivation - *---------------------------------------------------------------------------*/ -static void -F_T05(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_T05 executing"); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_ASGD event mdl remove request - *---------------------------------------------------------------------------*/ -static void -F_T06(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_T06 executing"); -/*XXX*/ i4b_mdl_assign_ind(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_ASGD event rx'd SABME - *---------------------------------------------------------------------------*/ -static void -F_T07(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_T07 executing"); - -/* XXX */ -#ifdef NOTDEF - if(NOT able to establish) - { - i4b_tx_dm(l2sc, l2sc->rxd_PF); - l2sc->Q921_state = ST_TEI_ASGD; - return; - } -#endif - - i4b_clear_exception_conditions(l2sc); - - i4b_mdl_status_ind(l2sc->drv, STI_L2STAT, LAYER_ACTIVE); - - i4b_tx_ua(l2sc, l2sc->rxd_PF); - - l2sc->vs = 0; - l2sc->va = 0; - l2sc->vr = 0; - - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_establish_ind; - - i4b_T203_start(l2sc); - - l2sc->Q921_state = ST_MULTIFR; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_ASGD event rx'd DISC - *---------------------------------------------------------------------------*/ -static void -F_T08(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_T08 executing"); - i4b_mdl_status_ind(l2sc->drv, STI_L2STAT, LAYER_IDLE); - i4b_tx_ua(l2sc, l2sc->rxd_PF); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_ASGD event rx'd UA - *---------------------------------------------------------------------------*/ -static void -F_T09(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_T09 executing"); - i4b_mdl_error_ind(l2sc, "F_T09", MDL_ERR_C); - i4b_mdl_error_ind(l2sc, "F_T09", MDL_ERR_D); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_ASGD event rx'd DM - *---------------------------------------------------------------------------*/ -static void -F_T10(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_T10 executing"); - - if(l2sc->rxd_PF) - { - l2sc->Q921_state = ST_TEI_ASGD; - } - else - { -#ifdef NOTDEF - if(NOT able_to_etablish) - { - l2sc->Q921_state = ST_TEI_ASGD; - return; - } -#endif - i4b_establish_data_link(l2sc); - - l2sc->l3initiated = 1; - - l2sc->Q921_state = ST_AW_EST; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_ASGD event dl release request - *---------------------------------------------------------------------------*/ -static void -F_T13(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_T13 executing"); - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_release_cnf; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_EST event dl establish request - *---------------------------------------------------------------------------*/ -static void -F_AE01(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_AE01 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->l3initiated = 1; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_EST event persistent deactivation - *---------------------------------------------------------------------------*/ -static void -F_AE05(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_AE05 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_release_ind; - - i4b_T200_stop(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_EST event mdl remove request - *---------------------------------------------------------------------------*/ -static void -F_AE06(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_AE06 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_release_ind; - - i4b_T200_stop(l2sc); - -/*XXX*/ i4b_mdl_assign_ind(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_EST event rx'd SABME - *---------------------------------------------------------------------------*/ -static void -F_AE07(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_AE07 executing"); - i4b_mdl_status_ind(l2sc->drv, STI_L2STAT, LAYER_ACTIVE); - i4b_tx_ua(l2sc, l2sc->rxd_PF); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_EST event rx'd DISC - *---------------------------------------------------------------------------*/ -static void -F_AE08(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_AE08 executing"); - i4b_tx_dm(l2sc, l2sc->rxd_PF); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_EST event rx'd UA - *---------------------------------------------------------------------------*/ -static void -F_AE09(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_AE09 executing"); - - if(l2sc->rxd_PF == 0) - { - i4b_mdl_error_ind(l2sc, "F_AE09", MDL_ERR_D); - l2sc->Q921_state = ST_AW_EST; - } - else - { - if(l2sc->l3initiated) - { - l2sc->l3initiated = 0; - l2sc->vr = 0; - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_establish_cnf; - } - else - { - if(l2sc->vs != l2sc->va) - { - i4b_Dcleanifq(&l2sc->i_queue); - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_establish_ind; - } - } - - i4b_mdl_status_ind(l2sc->drv, STI_L2STAT, LAYER_ACTIVE); - - i4b_T200_stop(l2sc); - i4b_T203_start(l2sc); - - l2sc->vs = 0; - l2sc->va = 0; - - l2sc->Q921_state = ST_MULTIFR; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_EST event rx'd DM - *---------------------------------------------------------------------------*/ -static void -F_AE10(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_AE10 executing"); - - if(l2sc->rxd_PF == 0) - { - l2sc->Q921_state = ST_AW_EST; - } - else - { - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_release_ind; - - i4b_T200_stop(l2sc); - - l2sc->Q921_state = ST_TEI_ASGD; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_EST event T200 expiry - *---------------------------------------------------------------------------*/ -static void -F_AE11(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_AE11 executing"); - - if(l2sc->RC >= N200) - { - i4b_Dcleanifq(&l2sc->i_queue); - - i4b_mdl_error_ind(l2sc, "F_AE11", MDL_ERR_G); - - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_release_ind; - - l2sc->Q921_state = ST_TEI_ASGD; - } - else - { - l2sc->RC++; - - i4b_tx_sabme(l2sc, P1); - - i4b_T200_start(l2sc); - - l2sc->Q921_state = ST_AW_EST; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_EST event dl data request - *---------------------------------------------------------------------------*/ -static void -F_AE12(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_AE12 executing"); - - if(l2sc->l3initiated == 0) - { - i4b_i_frame_queued_up(l2sc); - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_REL event persistent deactivation - *---------------------------------------------------------------------------*/ -static void -F_AR05(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_AR05 executing"); - - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_release_cnf; - - i4b_T200_stop(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_REL event mdl remove request - *---------------------------------------------------------------------------*/ -static void -F_AR06(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_AR06 executing"); - - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_release_cnf; - - i4b_T200_stop(l2sc); - -/*XXX*/ i4b_mdl_assign_ind(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_REL event rx'd SABME - *---------------------------------------------------------------------------*/ -static void -F_AR07(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_AR07 executing"); - i4b_tx_dm(l2sc, l2sc->rxd_PF); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_REL event rx'd DISC - *---------------------------------------------------------------------------*/ -static void -F_AR08(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_AR08 executing"); - i4b_mdl_status_ind(l2sc->drv, STI_L2STAT, LAYER_IDLE); - i4b_tx_ua(l2sc, l2sc->rxd_PF); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_REL event rx'd UA - *---------------------------------------------------------------------------*/ -static void -F_AR09(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_AR09 executing"); - - if(l2sc->rxd_PF) - { - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_release_cnf; - - i4b_T200_stop(l2sc); - - l2sc->Q921_state = ST_TEI_ASGD; - } - else - { - i4b_mdl_error_ind(l2sc, "F_AR09", MDL_ERR_D); - - l2sc->Q921_state = ST_AW_REL; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_REL event rx'd DM - *---------------------------------------------------------------------------*/ -static void -F_AR10(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_AR10 executing"); - - if(l2sc->rxd_PF) - { - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_release_cnf; - - i4b_T200_stop(l2sc); - - l2sc->Q921_state = ST_TEI_ASGD; - } - else - { - l2sc->Q921_state = ST_AW_REL; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_REL event T200 expiry - *---------------------------------------------------------------------------*/ -static void -F_AR11(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_AR11 executing"); - - if(l2sc->RC >= N200) - { - i4b_mdl_error_ind(l2sc, "F_AR11", MDL_ERR_H); - - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_release_cnf; - - l2sc->Q921_state = ST_TEI_ASGD; - } - else - { - l2sc->RC++; - - i4b_tx_disc(l2sc, P1); - - i4b_T200_start(l2sc); - - l2sc->Q921_state = ST_AW_REL; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event dl establish request - *---------------------------------------------------------------------------*/ -static void -F_MF01(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF01 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - i4b_establish_data_link(l2sc); - - l2sc->l3initiated = 1; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event persistent deactivation - *---------------------------------------------------------------------------*/ -static void -F_MF05(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF05 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_release_ind; - - i4b_T200_stop(l2sc); - i4b_T203_stop(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event mdl remove request - *---------------------------------------------------------------------------*/ -static void -F_MF06(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF06 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_release_ind; - - i4b_T200_stop(l2sc); - i4b_T203_stop(l2sc); - -/*XXX*/ i4b_mdl_assign_ind(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event rx'd SABME - *---------------------------------------------------------------------------*/ -static void -F_MF07(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF07 executing"); - - i4b_clear_exception_conditions(l2sc); - - i4b_mdl_status_ind(l2sc->drv, STI_L2STAT, LAYER_ACTIVE); - - i4b_tx_ua(l2sc, l2sc->rxd_PF); - - i4b_mdl_error_ind(l2sc, "F_MF07", MDL_ERR_F); - - if(l2sc->vs != l2sc->va) - { - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_establish_ind; - } - - i4b_T200_stop(l2sc); - i4b_T203_start(l2sc); - - l2sc->vs = 0; - l2sc->va = 0; - l2sc->vr = 0; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event rx'd DISC - *---------------------------------------------------------------------------*/ -static void -F_MF08(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF08 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - i4b_mdl_status_ind(l2sc->drv, STI_L2STAT, LAYER_IDLE); - i4b_tx_ua(l2sc, l2sc->rxd_PF); - - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_release_ind; - - i4b_T200_stop(l2sc); - i4b_T203_stop(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event rx'd UA - *---------------------------------------------------------------------------*/ -static void -F_MF09(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF09 executing"); - if(l2sc->rxd_PF) - i4b_mdl_error_ind(l2sc, "F_MF09", MDL_ERR_C); - else - i4b_mdl_error_ind(l2sc, "F_MF09", MDL_ERR_D); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event rx'd DM - *---------------------------------------------------------------------------*/ -static void -F_MF10(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF10 executing"); - - if(l2sc->rxd_PF) - { - i4b_mdl_error_ind(l2sc, "F_MF10", MDL_ERR_B); - - l2sc->Q921_state = ST_MULTIFR; - } - else - { - i4b_mdl_error_ind(l2sc, "F_MF10", MDL_ERR_E); - - i4b_establish_data_link(l2sc); - - l2sc->l3initiated = 0; - - l2sc->Q921_state = ST_AW_EST; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event T200 expiry - *---------------------------------------------------------------------------*/ -static void -F_MF11(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF11 executing"); - - l2sc->RC = 0; - - i4b_transmit_enquire(l2sc); - - l2sc->RC++; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event dl data request - *---------------------------------------------------------------------------*/ -static void -F_MF12(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF12 executing"); - - i4b_i_frame_queued_up(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event dl release request - *---------------------------------------------------------------------------*/ -static void -F_MF13(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF13 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->RC = 0; - - i4b_tx_disc(l2sc, P1); - - i4b_T203_stop(l2sc); - i4b_T200_restart(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event T203 expiry - *---------------------------------------------------------------------------*/ -static void -F_MF14(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF14 executing"); - - i4b_transmit_enquire(l2sc); - - l2sc->RC = 0; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event set own rx busy - *---------------------------------------------------------------------------*/ -static void -F_MF15(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF15 executing"); - - if(l2sc->own_busy == 0) - { - l2sc->own_busy = 1; - - i4b_tx_rnr_response(l2sc, F0); /* wrong in Q.921 03/93 p 64 */ - - l2sc->ack_pend = 0; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event clear own rx busy - *---------------------------------------------------------------------------*/ -static void -F_MF16(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF16 executing"); - - if(l2sc->own_busy != 0) - { - l2sc->own_busy = 0; - - i4b_tx_rr_response(l2sc, F0); /* wrong in Q.921 03/93 p 64 */ - - l2sc->ack_pend = 0; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event rx'd RR - *---------------------------------------------------------------------------*/ -static void -F_MF17(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF17 executing"); - - l2sc->peer_busy = 0; - - if(l2sc->rxd_CR == CR_CMD_FROM_NT) - { - if(l2sc->rxd_PF == 1) - { - i4b_enquiry_response(l2sc); - } - } - else - { - if(l2sc->rxd_PF == 1) - { - i4b_mdl_error_ind(l2sc, "F_MF17", MDL_ERR_A); - } - } - - if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs)) - { - if(l2sc->rxd_NR == l2sc->vs) - { - l2sc->va = l2sc->rxd_NR; - i4b_T200_stop(l2sc); - i4b_T203_restart(l2sc); - } - else if(l2sc->rxd_NR != l2sc->va) - { - l2sc->va = l2sc->rxd_NR; - i4b_T200_restart(l2sc); - } - l2sc->Q921_state = ST_MULTIFR; - } - else - { - i4b_nr_error_recovery(l2sc); - l2sc->Q921_state = ST_AW_EST; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event rx'd REJ - *---------------------------------------------------------------------------*/ -static void -F_MF18(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF18 executing"); - - l2sc->peer_busy = 0; - - if(l2sc->rxd_CR == CR_CMD_FROM_NT) - { - if(l2sc->rxd_PF == 1) - { - i4b_enquiry_response(l2sc); - } - } - else - { - if(l2sc->rxd_PF == 1) - { - i4b_mdl_error_ind(l2sc, "F_MF18", MDL_ERR_A); - } - } - - if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs)) - { - l2sc->va = l2sc->rxd_NR; - i4b_T200_stop(l2sc); - i4b_T203_start(l2sc); - i4b_invoke_retransmission(l2sc, l2sc->rxd_NR); - l2sc->Q921_state = ST_MULTIFR; - } - else - { - i4b_nr_error_recovery(l2sc); - l2sc->Q921_state = ST_AW_EST; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event rx'd RNR - *---------------------------------------------------------------------------*/ -static void -F_MF19(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF19 executing"); - - l2sc->peer_busy = 1; - - if(l2sc->rxd_CR == CR_CMD_FROM_NT) - { - if(l2sc->rxd_PF == 1) - { - i4b_enquiry_response(l2sc); - } - } - else - { - if(l2sc->rxd_PF == 1) - { - i4b_mdl_error_ind(l2sc, "F_MF19", MDL_ERR_A); - } - } - - if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs)) - { - l2sc->va = l2sc->rxd_NR; - i4b_T203_stop(l2sc); - i4b_T200_restart(l2sc); - l2sc->Q921_state = ST_MULTIFR; - } - else - { - i4b_nr_error_recovery(l2sc); - l2sc->Q921_state = ST_AW_EST; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event rx'd FRMR - *---------------------------------------------------------------------------*/ -static void -F_MF20(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF20 executing"); - - i4b_mdl_error_ind(l2sc, "F_MF20", MDL_ERR_K); - - i4b_establish_data_link(l2sc); - - l2sc->l3initiated = 0; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event dl establish request - *---------------------------------------------------------------------------*/ -static void -F_TR01(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR01 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - i4b_establish_data_link(l2sc); - - l2sc->l3initiated = 1; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event persistent deactivation - *---------------------------------------------------------------------------*/ -static void -F_TR05(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR05 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_release_ind; - - i4b_T200_stop(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event mdl remove request - *---------------------------------------------------------------------------*/ -static void -F_TR06(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR06 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_release_ind; - - i4b_T200_stop(l2sc); - -/*XXX*/ i4b_mdl_assign_ind(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event rx'd SABME - *---------------------------------------------------------------------------*/ -static void -F_TR07(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR07 executing"); - - i4b_clear_exception_conditions(l2sc); - - i4b_mdl_status_ind(l2sc->drv, STI_L2STAT, LAYER_ACTIVE); - - i4b_tx_ua(l2sc, l2sc->rxd_PF); - - i4b_mdl_error_ind(l2sc, "F_TR07", MDL_ERR_F); - - if(l2sc->vs != l2sc->va) - { - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->postfsmarg = l2sc->drv; - l2sc->postfsmfunc = i4b_dl_establish_ind; - } - - i4b_T200_stop(l2sc); - i4b_T203_start(l2sc); - - l2sc->vs = 0; - l2sc->va = 0; - l2sc->vr = 0; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event rx'd DISC - *---------------------------------------------------------------------------*/ -static void -F_TR08(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR08 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - i4b_mdl_status_ind(drv, STI_L2STAT, LAYER_IDLE); - i4b_tx_ua(l2sc, l2sc->rxd_PF); - - l2sc->postfsmarg = drv; - l2sc->postfsmfunc = i4b_dl_release_ind; - - i4b_T200_stop(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event rx'd UA - *---------------------------------------------------------------------------*/ -static void -F_TR09(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR09 executing"); - if(l2sc->rxd_PF) - i4b_mdl_error_ind(l2sc, "F_TR09", MDL_ERR_C); - else - i4b_mdl_error_ind(l2sc, "F_TR09", MDL_ERR_D); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event rx'd DM - *---------------------------------------------------------------------------*/ -static void -F_TR10(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR10 executing"); - - if(l2sc->rxd_PF) - { - i4b_mdl_error_ind(l2sc, "F_TR10", MDL_ERR_B); - } - else - { - i4b_mdl_error_ind(l2sc, "F_TR10", MDL_ERR_E); - } - - i4b_establish_data_link(l2sc); - - l2sc->l3initiated = 0; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event T200 expiry - *---------------------------------------------------------------------------*/ -static void -F_TR11(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR11 executing"); - - if(l2sc->RC >= N200) - { - i4b_mdl_error_ind(l2sc, "F_TR11", MDL_ERR_I); - - i4b_establish_data_link(l2sc); - - l2sc->l3initiated = 0; - - l2sc->Q921_state = ST_AW_EST; - } - else - { - i4b_transmit_enquire(l2sc); - - l2sc->RC++; - - l2sc->Q921_state = ST_TIMREC; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event dl data request - *---------------------------------------------------------------------------*/ -static void -F_TR12(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR12 executing"); - - i4b_i_frame_queued_up(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event dl release request - *---------------------------------------------------------------------------*/ -static void -F_TR13(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR13 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->RC = 0; - - i4b_tx_disc(l2sc, P1); - - i4b_T200_restart(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event set own rx busy - *---------------------------------------------------------------------------*/ -static void -F_TR15(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR15 executing"); - - if(l2sc->own_busy == 0) - { - l2sc->own_busy = 1; - - i4b_tx_rnr_response(l2sc, F0); - - l2sc->ack_pend = 0; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event clear own rx busy - *---------------------------------------------------------------------------*/ -static void -F_TR16(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR16 executing"); - - if(l2sc->own_busy != 0) - { - l2sc->own_busy = 0; - - i4b_tx_rr_response(l2sc, F0); /* this is wrong */ - /* in Q.921 03/93 p 74 ! */ - l2sc->ack_pend = 0; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event rx'd RR - *---------------------------------------------------------------------------*/ -static void -F_TR17(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR17 executing"); - - l2sc->peer_busy = 0; - - if(l2sc->rxd_CR == CR_CMD_FROM_NT) - { - if(l2sc->rxd_PF == 1) - { - i4b_enquiry_response(l2sc); - } - } - else - { - if(l2sc->rxd_PF == 1) - { - if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs)) - { - l2sc->va = l2sc->rxd_NR; - i4b_T200_stop(l2sc); - i4b_T203_start(l2sc); - i4b_invoke_retransmission(l2sc, l2sc->rxd_NR); - l2sc->Q921_state = ST_MULTIFR; - return; - } - else - { - i4b_nr_error_recovery(l2sc); - l2sc->Q921_state = ST_AW_EST; - return; - } - } - } - - if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs)) - { - l2sc->va = l2sc->rxd_NR; - l2sc->Q921_state = ST_TIMREC; - } - else - { - i4b_nr_error_recovery(l2sc); - l2sc->Q921_state = ST_AW_EST; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event - *---------------------------------------------------------------------------*/ -static void -F_TR18(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR18 executing"); - - l2sc->peer_busy = 0; - - if(l2sc->rxd_CR == CR_CMD_FROM_NT) - { - if(l2sc->rxd_PF == 1) - { - i4b_enquiry_response(l2sc); - } - } - else - { - if(l2sc->rxd_PF == 1) - { - if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs)) - { - l2sc->va = l2sc->rxd_NR; - i4b_T200_stop(l2sc); - i4b_T203_start(l2sc); - i4b_invoke_retransmission(l2sc, l2sc->rxd_NR); - l2sc->Q921_state = ST_MULTIFR; - return; - } - else - { - i4b_nr_error_recovery(l2sc); - l2sc->Q921_state = ST_AW_EST; - return; - } - } - } - - if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs)) - { - l2sc->va = l2sc->rxd_NR; - l2sc->Q921_state = ST_TIMREC; - } - else - { - i4b_nr_error_recovery(l2sc); - l2sc->Q921_state = ST_AW_EST; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event rx'd RNR - *---------------------------------------------------------------------------*/ -static void -F_TR19(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR19 executing"); - - l2sc->peer_busy = 0; - - if(l2sc->rxd_CR == CR_CMD_FROM_NT) - { - if(l2sc->rxd_PF == 1) - { - i4b_enquiry_response(l2sc); - } - } - else - { - if(l2sc->rxd_PF == 1) - { - if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs)) - { - l2sc->va = l2sc->rxd_NR; - i4b_T200_restart(l2sc); - i4b_invoke_retransmission(l2sc, l2sc->rxd_NR); - l2sc->Q921_state = ST_MULTIFR; - return; - } - else - { - i4b_nr_error_recovery(l2sc); - l2sc->Q921_state = ST_AW_EST; - return; - } - } - } - - if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs)) - { - l2sc->va = l2sc->rxd_NR; - l2sc->Q921_state = ST_TIMREC; - } - else - { - i4b_nr_error_recovery(l2sc); - l2sc->Q921_state = ST_AW_EST; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event rx'd FRMR - *---------------------------------------------------------------------------*/ -static void -F_TR20(l2_softc_t *l2sc, struct isdn_l3_driver *drv) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR20 executing"); - - i4b_mdl_error_ind(l2sc, "F_TR20", MDL_ERR_K); - - i4b_establish_data_link(l2sc); - - l2sc->l3initiated = 0; -} - -#endif /* NI4BQ921 > 0 */ diff --git a/sys/netisdn/i4b_l2fsm.h b/sys/netisdn/i4b_l2fsm.h deleted file mode 100644 index a8758cfc7376..000000000000 --- a/sys/netisdn/i4b_l2fsm.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_l2fsm.h - layer 2 FSM - * ------------------------- - * - * $Id: i4b_l2fsm.h,v 1.3 2005/12/10 23:51:50 elad Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Sat Mar 18 10:28:37 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _NETISDN_I4B_L2FSM_H_ -#define _NETISDN_I4B_L2FSM_H_ - -enum Q921_states { - ST_TEI_UNAS, /* TEI unassigned */ - ST_ASG_AW_TEI, /* assign awaiting TEI */ - ST_EST_AW_TEI, /* establish awaiting TEI */ - ST_TEI_ASGD, /* TEI assigned */ - - ST_AW_EST, /* awaiting establishment */ - ST_AW_REL, /* awaiting release */ - ST_MULTIFR, /* multiple frame established */ - ST_TIMREC, /* timer recovery */ - - ST_SUBSET, /* SUBroutine SETs new state */ - ST_ILL, /* illegal state */ - N_STATES /* number of states */ -}; - -enum Q921_events { - EV_DLESTRQ, /* dl establish req */ - EV_DLUDTRQ, /* dl unit data req */ - EV_MDASGRQ, /* mdl assign req */ - EV_MDERRRS, /* mdl error response */ - EV_PSDEACT, /* persistent deactivation */ - EV_MDREMRQ, /* mdl remove req */ - EV_RXSABME, /* rx'd SABME */ - EV_RXDISC, /* rx'd DISC */ - EV_RXUA, /* rx'd UA */ - EV_RXDM, /* rx'd DM */ - EV_T200EXP, /* T200 expired */ - EV_DLDATRQ, /* dl data req */ - EV_DLRELRQ, /* dl release req */ - EV_T203EXP, /* T203 expired */ - EV_OWNBUSY, /* set own rx busy */ - EV_OWNRDY, /* clear own rx busy */ - EV_RXRR, /* rx'd RR */ - EV_RXREJ, /* rx'd REJ */ - EV_RXRNR, /* rx'd RNR */ - EV_RXFRMR, /* rx'd FRMR */ - - EV_ILL, /* Illegal */ - N_EVENTS -}; - -#endif /* !_NETISDN_I4B_L2FSM_H_ */ diff --git a/sys/netisdn/i4b_l2if.c b/sys/netisdn/i4b_l2if.c deleted file mode 100644 index e5b8cd7617a9..000000000000 --- a/sys/netisdn/i4b_l2if.c +++ /dev/null @@ -1,607 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_l2if.c - Layer 3 interface to Layer 2 - * ------------------------------------------- - * - * $Id: i4b_l2if.c,v 1.11 2005/12/11 12:25:06 christos Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_l2if.c,v 1.11 2005/12/11 12:25:06 christos Exp $"); - -#ifdef __FreeBSD__ -#include "i4bq931.h" -#else -#define NI4BQ931 1 -#endif -#if NI4BQ931 > 0 - -#include -#include -#include -#include -#include -#include - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#include -#else -#include -#include -#include -#endif - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -static unsigned char make_q931_cause(cause_t cause); - -/*---------------------------------------------------------------------------* - * this converts our internal state (number) to the number specified - * in Q.931 and is used for reporting our state in STATUS messages. - *---------------------------------------------------------------------------*/ -int i4b_status_tab[] = { - 0, /* ST_U0, */ - 1, /* ST_U1, */ - 3, /* ST_U3, */ - 4, /* ST_U4, */ - 6, /* ST_U6, */ - 7, /* ST_U7, */ - 8, /* ST_U8, */ - 9, /* ST_U9, */ - 10, /* ST_U10, */ - 11, /* ST_U11, */ - 12, /* ST_U12, */ - 19, /* ST_U19, */ - 6, /* ST_IWA, */ - 6, /* ST_IWR, */ - 1, /* ST_OW, */ - 6, /* ST_IWL, */ -}; - -/*---------------------------------------------------------------------------* - * return a valid q.931/q.850 cause from any of the internal causes - *---------------------------------------------------------------------------*/ -static unsigned char -make_q931_cause(cause_t cause) -{ - register unsigned char ret; - - switch(GET_CAUSE_TYPE(cause)) - { - case CAUSET_Q850: - ret = GET_CAUSE_VAL(cause); - break; - case CAUSET_I4B: - ret = cause_tab_q931[GET_CAUSE_VAL(cause)]; - break; - default: - panic("make_q931_cause: unknown cause type!"); - break; - } - ret |= EXT_LAST; - return(ret); -} - -/*---------------------------------------------------------------------------* - * return status of data link - *---------------------------------------------------------------------------*/ -int -i4b_get_dl_stat(call_desc_t *cd) -{ - const struct isdn_l3_driver * drv = cd->l3drv; - return drv->dl_est; -} - -/*---------------------------------------------------------------------------* - * DL ESTABLISH INDICATION from Layer 2 - *---------------------------------------------------------------------------*/ -int -i4b_dl_establish_ind(struct isdn_l3_driver * drv) -{ - int i, found; - NDBGL2(L2_PRIM, "DL-ESTABLISH-IND isdnif %d", drv->isdnif); - - /* first set DL up in controller descriptor */ - NDBGL3(L3_MSG, "isdnif %d DL established!", drv->isdnif); - drv->dl_est = DL_UP; - - found = 0; - - /* second, inform all (!) active call of the event */ - - for(i=0; i < num_call_desc; i++) - { - if( (call_desc[i].cdid != 0) - && call_desc[i].isdnif == drv->isdnif) { - next_l3state(&call_desc[i], EV_DLESTIN); - found++; - } - } - - if(found == 0) - { - NDBGL3(L3_ERR, "ERROR, no cdid for isdnif %d found!", - drv->isdnif); - return(-1); - } - else - { - return(0); - } -} - -/*---------------------------------------------------------------------------* - * DL ESTABLISH CONFIRM from Layer 2 - *---------------------------------------------------------------------------*/ -int -i4b_dl_establish_cnf(struct isdn_l3_driver * drv) -{ - int i; - int found = 0; - - NDBGL2(L2_PRIM, "DL-ESTABLISH-CONF isdnif %d", drv->isdnif); - - for(i=0; i < num_call_desc; i++) - { - if(call_desc[i].cdid != 0 - && call_desc[i].isdnif == drv->isdnif) { - drv->dl_est = DL_UP; - next_l3state(&call_desc[i], EV_DLESTCF); - found++; - } - } - - if(found == 0) - { - NDBGL3(L3_ERR, "ERROR, no cdid for isdnif %d found!", - drv->isdnif); - return(-1); - } - else - { - return(0); - } -} - -/*---------------------------------------------------------------------------* - * DL RELEASE INDICATION from Layer 2 - *---------------------------------------------------------------------------*/ -int -i4b_dl_release_ind(struct isdn_l3_driver * drv) -{ - int i; - int found = 0; - - NDBGL2(L2_PRIM, "DL-RELEASE-IND isdnif %d", drv->isdnif); - - /* first set controller to down */ - - drv->dl_est = DL_DOWN; - - found = 0; - - /* second, inform all (!) active calls of the event */ - - for(i=0; i < num_call_desc; i++) - { - if(call_desc[i].cdid != 0 - && call_desc[i].isdnif == drv->isdnif) { - next_l3state(&call_desc[i], EV_DLRELIN); - found++; - } - } - - if(found == 0) - { - /* this is not an error since it might be a normal call end */ - NDBGL3(L3_MSG, "no cdid for isdnif %d found", drv->isdnif); - } - return(0); -} - -/*---------------------------------------------------------------------------* - * DL RELEASE CONFIRM from Layer 2 - *---------------------------------------------------------------------------*/ -int -i4b_dl_release_cnf(struct isdn_l3_driver * drv) -{ - NDBGL2(L2_PRIM, "DL-RELEASE-CONF isdnif %d", drv->isdnif); - - drv->dl_est = DL_DOWN; - return(0); -} - -/*---------------------------------------------------------------------------* - * i4b_dl_data_ind - process a rx'd I-frame got from layer 2 - *---------------------------------------------------------------------------*/ -int -i4b_dl_data_ind(struct isdn_l3_driver *drv, struct mbuf *m) -{ - i4b_decode_q931(drv->isdnif, m->m_len, m->m_data); - i4b_Dfreembuf(m); - return(0); -} - -/*---------------------------------------------------------------------------* - * dl_unit_data_ind - process a rx'd U-frame got from layer 2 - *---------------------------------------------------------------------------*/ -int -i4b_dl_unit_data_ind(struct isdn_l3_driver *drv, struct mbuf *m) -{ - i4b_decode_q931(drv->isdnif, m->m_len, m->m_data); - i4b_Dfreembuf(m); - return(0); -} - -/*---------------------------------------------------------------------------* - * send CONNECT message - *---------------------------------------------------------------------------*/ -void -i4b_l3_tx_connect(call_desc_t *cd) -{ - struct l2_softc *l2sc = (l2_softc_t*)cd->l3drv->l1_token; - struct mbuf *m; - u_char *ptr; - - NDBGL3(L3_PRIM, "isdnif %d, cr = 0x%02x", cd->isdnif, cd->cr); - - if((m = i4b_Dgetmbuf(I_FRAME_HDRLEN + MSG_CONNECT_LEN)) == NULL) - panic("i4b_l3_tx_connect: can't allocate mbuf"); - - ptr = m->m_data + I_FRAME_HDRLEN; - - *ptr++ = PD_Q931; /* protocol discriminator */ - *ptr++ = 0x01; /* call reference length */ - *ptr++ = setup_cr(cd, cd->cr); /* call reference value */ - *ptr++ = CONNECT; /* message type = connect */ - - i4b_dl_data_req(l2sc, l2sc->drv, m); -} - -/*---------------------------------------------------------------------------* - * send RELEASE COMPLETE message - *---------------------------------------------------------------------------*/ -void -i4b_l3_tx_release_complete(call_desc_t *cd, int send_cause_flag) -{ - struct l2_softc *l2sc = (l2_softc_t*)cd->l3drv->l1_token; - struct mbuf *m; - u_char *ptr; - int len = I_FRAME_HDRLEN + MSG_RELEASE_COMPLETE_LEN; - - if(send_cause_flag == 0) - { - len -= 4; - NDBGL3(L3_PRIM, "isdnif %d, cr = 0x%02x", - cd->isdnif, cd->cr); - } - else - { - NDBGL3(L3_PRIM, "isdnif=%d, cr=0x%02x, cause=0x%x", - cd->isdnif, cd->cr, cd->cause_out); - } - - if((m = i4b_Dgetmbuf(len)) == NULL) - panic("i4b_l3_tx_release_complete: can't allocate mbuf"); - - ptr = m->m_data + I_FRAME_HDRLEN; - - *ptr++ = PD_Q931; /* protocol discriminator */ - *ptr++ = 0x01; /* call reference length */ - *ptr++ = setup_cr(cd, cd->cr); /* call reference value */ - *ptr++ = RELEASE_COMPLETE; /* message type = release complete */ - - if(send_cause_flag) - { - *ptr++ = IEI_CAUSE; /* cause ie */ - *ptr++ = CAUSE_LEN; - *ptr++ = CAUSE_STD_LOC_OUT; - *ptr++ = make_q931_cause(cd->cause_out); - } - - i4b_dl_data_req(l2sc, l2sc->drv, m); -} - -/*---------------------------------------------------------------------------* - * send DISCONNECT message - *---------------------------------------------------------------------------*/ -void -i4b_l3_tx_disconnect(call_desc_t *cd) -{ - struct l2_softc *l2sc = (l2_softc_t*)cd->l3drv->l1_token; - struct mbuf *m; - u_char *ptr; - - NDBGL3(L3_PRIM, "isdnif %d, cr = 0x%02x", cd->isdnif, cd->cr); - - if((m = i4b_Dgetmbuf(I_FRAME_HDRLEN + MSG_DISCONNECT_LEN)) == NULL) - panic("i4b_l3_tx_disconnect: can't allocate mbuf"); - - ptr = m->m_data + I_FRAME_HDRLEN; - - *ptr++ = PD_Q931; /* protocol discriminator */ - *ptr++ = 0x01; /* call ref length */ - *ptr++ = setup_cr(cd, cd->cr); /* call reference value */ - *ptr++ = DISCONNECT; /* message type = disconnect */ - - *ptr++ = IEI_CAUSE; /* cause ie */ - *ptr++ = CAUSE_LEN; - *ptr++ = CAUSE_STD_LOC_OUT; - *ptr++ = make_q931_cause(cd->cause_out); - - i4b_dl_data_req(l2sc, l2sc->drv, m); -} - -/*---------------------------------------------------------------------------* - * send SETUP message - *---------------------------------------------------------------------------*/ -void -i4b_l3_tx_setup(call_desc_t *cd) -{ - struct l2_softc *l2sc = (l2_softc_t*)cd->l3drv->l1_token; - struct mbuf *m; - u_char *ptr; - int slen = strlen(cd->src_telno); - int dlen = strlen(cd->dst_telno); - int msglen = I_FRAME_HDRLEN + MSG_SETUP_LEN + slen + dlen + - (cd->bprot == BPROT_NONE ? 1 : 0); - - if (slen == 0) - msglen -= IEI_CALLINGPN_LEN+2; /* whole IE not send */ - - /* - * there is one additional octet if cd->bprot == BPROT_NONE - * NOTE: the selection of a bearer capability by a B L1 - * protocol is highly questionable and a better - * mechanism should be used in future. (-hm) - */ - - NDBGL3(L3_PRIM, "isdnif %d, cr = 0x%02x", cd->isdnif, cd->cr); - - if((m = i4b_Dgetmbuf(msglen)) == NULL) - { - panic("i4b_l3_tx_setup: can't allocate mbuf"); - } - - cd->crflag = CRF_ORIG; /* we are the originating side */ - - ptr = m->m_data + I_FRAME_HDRLEN; - - *ptr++ = PD_Q931; /* protocol discriminator */ - *ptr++ = 0x01; /* call ref length */ - *ptr++ = setup_cr(cd, cd->cr); /* call reference value */ - *ptr++ = SETUP; /* message type = setup */ - - *ptr++ = IEI_SENDCOMPL; /* sending complete */ - - *ptr++ = IEI_BEARERCAP; /* bearer capability */ - - /* XXX - * currently i have no idea if this should be switched by - * the choosen B channel protocol or if there should be a - * separate configuration item for the bearer capability. - * For now, it is switched by the choosen b protocol (-hm) - */ - - switch(cd->bprot) - { - case BPROT_NONE: /* telephony */ - *ptr++ = IEI_BEARERCAP_LEN+1; - *ptr++ = IT_CAP_SPEECH; - *ptr++ = IT_RATE_64K; - *ptr++ = IT_UL1_G711A; - break; - - case BPROT_RHDLC: /* raw HDLC */ - *ptr++ = IEI_BEARERCAP_LEN; - *ptr++ = IT_CAP_UNR_DIG_INFO; - *ptr++ = IT_RATE_64K; - break; - - default: - *ptr++ = IEI_BEARERCAP_LEN; - *ptr++ = IT_CAP_UNR_DIG_INFO; - *ptr++ = IT_RATE_64K; - break; - } - - *ptr++ = IEI_CHANNELID; /* channel id */ - *ptr++ = IEI_CHANNELID_LEN; /* channel id length */ - - switch(cd->channelid) - { - case CHAN_B1: - *ptr++ = CHANNELID_B1; - break; - case CHAN_B2: - *ptr++ = CHANNELID_B2; - break; - default: - *ptr++ = CHANNELID_ANY; - break; - } - - if (slen) { - *ptr++ = IEI_CALLINGPN; /* calling party no */ - *ptr++ = IEI_CALLINGPN_LEN+slen;/* calling party no length */ - *ptr++ = NUMBER_TYPEPLAN; /* type of number, number plan id */ - strncpy(ptr, cd->src_telno, slen); - ptr += slen; - } - - *ptr++ = IEI_CALLEDPN; /* called party no */ - *ptr++ = IEI_CALLEDPN_LEN+dlen; /* called party no length */ - *ptr++ = NUMBER_TYPEPLAN; /* type of number, number plan id */ - strncpy(ptr, cd->dst_telno, dlen); - ptr += dlen; - - i4b_dl_data_req(l2sc, l2sc->drv, m); -} - -/*---------------------------------------------------------------------------* - * send CONNECT ACKNOWLEDGE message - *---------------------------------------------------------------------------*/ -void -i4b_l3_tx_connect_ack(call_desc_t *cd) -{ - struct l2_softc *l2sc = (l2_softc_t*)cd->l3drv->l1_token; - struct mbuf *m; - u_char *ptr; - - NDBGL3(L3_PRIM, "isdnif %d, cr = 0x%02x", cd->isdnif, cd->cr); - - if((m = i4b_Dgetmbuf(I_FRAME_HDRLEN + MSG_CONNECT_ACK_LEN)) == NULL) - panic("i4b_l3_tx_connect_ack: can't allocate mbuf"); - - ptr = m->m_data + I_FRAME_HDRLEN; - - *ptr++ = PD_Q931; /* protocol discriminator */ - *ptr++ = 0x01; /* call reference length */ - *ptr++ = setup_cr(cd, cd->cr); /* call reference value */ - *ptr++ = CONNECT_ACKNOWLEDGE; /* message type = connect ack */ - - i4b_dl_data_req(l2sc, l2sc->drv, m); -} - -/*---------------------------------------------------------------------------* - * send STATUS message - *---------------------------------------------------------------------------*/ -void -i4b_l3_tx_status(call_desc_t *cd, u_char q850cause) -{ - struct l2_softc *l2sc = (l2_softc_t*)cd->l3drv->l1_token; - struct mbuf *m; - u_char *ptr; - - NDBGL3(L3_PRIM, "isdnif %d, cr = 0x%02x", cd->isdnif, cd->cr); - - if((m = i4b_Dgetmbuf(I_FRAME_HDRLEN + MSG_STATUS_LEN)) == NULL) - panic("i4b_l3_tx_status: can't allocate mbuf"); - - ptr = m->m_data + I_FRAME_HDRLEN; - - *ptr++ = PD_Q931; /* protocol discriminator */ - *ptr++ = 0x01; /* call reference length */ - *ptr++ = setup_cr(cd, cd->cr); /* call reference value */ - *ptr++ = STATUS; /* message type = connect ack */ - - *ptr++ = IEI_CAUSE; /* cause ie */ - *ptr++ = CAUSE_LEN; - *ptr++ = CAUSE_STD_LOC_OUT; - *ptr++ = q850cause | EXT_LAST; - - *ptr++ = IEI_CALLSTATE; /* call state ie */ - *ptr++ = CALLSTATE_LEN; - *ptr++ = i4b_status_tab[cd->Q931state]; - - i4b_dl_data_req(l2sc, l2sc->drv, m); -} - -/*---------------------------------------------------------------------------* - * send RELEASE message - *---------------------------------------------------------------------------*/ -void -i4b_l3_tx_release(call_desc_t *cd, int send_cause_flag) -{ - struct l2_softc *l2sc = (l2_softc_t*)cd->l3drv->l1_token; - struct mbuf *m; - u_char *ptr; - int len = I_FRAME_HDRLEN + MSG_RELEASE_LEN; - - NDBGL3(L3_PRIM, "isdnif %d, cr = 0x%02x", cd->isdnif, cd->cr); - - if(send_cause_flag == 0) - len -= 4; - - if((m = i4b_Dgetmbuf(len)) == NULL) - panic("i4b_l3_tx_release: can't allocate mbuf"); - - ptr = m->m_data + I_FRAME_HDRLEN; - - *ptr++ = PD_Q931; /* protocol discriminator */ - *ptr++ = 0x01; /* call reference length */ - *ptr++ = setup_cr(cd, cd->cr); /* call reference value */ - *ptr++ = RELEASE; /* message type = release complete */ - - if(send_cause_flag) - { - *ptr++ = IEI_CAUSE; /* cause ie */ - *ptr++ = CAUSE_LEN; - *ptr++ = CAUSE_STD_LOC_OUT; - *ptr++ = make_q931_cause(cd->cause_out); - } - - i4b_dl_data_req(l2sc, l2sc->drv, m); -} - -/*---------------------------------------------------------------------------* - * send ALERTING message - *---------------------------------------------------------------------------*/ -void -i4b_l3_tx_alert(call_desc_t *cd) -{ - struct l2_softc *l2sc = (l2_softc_t*)cd->l3drv->l1_token; - struct mbuf *m; - u_char *ptr; - - if((m = i4b_Dgetmbuf(I_FRAME_HDRLEN + MSG_ALERT_LEN)) == NULL) - panic("i4b_l3_tx_alert: can't allocate mbuf"); - - NDBGL3(L3_PRIM, "isdnif %d, cr = 0x%02x", cd->isdnif, cd->cr); - - ptr = m->m_data + I_FRAME_HDRLEN; - - *ptr++ = PD_Q931; /* protocol discriminator */ - *ptr++ = 0x01; /* call reference length */ - *ptr++ = setup_cr(cd, cd->cr); /* call reference value */ - *ptr++ = ALERT; /* message type = alert */ - - i4b_dl_data_req(l2sc, l2sc->drv, m); -} - -#endif /* NI4BQ931 > 0 */ diff --git a/sys/netisdn/i4b_l2timer.c b/sys/netisdn/i4b_l2timer.c deleted file mode 100644 index 2f2c882c3110..000000000000 --- a/sys/netisdn/i4b_l2timer.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_l2timer.c - layer 2 timer handling - * -------------------------------------- - * - * $Id: i4b_l2timer.c,v 1.11 2006/11/16 01:33:49 christos Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_l2timer.c,v 1.11 2006/11/16 01:33:49 christos Exp $"); - -#ifdef __FreeBSD__ -#include "i4bq921.h" -#else -#define NI4BQ921 1 -#endif -#if NI4BQ921 > 0 - -#include -#include -#include -#include -#include -#include - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#else -#include -#include -#endif - -#include -#include -#include -#include -#include -#include -#include - -/*---------------------------------------------------------------------------* - * Q.921 timer T200 timeout function - *---------------------------------------------------------------------------*/ -static void -i4b_T200_timeout(l2_softc_t *l2sc) -{ - NDBGL2(L2_T_ERR, "isdnif %d, RC = %d", l2sc->drv->isdnif, l2sc->RC); - i4b_next_l2state(l2sc, l2sc->drv, EV_T200EXP); -} - -/*---------------------------------------------------------------------------* - * Q.921 timer T200 start - *---------------------------------------------------------------------------*/ -void -i4b_T200_start(l2_softc_t *l2sc) -{ - if(l2sc->T200 == TIMER_ACTIVE) - return; - - NDBGL2(L2_T_MSG, "isdnif %d", l2sc->drv->isdnif); - l2sc->T200 = TIMER_ACTIVE; - - START_TIMER(l2sc->T200_callout, i4b_T200_timeout, l2sc, T200DEF); -} - -/*---------------------------------------------------------------------------* - * Q.921 timer T200 stop - *---------------------------------------------------------------------------*/ -void -i4b_T200_stop(l2_softc_t *l2sc) -{ - int s; - s = splnet(); - if(l2sc->T200 != TIMER_IDLE) - { - STOP_TIMER(l2sc->T200_callout, i4b_T200_timeout, l2sc); - l2sc->T200 = TIMER_IDLE; - } - splx(s); - NDBGL2(L2_T_MSG, "isdnif %d", l2sc->drv->isdnif); -} - -/*---------------------------------------------------------------------------* - * Q.921 timer T200 restart - *---------------------------------------------------------------------------*/ -void -i4b_T200_restart(l2_softc_t *l2sc) -{ - int s; - s = splnet(); - if(l2sc->T200 != TIMER_IDLE) - { - STOP_TIMER(l2sc->T200_callout, i4b_T200_timeout, l2sc); - } - else - { - l2sc->T200 = TIMER_ACTIVE; - } - - START_TIMER(l2sc->T200_callout, i4b_T200_timeout, l2sc, T200DEF); - splx(s); - NDBGL2(L2_T_MSG, "isdnif %d", l2sc->drv->isdnif); -} - -/*---------------------------------------------------------------------------* - * Q.921 timer T202 timeout function - *---------------------------------------------------------------------------*/ -static void -i4b_T202_timeout(l2_softc_t *l2sc) -{ - NDBGL2(L2_T_ERR, "isdnif %d, N202 = %d", l2sc->drv->isdnif, l2sc->N202); - - if(--(l2sc->N202)) - { - (*l2sc->T202func)(l2sc); - } -} - -/*---------------------------------------------------------------------------* - * Q.921 timer T202 start - *---------------------------------------------------------------------------*/ -void -i4b_T202_start(l2_softc_t *l2sc) -{ - if (l2sc->N202 == TIMER_ACTIVE) - return; - - NDBGL2(L2_T_MSG, "isdnif %d", l2sc->drv->isdnif); - l2sc->N202 = N202DEF; - l2sc->T202 = TIMER_ACTIVE; - - START_TIMER(l2sc->T202_callout, i4b_T202_timeout, l2sc, T202DEF); -} - -/*---------------------------------------------------------------------------* - * Q.921 timer T202 stop - *---------------------------------------------------------------------------*/ -void -i4b_T202_stop(l2_softc_t *l2sc) -{ - int s; - s = splnet(); - if(l2sc->T202 != TIMER_IDLE) - { - STOP_TIMER(l2sc->T202_callout, i4b_T202_timeout, l2sc); - l2sc->T202 = TIMER_IDLE; - } - splx(s); - NDBGL2(L2_T_MSG, "isdnif %d", l2sc->drv->isdnif); -} - -/*---------------------------------------------------------------------------* - * Q.921 timer T203 timeout function - *---------------------------------------------------------------------------*/ -#if I4B_T203_ACTIVE -static void -i4b_T203_timeout(l2_softc_t *l2sc) -{ - NDBGL2(L2_T_ERR, "isdnif %d", l2sc->isdnif); - i4b_next_l2state(l2sc, EV_T203EXP); -} -#endif - -/*---------------------------------------------------------------------------* - * Q.921 timer T203 start - *---------------------------------------------------------------------------*/ -void -i4b_T203_start(l2_softc_t *l2sc) -{ -#if I4B_T203_ACTIVE - if (l2sc->T203 == TIMER_ACTIVE) - return; - - NDBGL2(L2_T_MSG, "isdnif %d", l2sc->isdnif); - l2sc->T203 = TIMER_ACTIVE; - - START_TIMER(l2sc->T203_callout, i4b_T203_timeout, l2sc, T203DEF); -#endif -} - -/*---------------------------------------------------------------------------* - * Q.921 timer T203 stop - *---------------------------------------------------------------------------*/ -void -i4b_T203_stop(l2_softc_t *l2sc) -{ -#if I4B_T203_ACTIVE - int s; - s = splnet(); - if(l2sc->T203 != TIMER_IDLE) - { - STOP_TIMER(l2sc->T203_callout, i4b_T203_timeout, l2sc); - l2sc->T203 = TIMER_IDLE; - } - splx(s); - NDBGL2(L2_T_MSG, "isdnif %d", l2sc->isdnif); -#endif -} - -/*---------------------------------------------------------------------------* - * Q.921 timer T203 restart - *---------------------------------------------------------------------------*/ -void -i4b_T203_restart(l2_softc_t *l2sc) -{ -#if I4B_T203_ACTIVE - int s; - s = splnet(); - - if(l2sc->T203 != TIMER_IDLE) - { - STOP_TIMER(l2sc->T203_callout, i4b_T203_timerout, l2sc); - } - else - { - l2sc->T203 = TIMER_ACTIVE; - } - - START_TIMER(l2sc->T203_callout, i4b_T203_timerout, l2sc, T203DEF); - splx(s); - NDBGL2(L2_T_MSG, "isdnif %d", l2sc->isdnif); -#endif -} - -#endif /* NI4BQ921 > 0 */ diff --git a/sys/netisdn/i4b_l3.h b/sys/netisdn/i4b_l3.h deleted file mode 100644 index 46effe11e15a..000000000000 --- a/sys/netisdn/i4b_l3.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_l3.h - layer 3 header file - * ------------------------------ - * - * $Id: i4b_l3.h,v 1.7 2005/12/10 23:51:50 elad Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Thu Apr 27 11:07:01 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _NETISDN_I4B_L3_H_ -#define _NETISDN_I4B_L3_H_ - -extern int utoc_tab[]; -extern unsigned char cause_tab_q931[]; - -extern int i4b_aoc ( unsigned char *, call_desc_t *cd ); -extern void i4b_decode_q931 ( int isdnif, int msg_len, u_char *msg_ptr ); -extern int i4b_decode_q931_cs0_ie ( call_desc_t *cd, int msg_len, u_char *msg_ptr ); -extern void i4b_decode_q931_message ( call_desc_t *cd, u_char message_type ); -extern void i4b_l3_stop_all_timers ( call_desc_t *cd ); -extern void i4b_l3_tx_alert ( call_desc_t *cd ); -extern void i4b_l3_tx_connect ( call_desc_t *cd ); -extern void i4b_l3_tx_connect_ack ( call_desc_t *cd ); -extern void i4b_l3_tx_disconnect ( call_desc_t *cd ); -extern void i4b_l3_tx_release ( call_desc_t *cd, int send_cause_flag ); -extern void i4b_l3_tx_release_complete ( call_desc_t *cd, int send_cause_flag ); -extern void i4b_l3_tx_setup ( call_desc_t *cd ); -extern void i4b_l3_tx_status ( call_desc_t *cd, u_char q850cause ); -extern int i4b_get_dl_stat( call_desc_t *cd ); -extern void i4b_print_frame ( int len, u_char *buf ); -extern void next_l3state ( call_desc_t *cd, int event ); -extern const char *print_l3state ( call_desc_t *cd ); -extern unsigned char setup_cr ( call_desc_t *cd, unsigned char cr ); -extern void T303_start ( call_desc_t *cd ); -extern void T303_stop ( call_desc_t *cd ); -extern void T305_start ( call_desc_t *cd ); -extern void T305_stop ( call_desc_t *cd ); -extern void T308_start ( call_desc_t *cd ); -extern void T308_stop ( call_desc_t *cd ); -extern void T309_start ( call_desc_t *cd ); -extern void T309_stop ( call_desc_t *cd ); -extern void T310_start ( call_desc_t *cd ); -extern void T310_stop ( call_desc_t *cd ); -extern void T313_start ( call_desc_t *cd ); -extern void T313_stop ( call_desc_t *cd ); - -#endif /* !_NETISDN_I4B_L3_H_ */ diff --git a/sys/netisdn/i4b_l3fsm.c b/sys/netisdn/i4b_l3fsm.c deleted file mode 100644 index 8b9958004129..000000000000 --- a/sys/netisdn/i4b_l3fsm.c +++ /dev/null @@ -1,1055 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_l3fsm.c - layer 3 FSM - * ------------------------- - * - * $Id: i4b_l3fsm.c,v 1.14 2006/11/16 01:33:49 christos Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_l3fsm.c,v 1.14 2006/11/16 01:33:49 christos Exp $"); - -#ifdef __FreeBSD__ -#include "i4bq931.h" -#else -#define NI4BQ931 1 -#endif -#if NI4BQ931 > 0 - -#include -#include -#include -#include -#include -#include - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#include -#else -#include -#include -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -static void F_00A(call_desc_t *cd), F_00H(call_desc_t *cd), F_00I(call_desc_t *cd); -static void F_00J(call_desc_t *cd); - -static void F_01B(call_desc_t *cd), F_01K(call_desc_t *cd), F_01L(call_desc_t *cd); -static void F_01M(call_desc_t *cd), F_01N(call_desc_t *cd), F_01U(call_desc_t *cd); -static void F_01O(call_desc_t *cd); - -static void F_03C(call_desc_t *cd), F_03N(call_desc_t *cd), F_03O(call_desc_t *cd); -static void F_03P(call_desc_t *cd), F_03Y(call_desc_t *cd); - -static void F_04O(call_desc_t *cd); - -static void F_06D(call_desc_t *cd), F_06E(call_desc_t *cd), F_06F(call_desc_t *cd); -static void F_06G(call_desc_t *cd), F_06J(call_desc_t *cd), F_06Q(call_desc_t *cd); - -static void F_07E(call_desc_t *cd), F_07F(call_desc_t *cd), F_07G(call_desc_t *cd); - -static void F_08R(call_desc_t *cd), F_08Z(call_desc_t *cd); - -static void F_09D(call_desc_t *cd), F_09E(call_desc_t *cd), F_09F(call_desc_t *cd); -static void F_09G(call_desc_t *cd); - -static void F_11J(call_desc_t *cd), F_11Q(call_desc_t *cd), F_11V(call_desc_t *cd); - -static void F_12C(call_desc_t *cd), F_12J(call_desc_t *cd); - -static void F_19I(call_desc_t *cd), F_19J(call_desc_t *cd), F_19K(call_desc_t *cd); -static void F_19W(call_desc_t *cd); - -static void F_NCNA(call_desc_t *cd), F_STENQ(call_desc_t *cd), F_STAT(call_desc_t *cd); -static void F_INFO(call_desc_t *cd), F_RELCP(call_desc_t *cd), F_REL(call_desc_t *cd); -static void F_DISC(call_desc_t *cd), F_DCRQ(call_desc_t *cd), F_UEM(call_desc_t *cd); -static void F_SIGN(call_desc_t *cd), F_DLEI(call_desc_t *cd), F_ILL(call_desc_t *cd); -static void F_309TO(call_desc_t *cd), F_DECF(call_desc_t *cd), F_FCTY(call_desc_t *cd); -static void F_DECF1(call_desc_t *cd), F_DECF2(call_desc_t *cd), F_DECF3(call_desc_t *cd); -static void F_DLRI(call_desc_t *cd), F_DLRIA(call_desc_t *cd), F_DECF4(call_desc_t *cd); - -#if DO_I4B_DEBUG -static const char *l3state_text[N_STATES] = { - "ST_U0 - Null", - "ST_U1 - Out Init", - "ST_U3 - Out Proc", - "ST_U4 - Out Delv", - "ST_U6 - In Pres", - "ST_U7 - In Rxd", - "ST_U8 - In ConReq", - "ST_U9 - In Proc", - "ST_U10 - Active", - "ST_U11 - Disc Req", - "ST_U12 - Disc Ind", - "ST_U19 - Rel Req", - - "ST_IWA - In Wait EST-Accept", - "ST_IWR - In Wait EST-Reject", - "ST_OW - Out Wait EST", - "ST_IWL - In Wait EST-Alert", - - "ST_SUSE - Subroutine sets state", - - "Illegal State" -}; - -static const char *l3event_text[N_EVENTS] = { - "EV_SETUPRQ - L4 SETUP REQ", /* setup request from L4 */ - "EV_DISCRQ - L4 DISC REQ", /* disconnect request from L4 */ - "EV_RELRQ - L4 REL REQ", /* release request from L4 */ - "EV_ALERTRQ - L4 ALERT REQ", /* alerting request from L4 */ - "EV_SETACRS - L4 accept RSP", /* setup response accept from l4 */ - "EV_SETRJRS - L4 reject RSP", /* setup response reject from l4 */ - "EV_SETDCRS - L4 ignore RSP", /* setup response dontcare from l4 */ - - "EV_SETUP - rxd SETUP", /* incoming SETUP message from L2 */ - "EV_STATUS - rxd STATUS", /* incoming STATUS message from L2 */ - "EV_RELEASE - rxd REL", /* incoming RELEASE message from L2 */ - "EV_RELCOMP - rxd REL COMPL", /* incoming RELEASE COMPLETE from L2 */ - "EV_SETUPAK - rxd SETUP ACK", /* incoming SETUP ACK message from L2 */ - "EV_CALLPRC - rxd CALL PROC", /* incoming CALL PROCEEDING from L2 */ - "EV_ALERT - rxd ALERT", /* incoming ALERT message from L2 */ - "EV_CONNECT - rxd CONNECT", /* incoming CONNECT message from L2 */ - "EV_PROGIND - rxd PROG IND", /* incoming Progress IND from L2 */ - "EV_DISCONN - rxd DISC", /* incoming DISCONNECT message from L2 */ - "EV_CONACK - rxd CONN ACK", /* incoming CONNECT ACK message from L2 */ - "EV_STATENQ - rxd STAT ENQ", /* incoming STATUS ENQ message from L2 */ - "EV_INFO - rxd INFO", /* incoming INFO message from L2 */ - "EV_FACILITY - rxd FACILITY", /* incoming FACILITY message */ - - "EV_T303EXP - T303 timeout", /* Timer T303 expired */ - "EV_T305EXP - T305 timeout", /* Timer T305 expired */ - "EV_T308EXP - T308 timeout", /* Timer T308 expired */ - "EV_T309EXP - T309 timeout", /* Timer T309 expired */ - "EV_T310EXP - T310 timeout", /* Timer T310 expired */ - "EV_T313EXP - T313 timeout", /* Timer T313 expired */ - - "EV_DLESTIN - L2 DL_Est_Ind", /* dl establish indication from l2 */ - "EV_DLRELIN - L2 DL_Rel_Ind", /* dl release indication from l2 */ - "EV_DLESTCF - L2 DL_Est_Cnf", /* dl establish confirm from l2 */ - "EV_DLRELCF - L2 DL_Rel_Cnf", /* dl release confirm from l2 */ - - "EV_ILL - Illegal event!!" /* Illegal */ -}; -#endif - -/*---------------------------------------------------------------------------* - * layer 3 state transition table - *---------------------------------------------------------------------------*/ -struct l3state_tab { - void (*func) (call_desc_t *); /* function to execute */ - int newstate; /* next state */ -} l3state_tab[N_EVENTS][N_STATES] = { - -/* STATE: ST_U0 ST_U1 ST_U3 ST_U4 ST_U6 ST_U7 ST_U8 ST_U9 ST_U10 ST_U11 ST_U12 ST_U19 ST_IWA ST_IWR ST_OW ST_IWL ST_SUBSET ST_ILL */ -/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/*EV_SETUPRQ*/ {{F_00A, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_DISCRQ */ {{F_ILL, ST_ILL}, {F_01B, ST_U11}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_ILL, ST_ILL}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_ILL, ST_ILL}, {F_NCNA, ST_U12}, {F_ILL, ST_ILL}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_RELRQ */ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_03C, ST_U19}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_12C, ST_U19}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_ALERTRQ*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_06D, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_09D, ST_U7}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_SETACRS*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_06E, ST_SUSE}, {F_07E, ST_U8}, {F_ILL, ST_ILL}, {F_09E, ST_U8}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_SETRJRS*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_06F, ST_SUSE}, {F_07F, ST_U0}, {F_ILL, ST_ILL}, {F_09F, ST_U0}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_SETDCRS*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_06G, ST_U0}, {F_07G, ST_U0}, {F_ILL, ST_ILL}, {F_09G, ST_U0}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/* STATE: ST_U0 ST_U1 ST_U3 ST_U4 ST_U6 ST_U7 ST_U8 ST_U9 ST_U10 ST_U11 ST_U12 ST_U19 ST_IWA ST_IWR ST_OW ST_IWL ST_SUBSET ST_ILL */ -/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/*EV_SETUP */ {{F_00H, ST_U6}, {F_SIGN, ST_U1}, {F_SIGN, ST_U3}, {F_SIGN, ST_U4}, {F_SIGN, ST_U6}, {F_SIGN, ST_U7}, {F_SIGN, ST_U8}, {F_SIGN, ST_U9}, {F_SIGN, ST_U10}, {F_SIGN, ST_U11}, {F_SIGN, ST_U12}, {F_SIGN, ST_U19}, {F_SIGN, ST_IWA}, {F_SIGN, ST_IWR}, {F_SIGN, ST_OW}, {F_SIGN, ST_IWL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_STATUS */ {{F_00I, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_19I, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_RELEASE*/ {{F_00J, ST_U0}, {F_UEM, ST_SUSE}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_06J, ST_U0}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_11J, ST_U0}, {F_12J, ST_U0}, {F_19J, ST_U0}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_RELCOMP*/ {{F_NCNA, ST_U0}, {F_01K, ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_19K, ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_SETUPAK*/ {{F_UEM, ST_SUSE}, {F_01L, ST_U3}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_CALLPRC*/ {{F_UEM, ST_SUSE}, {F_01M, ST_U3}, {F_NCNA, ST_U3}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_ALERT */ {{F_UEM, ST_SUSE}, {F_01N, ST_U4}, {F_03N, ST_U4}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_CONNECT*/ {{F_UEM, ST_SUSE}, {F_01O, ST_U10}, {F_03O, ST_U10}, {F_04O, ST_U10}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_PROGIND*/ {{F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_03P, ST_U3}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_DISCONN*/ {{F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_06Q, ST_U12}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_11Q, ST_U19}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_CONACK */ {{F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_08R, ST_U10}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_STATENQ*/ {{F_STENQ,ST_U0}, {F_STENQ,ST_U1}, {F_STENQ,ST_U3}, {F_STENQ,ST_U4}, {F_STENQ,ST_U6}, {F_STENQ,ST_U7}, {F_STENQ,ST_U8}, {F_STENQ,ST_U9}, {F_STENQ,ST_U10}, {F_STENQ,ST_U11}, {F_STENQ,ST_U12}, {F_STENQ,ST_U19}, {F_STENQ,ST_IWA}, {F_STENQ,ST_IWR}, {F_STENQ,ST_OW}, {F_STENQ,ST_OW}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_INFO */ {{F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_INFO, ST_U3}, {F_INFO, ST_U4}, {F_UEM, ST_SUSE}, {F_INFO, ST_U7}, {F_INFO, ST_U8}, {F_INFO, ST_U9}, {F_INFO, ST_U10}, {F_INFO, ST_U11}, {F_INFO, ST_U12}, {F_UEM, ST_SUSE}, {F_INFO, ST_IWA}, {F_INFO, ST_IWR}, {F_INFO, ST_OW}, {F_INFO, ST_OW}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_FACILITY*/ {{F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/* STATE: ST_U0 ST_U1 ST_U3 ST_U4 ST_U6 ST_U7 ST_U8 ST_U9 ST_U10 ST_U11 ST_U12 ST_U19 ST_IWA ST_IWR ST_OW ST_IWL ST_SUBSET ST_ILL */ -/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/*EV_T303EXP*/ {{F_ILL, ST_ILL}, {F_01U, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_T305EXP*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_11V, ST_U19}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_T308EXP*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_19W, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_T309EXP*/ {{F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_T310EXP*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_03Y, ST_U11}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_T313EXP*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_08Z, ST_U11}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/* STATE: ST_U0 ST_U1 ST_U3 ST_U4 ST_U6 ST_U7 ST_U8 ST_U9 ST_U10 ST_U11 ST_U12 ST_U19 ST_IWA ST_IWR ST_OW ST_IWL ST_SUBSET ST_ILL */ -/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/*EV_DLESTIN*/ {{F_ILL, ST_ILL}, {F_DLEI, ST_U1}, {F_DLEI, ST_U3}, {F_DLEI, ST_U4}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_DLRELIN*/ {{F_NCNA, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRIA,ST_U10}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_DLESTCF*/ {{F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF2,ST_U8}, {F_DECF3,ST_U0}, {F_DECF1,ST_U1}, {F_DECF4,ST_U7}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_DLRELCF*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_ILL */ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}} -}; - -/*---------------------------------------------------------------------------* - * event handler - *---------------------------------------------------------------------------*/ -void next_l3state(call_desc_t *cd, int event) -{ - int currstate, newstate; - - if(event > N_EVENTS) - panic("i4b_l3fsm.c: event > N_EVENTS"); - - currstate = cd->Q931state; - - if(currstate > N_STATES) - panic("i4b_l3fsm.c: currstate > N_STATES"); - - newstate = l3state_tab[event][currstate].newstate; - - if(newstate > N_STATES) - panic("i4b_l3fsm.c: newstate > N_STATES"); - - NDBGL3(L3_F_MSG, "L3 FSM event [%s]: [%s => %s]", - l3event_text[event], - l3state_text[currstate], - l3state_text[newstate]); - - /* execute function */ - - (*l3state_tab[event][currstate].func)(cd); - - if(newstate == ST_ILL) - { - newstate = currstate; - NDBGL3(L3_F_ERR, "FSM illegal state, state = %s, event = %s!", - l3state_text[newstate], - l3event_text[event]); - } - - if(newstate != ST_SUSE) - cd->Q931state = newstate; -} - -#if DO_I4B_DEBUG -/*---------------------------------------------------------------------------* - * return pointer to current state description - *---------------------------------------------------------------------------*/ -const char *print_l3state(call_desc_t *cd) -{ - return(l3state_text[cd->Q931state]); -} -#endif - -/*---------------------------------------------------------------------------* - * L3 FSM state U0 event L4 setup req - *---------------------------------------------------------------------------*/ -static void F_00A(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_00A executing"); - - if(i4b_get_dl_stat(cd) == DL_DOWN) - { - struct l2_softc * l2sc = (l2_softc_t*)cd->l3drv->l1_token; - i4b_dl_establish_req(l2sc, l2sc->drv); - cd->Q931state = ST_OW; - } - else - { - i4b_l3_tx_setup(cd); - cd->Q931state = ST_U1; - } - - cd->T303_first_to = 1; - T303_start(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U0 event SETUP from L2 - *---------------------------------------------------------------------------*/ -static void F_00H(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_00H executing"); - i4b_l4_connect_ind(cd); /* tell l4 we have an incoming setup */ -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U0 event STATUS from L2 - *---------------------------------------------------------------------------*/ -static void F_00I(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_00I executing"); - - if(cd->call_state != 0) - { - cd->cause_out = 101; - i4b_l3_tx_release_complete(cd, 1); /* 1 = send cause */ - } - cd->Q931state = ST_U0; -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U0 event RELEASE from L2 - *---------------------------------------------------------------------------*/ -static void F_00J(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_00J executing"); - i4b_l3_tx_release_complete(cd, 0); /* 0 = don't send cause */ -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U1 event disconnect req from L4 - *---------------------------------------------------------------------------*/ -static void F_01B(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_01B executing"); - /* cause from L4 */ - i4b_l3_tx_disconnect(cd); - T303_stop(cd); - T305_start(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U1 event RELEASE COMPLETE from L2 - *---------------------------------------------------------------------------*/ -static void F_01K(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_01K executing"); - T303_stop(cd); - i4b_l4_disconnect_ind(cd); /* tell l4 we were rejected */ - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U1 event SETUP ACK from L2 - *---------------------------------------------------------------------------*/ -static void F_01L(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_01L executing"); - T303_stop(cd); - - /* - * since this implementation does NOT support overlap sending, - * we react here as if we received a CALL PROCEEDING because - * several PBX's react with a SETUP ACK even if the called - * number is complete AND we sent a SENDING COMPLETE in the - * preceding SETUP message. (-hm) - */ - - T310_start(cd); - i4b_l4_proceeding_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U1 event CALL PROCEEDING from L2 - *---------------------------------------------------------------------------*/ -static void F_01M(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_01M executing"); - T303_stop(cd); - T310_start(cd); - i4b_l4_proceeding_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U1 event ALERT from L2 (XXX !) - *---------------------------------------------------------------------------*/ -static void F_01N(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_01N executing"); - T303_stop(cd); - i4b_l4_alert_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U1 event CONNECT from L2 (XXX !) - *---------------------------------------------------------------------------*/ -static void F_01O(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_01O executing"); - T303_stop(cd); - i4b_l3_tx_connect_ack(cd); - i4b_l4_connect_active_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U1 event T303 timeout - *---------------------------------------------------------------------------*/ -static void F_01U(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_01U executing"); - if(cd->T303_first_to == 1) - { - cd->T303_first_to = 0; - i4b_l3_tx_setup(cd); - T303_start(cd); - cd->Q931state = ST_U1; - } - else - { - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); - cd->Q931state = ST_U0; - } -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U3 event release req from L4 - *---------------------------------------------------------------------------*/ -static void F_03C(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_03C executing"); - T310_stop(cd); - cd->cause_out = 6; - i4b_l3_tx_release(cd, 1); /* 0 = don't send cause */ - cd->T308_first_to = 1; - T308_start(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U3 event ALERT from L2 - *---------------------------------------------------------------------------*/ -static void F_03N(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_03N executing"); - T310_stop(cd); - i4b_l4_alert_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U3 event CONNECT from L2 - *---------------------------------------------------------------------------*/ -static void F_03O(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_03O executing"); - T310_stop(cd); - i4b_l3_tx_connect_ack(cd); /* CONNECT ACK to network */ - i4b_l4_connect_active_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U3 event PROGESS IND from L2 - *---------------------------------------------------------------------------*/ -static void F_03P(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_03P executing"); - T310_stop(cd); -#ifdef NOTDEF - i4b_l4_progress_ind(cd); -#endif -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U3 event T310 timeout - *---------------------------------------------------------------------------*/ -static void F_03Y(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_03Y executing"); - cd->cause_out = 102; /* recovery on timer expiry */ - i4b_l3_tx_disconnect(cd); - T305_start(cd); - i4b_l4_disconnect_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U4 event CONNECT from L2 - *---------------------------------------------------------------------------*/ -static void F_04O(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_04O executing"); - i4b_l3_tx_connect_ack(cd); /* CONNECT ACK to network */ - i4b_l4_connect_active_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U6 event alert req from L4 - *---------------------------------------------------------------------------*/ -static void F_06D(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_06D executing"); - - if(i4b_get_dl_stat(cd) == DL_DOWN) - { - struct l2_softc * l2sc = (l2_softc_t*)cd->l3drv->l1_token; - i4b_dl_establish_req(l2sc, l2sc->drv); - cd->Q931state = ST_IWL; - } - else - { - i4b_l3_tx_alert(cd); - cd->Q931state = ST_U7; - } -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U6 event incoming setup accept from L4 - *---------------------------------------------------------------------------*/ -static void F_06E(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_06E executing"); - - if(i4b_get_dl_stat(cd) == DL_DOWN) - { - struct l2_softc * l2sc = (l2_softc_t*)cd->l3drv->l1_token; - i4b_dl_establish_req(l2sc, l2sc->drv); - cd->Q931state = ST_IWA; - } - else - { - i4b_l3_tx_connect(cd); - cd->Q931state = ST_U8; - } - T313_start(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U6 event incoming setup reject from L4 - *---------------------------------------------------------------------------*/ -static void F_06F(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_06F executing"); - - if(i4b_get_dl_stat(cd) == DL_DOWN) - { - struct l2_softc * l2sc = (l2_softc_t*)cd->l3drv->l1_token; - i4b_dl_establish_req(l2sc, l2sc->drv); - cd->Q931state = ST_IWR; - } - else - { - int s = splnet(); - i4b_l3_tx_release_complete(cd, 1); - cd->Q931state = ST_U0; - freecd_by_cd(cd); - splx(s); - } -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U6 event incoming setup ignore from L4 - *---------------------------------------------------------------------------*/ -static void F_06G(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_06G executing"); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U6 event RELEASE from L2 - *---------------------------------------------------------------------------*/ -static void F_06J(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_06J executing"); - i4b_l3_tx_release_complete(cd, 0); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U6 event DISCONNECT from L2 - *---------------------------------------------------------------------------*/ -static void F_06Q(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_06Q executing"); - i4b_l4_disconnect_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U7 event setup response accept from L4 - *---------------------------------------------------------------------------*/ -static void F_07E(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_07E executing"); - i4b_l3_tx_connect(cd); - T313_start(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U7 event setup response reject from L4 - *---------------------------------------------------------------------------*/ -static void F_07F(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_07F executing"); - i4b_l3_tx_release_complete(cd, 1); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U7 event setup response ignore from L4 - *---------------------------------------------------------------------------*/ -static void F_07G(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_07G executing"); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U8 event CONNECT ACK from L2 - *---------------------------------------------------------------------------*/ -static void F_08R(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_08R executing"); - T313_stop(cd); - i4b_l4_connect_active_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U8 event T313 timeout - *---------------------------------------------------------------------------*/ -static void F_08Z(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_08Z executing"); - cd->cause_out = 102; /* recovery on timer expiry */ - i4b_l3_tx_disconnect(cd); - T305_start(cd); - i4b_l4_disconnect_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U9 event alert req from L4 - *---------------------------------------------------------------------------*/ -static void F_09D(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_09D executing"); - i4b_l3_tx_alert(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U9 event setup response accept from L4 - *---------------------------------------------------------------------------*/ -static void F_09E(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_09E executing"); - i4b_l3_tx_connect(cd); - T313_start(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U9 event setup response reject from L4 - *---------------------------------------------------------------------------*/ -static void F_09F(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_09F executing"); - i4b_l3_tx_release_complete(cd, 1); - freecd_by_cd(cd); -} -/*---------------------------------------------------------------------------* - * L3 FSM state U9 event setup response ignore from L4 - *---------------------------------------------------------------------------*/ -static void F_09G(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_09G executing"); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U11 event RELEASE from L2 - *---------------------------------------------------------------------------*/ -static void F_11J(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_11J executing"); - T305_stop(cd); - i4b_l3_tx_release_complete(cd, 0); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U11 event DISCONNECT from L2 - *---------------------------------------------------------------------------*/ -static void F_11Q(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_11Q executing"); - T305_stop(cd); - i4b_l3_tx_release(cd, 0); - cd->T308_first_to = 1; - T308_start(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U11 event T305 timeout - *---------------------------------------------------------------------------*/ -static void F_11V(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_11V executing"); - cd->cause_out = 102; - i4b_l3_tx_release(cd, 1); - cd->T308_first_to = 1; - T308_start(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U12 event release req from L4 - *---------------------------------------------------------------------------*/ -static void F_12C(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_12C executing"); - i4b_l3_tx_release(cd, 1); - cd->T308_first_to = 1; - T308_start(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U12 event RELEASE from L2 - *---------------------------------------------------------------------------*/ -static void F_12J(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_12J executing"); - i4b_l3_tx_release_complete(cd, 0); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U19 event STATUS from L2 - *---------------------------------------------------------------------------*/ -static void F_19I(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_19I executing"); - - if(cd->call_state == 0) - { - i4b_l4_status_ind(cd); - freecd_by_cd(cd); - cd->Q931state = ST_U0; - } - else - { - cd->Q931state = ST_U19; - } -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U19 event RELEASE from L2 - *---------------------------------------------------------------------------*/ -static void F_19J(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_19J executing"); - T308_stop(cd); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U19 event RELEASE COMPLETE from L2 - *---------------------------------------------------------------------------*/ -static void F_19K(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_19K executing"); - T308_stop(cd); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U19 event T308 timeout - *---------------------------------------------------------------------------*/ -static void F_19W(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_19W executing"); - if(cd->T308_first_to == 0) - { - cd->T308_first_to = 1; - i4b_l3_tx_release(cd, 0); - T308_start(cd); - cd->Q931state = ST_U19; - } - else - { - cd->T308_first_to = 0; - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); - cd->Q931state = ST_U0; - } -} - -/*---------------------------------------------------------------------------* - * L3 FSM routine no change no action - *---------------------------------------------------------------------------*/ -static void F_NCNA(call_desc_t *cd) -{ -} - -/*---------------------------------------------------------------------------* - * L3 FSM any state event STATUS ENQ from L2 - *---------------------------------------------------------------------------*/ -static void F_STENQ(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_STENQ executing"); - i4b_l3_tx_status(cd, CAUSE_Q850_STENQRSP); /* 30, resonse to stat enq */ -} - -/*---------------------------------------------------------------------------* - * L3 FSM any state except 0 & 19 event STATUS from L2 - *---------------------------------------------------------------------------*/ -static void F_STAT(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_STAT executing"); - if(cd->call_state == 0) - { - i4b_l4_status_ind(cd); - cd->Q931state = ST_U0; - freecd_by_cd(cd); - } - else - { - /* XXX !!!!!!!!!!!!!!!!!! */ - - i4b_l4_status_ind(cd); - cd->cause_out = 101; /* message not compatible with call state */ - i4b_l3_tx_disconnect(cd); - T305_start(cd); - cd->Q931state = ST_U11; - } -} - -/*---------------------------------------------------------------------------* - * L3 FSM some states event INFORMATION from L2 - *---------------------------------------------------------------------------*/ -static void F_INFO(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_INFO executing"); - i4b_l4_info_ind(cd); - /* remain in current state */ -} - -/*---------------------------------------------------------------------------* - * L3 FSM some states event RELEASE COMPLETE from L2 - *---------------------------------------------------------------------------*/ -static void F_RELCP(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_RELCP executing"); - i4b_l3_stop_all_timers(cd); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM some states event RELEASE from L2 - *---------------------------------------------------------------------------*/ -static void F_REL(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_REL executing"); - i4b_l3_stop_all_timers(cd); - i4b_l3_tx_release_complete(cd, 0); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM some states event DISCONNECT from L2 - *---------------------------------------------------------------------------*/ -static void F_DISC(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_DISC executing"); - i4b_l3_stop_all_timers(cd); - - /* - * no disconnect ind to L4, no jump to state U12 - * instead we issue a RELEASE and jump to U19 - */ - - i4b_l3_tx_release(cd, 0); - cd->T308_first_to = 1; - T308_start(cd); - cd->Q931state = ST_U19; -} - -/*---------------------------------------------------------------------------* - * L3 FSM some states event disconnect request from L4 - *---------------------------------------------------------------------------*/ -static void F_DCRQ(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_DCRQ executing"); - - /* stop T310 in case this is the result of an incoming call for a */ - /* calledback connection */ - - if(cd->T310 == TIMER_ACTIVE) - T310_stop(cd); - - /* cause from L4 */ - i4b_l3_tx_disconnect(cd); - T305_start(cd); - cd->Q931state = ST_U11; -} - -/*---------------------------------------------------------------------------* - * L3 FSM any state except 0 event unexpected message from L2 - *---------------------------------------------------------------------------*/ -static void F_UEM(call_desc_t *cd) -{ - NDBGL3(L3_F_ERR, "FSM function F_UEM executing, state = %s", print_l3state(cd)); - i4b_l3_tx_status(cd, CAUSE_Q850_MSGNCWCS); /* 101, message not compatible with call state */ -} - -/*---------------------------------------------------------------------------* - * L3 FSM any state except 0 event SETUP from L2 - *---------------------------------------------------------------------------*/ -static void F_SIGN(call_desc_t *cd) -{ - NDBGL3(L3_F_ERR, "FSM function F_SIGN executing"); - - (void)cd; -/* XXX */ /* freecd_by_cd(cd); ?????????? XXX */ -} - -/*---------------------------------------------------------------------------* - * L3 FSM relevant states event DL ESTABLISH IND from L2 - *---------------------------------------------------------------------------*/ -static void F_DLEI(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_DLEI executing"); - -/* XXX */ - - /* remain in current state */ -} - -/*---------------------------------------------------------------------------* - * L3 FSM any state event illegal event occurred - *---------------------------------------------------------------------------*/ -static void F_ILL(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_ILL executing"); -} - -/*---------------------------------------------------------------------------* - * L3 FSM any state event T309 timeout - *---------------------------------------------------------------------------*/ -static void F_309TO(call_desc_t *cd) -{ - NDBGL3(L3_F_ERR, "FSM function F_309TO executing"); - -/* XXX */ - -#ifdef NOTDEF - i4b_l4_dl_fail_ind(cd); -#endif - - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM any state event FACILITY message received - *---------------------------------------------------------------------------*/ -static void F_FCTY(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_FCTY executing"); - /* ST_SUSE, no change in state ! */ -} - -/*---------------------------------------------------------------------------* - * L3 FSM state ST_OW event DL ESTABLISH CONF from L2 - *---------------------------------------------------------------------------*/ -static void F_DECF1(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_DECF1 executing"); - i4b_l3_tx_setup(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state ST_IWA event DL ESTABLISH CONF from L2 - *---------------------------------------------------------------------------*/ -static void F_DECF2(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_DECF2 executing"); - i4b_l3_tx_connect(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state ST_IWR event DL ESTABLISH CONF from L2 - *---------------------------------------------------------------------------*/ -static void F_DECF3(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_DECF3 executing"); - i4b_l3_tx_release_complete(cd, 1); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state ST_IWL event DL ESTABLISH CONF from L2 - *---------------------------------------------------------------------------*/ -static void F_DECF4(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_DECF4 executing"); - i4b_l3_tx_alert(cd); -} - - -/*---------------------------------------------------------------------------* - * L3 FSM any state event DL ESTABLISH CONF from L2 - *---------------------------------------------------------------------------*/ -static void F_DECF(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_DECF executing"); - T309_stop(cd); - i4b_l3_tx_status(cd, CAUSE_Q850_NORMUNSP); /* 31, normal unspecified */ -} - -/*---------------------------------------------------------------------------* - * L3 FSM any state except U10 event DL RELEASE IND from L2 - *---------------------------------------------------------------------------*/ -static void F_DLRI(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_DLRI executing"); - i4b_l3_stop_all_timers(cd); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U10 event DL RELEASE IND from L2 - *---------------------------------------------------------------------------*/ -static void F_DLRIA(call_desc_t *cd) -{ - struct l2_softc * l2sc = (l2_softc_t*)cd->l3drv->l1_token; - NDBGL3(L3_F_MSG, "FSM function F_DLRIA executing"); - - if(cd->T309 == TIMER_IDLE) - T309_start(cd); - - i4b_dl_establish_req(l2sc, l2sc->drv); -} - -#endif /* NI4BQ931 > 0 */ diff --git a/sys/netisdn/i4b_l3fsm.h b/sys/netisdn/i4b_l3fsm.h deleted file mode 100644 index 17c730783be1..000000000000 --- a/sys/netisdn/i4b_l3fsm.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_l3fsm.c - layer 3 FSM - * ------------------------- - * - * $Id: i4b_l3fsm.h,v 1.3 2005/12/10 23:51:50 elad Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Thu Apr 27 11:07:16 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _NETISDN_I4B_L3FSM_H_ -#define _NETISDN_I4B_L3FSM_H_ - -enum Q931_states { - ST_U0, - ST_U1, - ST_U3, - ST_U4, - ST_U6, - ST_U7, - ST_U8, - ST_U9, - ST_U10, - ST_U11, - ST_U12, - ST_U19, - - ST_IWA, /* incoming call, wait establish, then accept */ - ST_IWR, /* incoming call, wait establish, then reject */ - ST_OW, /* outgoing call, wait establish */ - ST_IWL, /* incoming call, wait establish, then alert */ - - ST_SUSE, /* SUBroutine SETs new state on exit */ - ST_ILL, /* Illegal */ - - N_STATES /* number of states */ -}; - -enum Q931_events { - - EV_SETUPRQ, /* setup request from L4 */ - EV_DISCRQ, /* disconnect request from L4 */ - EV_RELRQ, /* release request from L4 */ - EV_ALERTRQ, /* alerting request from L4 */ - EV_SETACRS, /* setup response accept from l4 */ - EV_SETRJRS, /* setup response reject from l4 */ - EV_SETDCRS, /* setup response dontcare from l4 */ - - EV_SETUP, /* incoming SETUP message from L2 */ - EV_STATUS, /* incoming STATUS message from L2 */ - EV_RELEASE, /* incoming RELEASE message from L2 */ - EV_RELCOMP, /* incoming RELEASE COMPLETE from L2 */ - EV_SETUPAK, /* incoming SETUP ACK message from L2 */ - EV_CALLPRC, /* incoming CALL PROCEEDING from L2 */ - EV_ALERT, /* incoming ALERT message from L2 */ - EV_CONNECT, /* incoming CONNECT message from L2 */ - EV_PROGIND, /* incoming Progress IND from L2 */ - EV_DISCONN, /* incoming DISCONNECT message from L2 */ - EV_CONACK, /* incoming CONNECT ACK message from L2 */ - EV_STATENQ, /* incoming STATUS ENQ message from L2 */ - EV_INFO, /* incoming INFO message from L2 */ - EV_FACILITY, /* FACILITY message */ - - EV_T303EXP, /* Timer T303 expired */ - EV_T305EXP, /* Timer T305 expired */ - EV_T308EXP, /* Timer T308 expired */ - EV_T309EXP, /* Timer T309 expired */ - EV_T310EXP, /* Timer T310 expired */ - EV_T313EXP, /* Timer T313 expired */ - - EV_DLESTIN, /* dl establish indication from l2 */ - EV_DLRELIN, /* dl release indication from l2 */ - EV_DLESTCF, /* dl establish confirm from l2 */ - EV_DLRELCF, /* dl release indication from l2 */ - - EV_ILL, /* Illegal */ - N_EVENTS -}; - -#endif /* !_NETISDN_I4B_L3FSM_H_ */ diff --git a/sys/netisdn/i4b_l3l4.h b/sys/netisdn/i4b_l3l4.h deleted file mode 100644 index fe4094d6f3a3..000000000000 --- a/sys/netisdn/i4b_l3l4.h +++ /dev/null @@ -1,298 +0,0 @@ -/* $NetBSD: i4b_l3l4.h,v 1.17 2005/12/10 23:51:50 elad Exp $ */ - -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_l3l4.h - layer 3 / layer 4 interface - * ------------------------------------------ - * - * $Id: i4b_l3l4.h,v 1.17 2005/12/10 23:51:50 elad Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jun 2 14:29:35 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _NETISDN_I4B_L3L4_H_ -#define _NETISDN_I4B_L3L4_H_ - -#define T303VAL (hz*4) /* 4 seconds timeout */ -#define T305VAL (hz*30) /* 30 seconds timeout */ -#define T308VAL (hz*4) /* 4 seconds timeout */ -#define T309VAL (hz*90) /* 90 seconds timeout */ -#define T310VAL (hz*60) /* 30-120 seconds timeout */ -#define T313VAL (hz*4) /* 4 seconds timeout */ -#define T400DEF (hz*10) /* 10 seconds timeout */ - -#define MAX_BCHAN 2 -#define N_CALL_DESC (20*(MAX_BCHAN)) /* XXX: make resizable */ - -typedef struct bchan_statistics { - int outbytes; - int inbytes; -} bchan_statistics_t; - -/*---------------------------------------------------------------------------* - * table of things the driver needs to know about the b channel - * it is connected to for data transfer - *---------------------------------------------------------------------------*/ -typedef struct i4b_isdn_bchan_linktab { - void* l1token; - int channel; - const struct isdn_l4_bchannel_functions *bchannel_driver; - struct ifqueue *tx_queue; - struct ifqueue *rx_queue; /* data xfer for NON-HDLC traffic */ - struct mbuf **rx_mbuf; /* data xfer for HDLC based traffic */ -} isdn_link_t; - -struct isdn_l4_driver_functions; -struct isdn_l3_driver; - -/*---------------------------------------------------------------------------* - * this structure describes one call/connection on one B-channel - * and all its parameters - *---------------------------------------------------------------------------*/ -typedef struct call_desc -{ - u_int cdid; /* call descriptor id */ - int isdnif; /* isdn interface number */ - struct isdn_l3_driver *l3drv; - int cr; /* call reference value */ - - int crflag; /* call reference flag */ -#define CRF_ORIG 0 /* originating side */ -#define CRF_DEST 1 /* destinating side */ - - int channelid; /* channel id value */ - int channelexcl; /* channel exclusive */ - - int bprot; /* B channel protocol BPROT_XXX */ - - int bchan_driver_index; /* driver to use for B channel */ - int bchan_driver_unit; /* unit for above driver number */ - - cause_t cause_in; /* cause value from NT */ - cause_t cause_out; /* cause value to NT */ - - int call_state; /* from incoming SETUP */ - - u_char dst_telno[TELNO_MAX]; /* destination number */ - u_char src_telno[TELNO_MAX]; /* source number */ - u_char src_subaddr[SUBADDR_MAX]; - u_char dest_subaddr[SUBADDR_MAX]; - - int scr_ind; /* screening ind for incoming call */ - int prs_ind; /* presentation ind for incoming call */ - int type_plan; /* type and plan for incoming number */ - - int Q931state; /* Q.931 state for call */ - int event; /* event to be processed */ - - int response; /* setup response type */ - - int T303; /* SETUP sent response timeout */ - int T303_first_to; /* first timeout flag */ - - int T305; /* DISC without PROG IND */ - - int T308; /* RELEASE sent response timeout*/ - int T308_first_to; /* first timeout flag */ - - int T309; /* data link disconnect timeout */ - - int T310; /* CALL PROC received */ - - int T313; /* CONNECT sent timeout */ - - int T400; /* L4 timeout */ - - isdn_link_t *ilt; /* isdn B channel driver/state */ - const struct isdn_l4_driver_functions *l4_driver; /* layer 4 driver */ - void *l4_driver_softc; /* layer 4 driver instance */ - - int dir; /* outgoing or incoming call */ -#define DIR_OUTGOING 0 -#define DIR_INCOMING 1 - - int timeout_active; /* idle timeout() active flag */ - - struct callout idle_timeout_handle; - struct callout T303_callout; - struct callout T305_callout; - struct callout T308_callout; - struct callout T309_callout; - struct callout T310_callout; - struct callout T313_callout; - struct callout T400_callout; - int callouts_inited; /* must init before use */ - - int idletime_state; /* wait for idle_time begin */ -#define IST_IDLE 0 /* shorthold mode disabled */ -#define IST_NONCHK 1 /* in non-checked window */ -#define IST_CHECK 2 /* in idle check window */ -#define IST_SAFE 3 /* in safety zone */ - - time_t idletimechk_start; /* check idletime window start */ - time_t connect_time; /* time connect was made */ - time_t last_active_time; /* last time with activity */ - - /* for incoming connections: */ - time_t max_idle_time; /* max time without activity */ - - /* for outgoing connections: */ - msg_shorthold_t shorthold_data; /* shorthold data to use */ - - int aocd_flag; /* AOCD used for unitlength calc*/ - time_t last_aocd_time; /* last time AOCD received */ - int units; /* number of AOCD charging units*/ - int units_type; /* units type: AOCD, AOCE */ - int cunits; /* calculated units */ - - int isdntxdelay; /* isdn tx delay after connect */ - - u_char display[DISPLAY_MAX]; /* display information element */ - char datetime[DATETIME_MAX]; /* date/time information element*/ -} call_desc_t; - -extern call_desc_t call_desc[]; -extern int num_call_desc; - -/* - * Set of functions layer 4 drivers calls to manipulate the B channel - * they are using. - */ -struct isdn_l4_bchannel_functions { - void (*bch_config)(void*, int channel, int bprot, int updown); - void (*bch_tx_start)(void*, int channel); - void (*bch_stat)(void*, int channel, bchan_statistics_t *bsp); -}; - -/* - * Functions a layer 4 application driver exports - */ -struct isdn_l4_driver_functions { - /* - * Functions for use by the B channel driver - */ - void (*bch_rx_data_ready)(void *softc); - void (*bch_tx_queue_empty)(void *softc); - void (*bch_activity)(void *softc, int rxtx); -#define ACT_RX 0 -#define ACT_TX 1 - void (*line_connected)(void *softc, void *cde); - void (*line_disconnected)(void *softc, void *cde); - void (*dial_response)(void *softc, int stat, cause_t cause); - void (*updown_ind)(void *softc, int updown); - /* - * Functions used by the ISDN management system - */ - void* (*get_softc)(int unit); - void (*set_linktab)(void *softc, isdn_link_t *ilt); - /* - * Optional accounting function - */ - time_t (*get_idletime)(void* softc); -}; - -/* global registry of layer 4 drivers */ -int isdn_l4_driver_attach(const char *name, int units, const struct isdn_l4_driver_functions *driver); -int isdn_l4_driver_detatch(const char *name); -int isdn_l4_find_driverid(const char *name); -const struct isdn_l4_driver_functions *isdn_l4_find_driver(const char *name, int unit); -const struct isdn_l4_driver_functions *isdn_l4_get_driver(int driver_id, int unit); - -/* forward decl. */ -struct isdn_diagnostic_request; -struct isdn_dr_prot; - -/* - * functions exported by a layer 3 driver to layer 4 - */ -struct isdn_l3_driver_functions { - isdn_link_t* (*get_linktab)(void*, int channel); - void (*set_l4_driver)(void*, int channel, const struct isdn_l4_driver_functions *l4_driver, void *l4_driver_softc); - - void (*N_CONNECT_REQUEST) (struct call_desc *cd); - void (*N_CONNECT_RESPONSE) (struct call_desc *cd, int, int); - void (*N_DISCONNECT_REQUEST) (struct call_desc *cd, int); - void (*N_ALERT_REQUEST) (struct call_desc *cd); - int (*N_DOWNLOAD) (void*, int numprotos, struct isdn_dr_prot *protocols); - int (*N_DIAGNOSTICS) (void*, struct isdn_diagnostic_request*); - void (*N_MGMT_COMMAND) (struct isdn_l3_driver *, int cmd, void *); -}; - -/*---------------------------------------------------------------------------* - * This structure "describes" one ISDN interface (typically identical - * to one controller, but when one controller drives multiple ISDN's, - * this is just one of those ISDN's). - * - * An ISDN can be either a Basic Rate Interface (BRI, 2 B channels) - * or a Primary Rate Interface (PRI, 30 B channels). - *---------------------------------------------------------------------------*/ -struct isdn_l3_driver { - SLIST_ENTRY(isdn_l3_driver) l3drvq; - void* l1_token; /* softc of hardware driver, actually - * this is the l2_softc (!!) for - * passive cards, and something else - * for active cards (maybe actually - * the softc there) */ - int isdnif; /* ISDN id assigned to this */ - char *devname; /* pointer to autoconf identifier */ - /* e.g. "isic0" or "daic0 port 2" */ - char *card_name; /* type of card */ - - int protocol; /* D-channel protocol type */ - - int dl_est; /* layer 2 established */ -#define DL_DOWN 0 -#define DL_UP 1 - - int nbch; /* number of B-channels */ - int *bch_state; /* states of the nbch b channels */ -#define BCH_ST_FREE 0 /* free to be used, idle */ -#define BCH_ST_RSVD 1 /* reserved, may become free or used */ -#define BCH_ST_USED 2 /* in use for data transfer */ - - int tei; /* current tei or -1 if invalid */ - - /* pointers to functions to be called from L4 */ - const struct isdn_l3_driver_functions * l3driver; -}; - -#define NBCH_BRI 2 -#define NBCH_PRI 30 - -void i4b_l4_contr_ev_ind(int controller, int attach); -struct isdn_l3_driver * isdn_attach_isdnif(const char *devname, - const char *cardname, void *l1_token, - const struct isdn_l3_driver_functions * l3driver, int nbch); -int isdn_detach_isdnif(struct isdn_l3_driver *); -void isdn_isdnif_ready(int isdnif); -struct isdn_l3_driver *isdn_find_l3_by_isdnif(int isdnif); -int isdn_count_isdnif(int *max_isdnif); - -#endif /* !_NETISDN_I4B_Q931_H_ */ diff --git a/sys/netisdn/i4b_l3timer.c b/sys/netisdn/i4b_l3timer.c deleted file mode 100644 index f2a3389111f5..000000000000 --- a/sys/netisdn/i4b_l3timer.c +++ /dev/null @@ -1,355 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_l3timer.c - timer and timeout handling for layer 3 - * ------------------------------------------------------ - * - * $Id: i4b_l3timer.c,v 1.6 2005/12/11 12:25:06 christos Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_l3timer.c,v 1.6 2005/12/11 12:25:06 christos Exp $"); - -#ifdef __FreeBSD__ -#include "i4bq931.h" -#else -#define NI4BQ931 1 -#endif -#if NI4BQ931 > 0 - -#include -#include -#include -#include -#include -#include - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#else -#include -#include -#endif - -#include -#include -#include -#include - -#include -#include -#include - -#include - -/*---------------------------------------------------------------------------* - * stop all layer 3 timers - *---------------------------------------------------------------------------*/ -void i4b_l3_stop_all_timers(call_desc_t *cd) -{ - T303_stop(cd); - T305_stop(cd); - T308_stop(cd); - T309_stop(cd); - T310_stop(cd); - T313_stop(cd); -} - -/*---------------------------------------------------------------------------* - * timer T303 timeout function - *---------------------------------------------------------------------------*/ -static void -T303_timeout(call_desc_t *cd) -{ - NDBGL3(L3_T_ERR, "SETUP not answered, cr = %d", cd->cr); - next_l3state(cd, EV_T303EXP); -} - -/*---------------------------------------------------------------------------* - * timer T303 start - *---------------------------------------------------------------------------*/ -void -T303_start(call_desc_t *cd) -{ - if (cd->T303 == TIMER_ACTIVE) - return; - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); - cd->T303 = TIMER_ACTIVE; - - START_TIMER(cd->T303_callout, T303_timeout, cd, T303VAL); -} - -/*---------------------------------------------------------------------------* - * timer T303 stop - *---------------------------------------------------------------------------*/ -void -T303_stop(call_desc_t *cd) -{ - int s; - s = splnet(); - - if(cd->T303 != TIMER_IDLE) - { - STOP_TIMER(cd->T303_callout, T303_timeout, cd); - cd->T303 = TIMER_IDLE; - } - splx(s); - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); -} - -/*---------------------------------------------------------------------------* - * timer T305 timeout function - *---------------------------------------------------------------------------*/ -static void -T305_timeout(call_desc_t *cd) -{ - NDBGL3(L3_T_ERR, "DISC not answered, cr = %d", cd->cr); - next_l3state(cd, EV_T305EXP); -} - -/*---------------------------------------------------------------------------* - * timer T305 start - *---------------------------------------------------------------------------*/ -void -T305_start(call_desc_t *cd) -{ - if (cd->T305 == TIMER_ACTIVE) - return; - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); - cd->T305 = TIMER_ACTIVE; - - START_TIMER(cd->T305_callout, T305_timeout, cd, T305VAL); -} - -/*---------------------------------------------------------------------------* - * timer T305 stop - *---------------------------------------------------------------------------*/ -void -T305_stop(call_desc_t *cd) -{ - int s; - s = splnet(); - - if(cd->T305 != TIMER_IDLE) - { - STOP_TIMER(cd->T305_callout, T305_timeout, cd); - cd->T305 = TIMER_IDLE; - } - splx(s); - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); -} - -/*---------------------------------------------------------------------------* - * timer T308 timeout function - *---------------------------------------------------------------------------*/ -static void -T308_timeout(call_desc_t *cd) -{ - NDBGL3(L3_T_ERR, "REL not answered, cr = %d", cd->cr); - next_l3state(cd, EV_T308EXP); -} - -/*---------------------------------------------------------------------------* - * timer T308 start - *---------------------------------------------------------------------------*/ -void -T308_start(call_desc_t *cd) -{ - if(cd->T308 == TIMER_ACTIVE) - return; - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); - cd->T308 = TIMER_ACTIVE; - - START_TIMER(cd->T308_callout, T308_timeout, cd, T308VAL); -} - -/*---------------------------------------------------------------------------* - * timer T308 stop - *---------------------------------------------------------------------------*/ -void -T308_stop(call_desc_t *cd) -{ - int s; - s = splnet(); - - if(cd->T308 != TIMER_IDLE) - { - STOP_TIMER(cd->T308_callout, T308_timeout, cd); - cd->T308 = TIMER_IDLE; - } - splx(s); - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); -} - -/*---------------------------------------------------------------------------* - * timer T309 timeout function - *---------------------------------------------------------------------------*/ -static void -T309_timeout(call_desc_t *cd) -{ - NDBGL3(L3_T_ERR, "datalink not reconnected, cr = %d", cd->cr); - next_l3state(cd, EV_T309EXP); -} - -/*---------------------------------------------------------------------------* - * timer T309 start - *---------------------------------------------------------------------------*/ -void -T309_start(call_desc_t *cd) -{ - if (cd->T309 == TIMER_ACTIVE) - return; - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); - cd->T309 = TIMER_ACTIVE; - - START_TIMER(cd->T309_callout, T309_timeout, cd, T309VAL); -} - -/*---------------------------------------------------------------------------* - * timer T309 stop - *---------------------------------------------------------------------------*/ -void -T309_stop(call_desc_t *cd) -{ - int s; - s = splnet(); - - if(cd->T309 != TIMER_IDLE) - { - STOP_TIMER(cd->T309_callout, T309_timeout, cd); - cd->T309 = TIMER_IDLE; - } - splx(s); - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); -} - -/*---------------------------------------------------------------------------* - * timer T310 timeout function - *---------------------------------------------------------------------------*/ -static void -T310_timeout(call_desc_t *cd) -{ - NDBGL3(L3_T_ERR, "CALL PROC timeout, cr = %d", cd->cr); - next_l3state(cd, EV_T310EXP); -} - -/*---------------------------------------------------------------------------* - * timer T310 start - *---------------------------------------------------------------------------*/ -void -T310_start(call_desc_t *cd) -{ - if (cd->T310 == TIMER_ACTIVE) - return; - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); - cd->T310 = TIMER_ACTIVE; - - START_TIMER(cd->T310_callout, T310_timeout, cd, T310VAL); -} - -/*---------------------------------------------------------------------------* - * timer T310 stop - *---------------------------------------------------------------------------*/ -void -T310_stop(call_desc_t *cd) -{ - int s; - s = splnet(); - - if(cd->T310 != TIMER_IDLE) - { - STOP_TIMER(cd->T310_callout, T310_timeout, cd); - cd->T310 = TIMER_IDLE; - } - splx(s); - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); -} - -/*---------------------------------------------------------------------------* - * timer T313 timeout function - *---------------------------------------------------------------------------*/ -static void -T313_timeout(call_desc_t *cd) -{ - NDBGL3(L3_T_ERR, "CONN ACK not received, cr = %d", cd->cr); - next_l3state(cd, EV_T313EXP); -} - -/*---------------------------------------------------------------------------* - * timer T313 start - *---------------------------------------------------------------------------*/ -void -T313_start(call_desc_t *cd) -{ - if (cd->T313 == TIMER_ACTIVE) - return; - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); - cd->T313 = TIMER_ACTIVE; - - START_TIMER(cd->T313_callout, T313_timeout, cd, T313VAL); -} - -/*---------------------------------------------------------------------------* - * timer T313 stop - *---------------------------------------------------------------------------*/ -void -T313_stop(call_desc_t *cd) -{ - int s; - s = splnet(); - - if(cd->T313 != TIMER_IDLE) - { - cd->T313 = TIMER_IDLE; - STOP_TIMER(cd->T313_callout, T313_timeout, cd); - } - splx(s); - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); -} - -#endif /* NI4BQ931 > 0 */ - diff --git a/sys/netisdn/i4b_l4.c b/sys/netisdn/i4b_l4.c deleted file mode 100644 index c82c93d51f7d..000000000000 --- a/sys/netisdn/i4b_l4.c +++ /dev/null @@ -1,1237 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_l4.c - kernel interface to userland - * ----------------------------------------- - * - * $Id: i4b_l4.c,v 1.32 2006/11/16 01:33:49 christos Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_l4.c,v 1.32 2006/11/16 01:33:49 christos Exp $"); - -#include "isdn.h" -#include "irip.h" - -#if NISDN > 0 - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#include -#else -#include -#include -#include -#endif - -#include -#include -#include -#include -#include -#include - -unsigned int i4b_l4_debug = L4_DEBUG_DEFAULT; - -/* - * ISDNs, in userland sometimes called "controllers", but one controller - * may have multiple BRIs, for example daic QUAD cards attach four BRIs. - * An ISDN may also be a PRI (30 B channels). - */ -static SLIST_HEAD(, isdn_l3_driver) isdnif_list = SLIST_HEAD_INITIALIZER(isdnif_list); -static int next_isdnif = 0; - -/* - * Attach a new L3 driver instance and return its ISDN identifier - */ -struct isdn_l3_driver * -isdn_attach_isdnif(const char *devname, const char *cardname, - void *l1_token, const struct isdn_l3_driver_functions *l3driver, int nbch) -{ - int s = splnet(); - int i, l, isdnif = next_isdnif++; - struct isdn_l3_driver *new_ctrl; - - new_ctrl = malloc(sizeof(*new_ctrl), M_DEVBUF, M_WAITOK|M_ZERO); - SLIST_INSERT_HEAD(&isdnif_list, new_ctrl, l3drvq); - l = strlen(devname); - new_ctrl->devname = malloc(l + 1, M_DEVBUF, M_WAITOK); - strlcpy(new_ctrl->devname, devname, l + 1); - l = strlen(cardname); - new_ctrl->card_name = malloc(l + 1, M_DEVBUF, M_WAITOK); - strlcpy(new_ctrl->card_name, cardname, l + 1); - - new_ctrl->l3driver = l3driver; - new_ctrl->l1_token = l1_token; - new_ctrl->isdnif = isdnif; - new_ctrl->tei = -1; - new_ctrl->dl_est = DL_DOWN; - new_ctrl->nbch = nbch; - - new_ctrl->bch_state = malloc(nbch * sizeof(int), M_DEVBUF, M_WAITOK); - for (i = 0; i < nbch; i++) - new_ctrl->bch_state[i] = BCH_ST_FREE; - - splx(s); - - return new_ctrl; -} - -/* - * Detach a L3 driver instance - */ -int -isdn_detach_isdnif(struct isdn_l3_driver *l3drv) -{ - struct isdn_l3_driver *sc; - int s = splnet(); - int isdnif = l3drv->isdnif; - int maxidx; - - i4b_l4_contr_ev_ind(isdnif, 0); - SLIST_REMOVE(&isdnif_list, l3drv, isdn_l3_driver, l3drvq); - - maxidx = -1; - SLIST_FOREACH(sc, &isdnif_list, l3drvq) - if (sc->isdnif > maxidx) - maxidx = sc->isdnif; - next_isdnif = maxidx+1; - - free_all_cd_of_isdnif(isdnif); - - splx(s); - - free(l3drv, M_DEVBUF); - printf("ISDN %d detached\n", isdnif); - return 1; -} - -struct isdn_l3_driver * -isdn_find_l3_by_isdnif(int isdnif) -{ - struct isdn_l3_driver *sc; - - SLIST_FOREACH(sc, &isdnif_list, l3drvq) - if (sc->isdnif == isdnif) - return sc; - return NULL; -} - -int isdn_count_isdnif(int *misdnif) -{ - struct isdn_l3_driver *sc; - int count = 0; - int max_isdnif = -1; - - SLIST_FOREACH(sc, &isdnif_list, l3drvq) { - count++; - if (sc->isdnif > max_isdnif) - max_isdnif = sc->isdnif; - } - - if (misdnif) - *misdnif = max_isdnif; - - return count; -} - -void * -isdn_find_softc_by_isdnif(int isdnif) -{ - struct isdn_l3_driver *sc = isdn_find_l3_by_isdnif(isdnif); - if (sc == NULL) - return NULL; - /* - * XXX - hack: do not return a softc for active cards. - * all callers of this expecting l2_softc* results - * should be fixed! - */ - if (sc->l3driver->N_DOWNLOAD) - return NULL; - return sc->l1_token; -} - -/*---------------------------------------------------------------------------* - * daemon is attached - *---------------------------------------------------------------------------*/ -void -i4b_l4_daemon_attached(void) -{ - struct isdn_l3_driver *d; - - int x = splnet(); - SLIST_FOREACH(d, &isdnif_list, l3drvq) - { - d->l3driver->N_MGMT_COMMAND(d, CMR_DOPEN, 0); - } - splx(x); -} - -/*---------------------------------------------------------------------------* - * daemon is detached - *---------------------------------------------------------------------------*/ -void -i4b_l4_daemon_detached(void) -{ - struct isdn_l3_driver *d; - - int x = splnet(); - SLIST_FOREACH(d, &isdnif_list, l3drvq) - { - d->l3driver->N_MGMT_COMMAND(d, CMR_DCLOSE, 0); - } - splx(x); -} - -/* - * B-channel layer 4 drivers and their registry. - * (Application drivers connecting to a B-channel) - */ -static int i4b_link_bchandrvr(call_desc_t *cd); -static void i4b_unlink_bchandrvr(call_desc_t *cd); -static void i4b_l4_setup_timeout(call_desc_t *cd); -static void i4b_idle_check_fix_unit(call_desc_t *cd); -static void i4b_idle_check_var_unit(call_desc_t *cd); -static void i4b_l4_setup_timeout_fix_unit(call_desc_t *cd); -static void i4b_l4_setup_timeout_var_unit(call_desc_t *cd); -static time_t i4b_get_idletime(call_desc_t *cd); - -static int next_l4_driver_id = 0; - -struct l4_driver_desc { - SLIST_ENTRY(l4_driver_desc) l4drvq; - char name[L4DRIVER_NAME_SIZ]; - int driver_id; - const struct isdn_l4_driver_functions *driver; - int units; -}; -static SLIST_HEAD(, l4_driver_desc) l4_driver_registry - = SLIST_HEAD_INITIALIZER(l4_driver_registry); - -int isdn_l4_driver_attach(const char *name, int units, const struct isdn_l4_driver_functions *driver) -{ - struct l4_driver_desc * new_driver; - - new_driver = malloc(sizeof(struct l4_driver_desc), M_DEVBUF, - M_WAITOK|M_ZERO); - strncpy(new_driver->name, name, L4DRIVER_NAME_SIZ); - new_driver->name[L4DRIVER_NAME_SIZ-1] = 0; - new_driver->driver_id = next_l4_driver_id++; - new_driver->driver = driver; - new_driver->units = units; - SLIST_INSERT_HEAD(&l4_driver_registry, new_driver, l4drvq); - return new_driver->driver_id; -} - -int isdn_l4_driver_detatch(const char *name) -{ - /* XXX - not yet implemented */ - (void)name; - return 0; -} - -const struct isdn_l4_driver_functions *isdn_l4_find_driver(const char *name, int unit) -{ - struct l4_driver_desc * d; - SLIST_FOREACH(d, &l4_driver_registry, l4drvq) - if (strcmp(d->name, name) == 0) { - return d->driver; - } - return NULL; -} - -int isdn_l4_find_driverid(const char *name) -{ - struct l4_driver_desc * d; - SLIST_FOREACH(d, &l4_driver_registry, l4drvq) - if (strcmp(d->name, name) == 0) { - return d->driver_id; - } - return -1; -} - -const struct isdn_l4_driver_functions *isdn_l4_get_driver(int driver_id, int unit) -{ - struct l4_driver_desc * d; - SLIST_FOREACH(d, &l4_driver_registry, l4drvq) - if (d->driver_id == driver_id) { - return d->driver; - } - return NULL; -} - -/*---------------------------------------------------------------------------* - * send MSG_PDEACT_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_pdeact(struct isdn_l3_driver *d, int numactive) -{ - struct mbuf *m; - int i; - call_desc_t *cd; - - for(i=0; i < num_call_desc; i++) - { - if(call_desc[i].cdid != CDID_UNUSED && call_desc[i].l3drv == d) - { - cd = &call_desc[i]; - - if(cd->timeout_active) - { - STOP_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd); - } - - if (cd->l4_driver != NULL && cd->l4_driver_softc != NULL) - { - (*cd->l4_driver->line_disconnected)(cd->l4_driver_softc, (void *)cd); - i4b_unlink_bchandrvr(cd); - } - - if ((cd->channelid >= 0) - && (cd->channelid < d->nbch)) - d->bch_state[cd->channelid] = BCH_ST_FREE; - - cd->cdid = CDID_UNUSED; - } - } - - if((m = i4b_Dgetmbuf(sizeof(msg_pdeact_ind_t))) != NULL) - { - msg_pdeact_ind_t *md = (msg_pdeact_ind_t *)m->m_data; - - md->header.type = MSG_PDEACT_IND; - md->header.cdid = -1; - - md->controller = d->isdnif; - md->numactive = numactive; - - i4bputqueue_hipri(m); /* URGENT !!! */ - } -} - -/*---------------------------------------------------------------------------* - * send MSG_L12STAT_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_l12stat(struct isdn_l3_driver *d, int layer, int state) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_l12stat_ind_t))) != NULL) - { - msg_l12stat_ind_t *md = (msg_l12stat_ind_t *)m->m_data; - - md->header.type = MSG_L12STAT_IND; - md->header.cdid = -1; - - md->controller = d->isdnif; - md->layer = layer; - md->state = state; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_TEIASG_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_teiasg(struct isdn_l3_driver *d, int tei) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_teiasg_ind_t))) != NULL) - { - msg_teiasg_ind_t *md = (msg_teiasg_ind_t *)m->m_data; - - md->header.type = MSG_TEIASG_IND; - md->header.cdid = -1; - - md->controller = d->isdnif; - md->tei = d->tei; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_DIALOUT_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_dialout(int driver, int driver_unit) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_dialout_ind_t))) != NULL) - { - msg_dialout_ind_t *md = (msg_dialout_ind_t *)m->m_data; - - md->header.type = MSG_DIALOUT_IND; - md->header.cdid = -1; - - md->driver = driver; - md->driver_unit = driver_unit; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_DIALOUTNUMBER_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_dialoutnumber(int driver, int driver_unit, int cmdlen, char *cmd) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_dialoutnumber_ind_t))) != NULL) - { - msg_dialoutnumber_ind_t *md = (msg_dialoutnumber_ind_t *)m->m_data; - - md->header.type = MSG_DIALOUTNUMBER_IND; - md->header.cdid = -1; - - md->driver = driver; - md->driver_unit = driver_unit; - - if(cmdlen > TELNO_MAX) - cmdlen = TELNO_MAX; - - md->cmdlen = cmdlen; - memcpy(md->cmd, cmd, cmdlen); - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_NEGOTIATION_COMPL message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_negcomplete(call_desc_t *cd) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_negcomplete_ind_t))) != NULL) - { - msg_negcomplete_ind_t *md = (msg_negcomplete_ind_t *)m->m_data; - - md->header.type = MSG_NEGCOMP_IND; - md->header.cdid = cd->cdid; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_IFSTATE_CHANGED_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_ifstate_changed(call_desc_t *cd, int new_state) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_ifstatechg_ind_t))) != NULL) - { - msg_ifstatechg_ind_t *md = (msg_ifstatechg_ind_t *)m->m_data; - - md->header.type = MSG_IFSTATE_CHANGED_IND; - md->header.cdid = cd->cdid; - md->state = new_state; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_DRVRDISC_REQ message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_drvrdisc(int cdid) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_drvrdisc_req_t))) != NULL) - { - msg_drvrdisc_req_t *md = (msg_drvrdisc_req_t *)m->m_data; - - md->header.type = MSG_DRVRDISC_REQ; - md->header.cdid = cdid; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_ACCT_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_accounting(int cdid, int accttype, int ioutbytes, - int iinbytes, int ro, int ri, int outbytes, int inbytes) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_accounting_ind_t))) != NULL) - { - msg_accounting_ind_t *md = (msg_accounting_ind_t *)m->m_data; - - md->header.type = MSG_ACCT_IND; - md->header.cdid = cdid; - - md->accttype = accttype; - md->ioutbytes = ioutbytes; - md->iinbytes = iinbytes; - md->outbps = ro; - md->inbps = ri; - md->outbytes = outbytes; - md->inbytes = inbytes; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_CONNECT_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_connect_ind(call_desc_t *cd) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_connect_ind_t))) != NULL) - { - msg_connect_ind_t *mp = (msg_connect_ind_t *)m->m_data; - - mp->header.type = MSG_CONNECT_IND; - mp->header.cdid = cd->cdid; - - mp->controller = cd->isdnif; - mp->channel = cd->channelid; - mp->bprot = cd->bprot; - - cd->dir = DIR_INCOMING; - - if(strlen(cd->dst_telno) > 0) - strlcpy(mp->dst_telno, cd->dst_telno, - sizeof(mp->dst_telno)); - else - strlcpy(mp->dst_telno, TELNO_EMPTY, - sizeof(mp->dst_telno)); - - if(strlen(cd->src_telno) > 0) - strlcpy(mp->src_telno, cd->src_telno, - sizeof(mp->src_telno)); - else - strlcpy(mp->src_telno, TELNO_EMPTY, - sizeof(mp->src_telno)); - mp->type_plan = cd->type_plan; - memcpy(mp->src_subaddr, cd->src_subaddr, sizeof(mp->src_subaddr)); - memcpy(mp->dest_subaddr, cd->dest_subaddr, sizeof(mp->dest_subaddr)); - - strlcpy(mp->display, cd->display, sizeof(mp->src_telno)); - - mp->scr_ind = cd->scr_ind; - mp->prs_ind = cd->prs_ind; - - T400_start(cd); - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_CONNECT_ACTIVE_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_connect_active_ind(call_desc_t *cd) -{ - int s; - struct mbuf *m; - - s = splnet(); - - cd->last_active_time = cd->connect_time = SECOND; - - NDBGL4(L4_TIMO, "last_active/connect_time=%ld", (long)cd->connect_time); - - i4b_link_bchandrvr(cd); - - update_controller_leds(cd->l3drv); - - if (cd->l4_driver != NULL && cd->l4_driver_softc != NULL) - (*cd->l4_driver->line_connected)(cd->l4_driver_softc, cd); - - i4b_l4_setup_timeout(cd); - - splx(s); - - if((m = i4b_Dgetmbuf(sizeof(msg_connect_active_ind_t))) != NULL) - { - msg_connect_active_ind_t *mp = (msg_connect_active_ind_t *)m->m_data; - - mp->header.type = MSG_CONNECT_ACTIVE_IND; - mp->header.cdid = cd->cdid; - mp->controller = cd->isdnif; - mp->channel = cd->channelid; - if(cd->datetime[0] != '\0') - strlcpy(mp->datetime, cd->datetime, - sizeof(mp->datetime)); - else - mp->datetime[0] = '\0'; - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_DISCONNECT_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_disconnect_ind(call_desc_t *cd) -{ - struct isdn_l3_driver *d; - struct mbuf *m; - - if(cd->timeout_active) - STOP_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd); - - if (cd->l4_driver != NULL && cd->l4_driver_softc != NULL) - { - (*cd->l4_driver->line_disconnected)(cd->l4_driver_softc, (void *)cd); - i4b_unlink_bchandrvr(cd); - } - - d = cd->l3drv; - - if((cd->channelid >= 0) && (cd->channelid < d->nbch)) - { - d->bch_state[cd->channelid] = BCH_ST_FREE; - /* - * XXX: don't call l2 function for active cards. - */ - if (d->l3driver->N_DOWNLOAD == NULL) - i4b_l2_channel_set_state(d, cd->channelid, BCH_ST_FREE); - } - else - { - /* no error, might be hunting call for callback */ - NDBGL4(L4_MSG, "invalid channel %d for ISDN!", cd->channelid); - } - update_controller_leds(d); - - if((m = i4b_Dgetmbuf(sizeof(msg_disconnect_ind_t))) != NULL) - { - msg_disconnect_ind_t *mp = (msg_disconnect_ind_t *)m->m_data; - - mp->header.type = MSG_DISCONNECT_IND; - mp->header.cdid = cd->cdid; - mp->cause = cd->cause_in; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_IDLE_TIMEOUT_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_idle_timeout_ind(call_desc_t *cd) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_idle_timeout_ind_t))) != NULL) - { - msg_idle_timeout_ind_t *mp = (msg_idle_timeout_ind_t *)m->m_data; - - mp->header.type = MSG_IDLE_TIMEOUT_IND; - mp->header.cdid = cd->cdid; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_CHARGING_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_charging_ind(call_desc_t *cd) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_charging_ind_t))) != NULL) - { - msg_charging_ind_t *mp = (msg_charging_ind_t *)m->m_data; - - mp->header.type = MSG_CHARGING_IND; - mp->header.cdid = cd->cdid; - mp->units_type = cd->units_type; - -/*XXX*/ if(mp->units_type == CHARGE_CALC) - mp->units = cd->cunits; - else - mp->units = cd->units; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_STATUS_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_status_ind(call_desc_t *cd) -{ -} - -/*---------------------------------------------------------------------------* - * send MSG_ALERT_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_alert_ind(call_desc_t *cd) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_alert_ind_t))) != NULL) - { - msg_alert_ind_t *mp = (msg_alert_ind_t *)m->m_data; - - mp->header.type = MSG_ALERT_IND; - mp->header.cdid = cd->cdid; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_INFO_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_info_ind(call_desc_t *cd) -{ -} - -/*---------------------------------------------------------------------------* - * send MSG_INFO_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_proceeding_ind(call_desc_t *cd) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_proceeding_ind_t))) != NULL) - { - msg_proceeding_ind_t *mp = (msg_proceeding_ind_t *)m->m_data; - - mp->header.type = MSG_PROCEEDING_IND; - mp->header.cdid = cd->cdid; - mp->controller = cd->isdnif; - mp->channel = cd->channelid; - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_PACKET_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_packet_ind(int driver, int driver_unit, int dir, struct mbuf *pkt) -{ - struct mbuf *m; - int len = pkt->m_pkthdr.len; - unsigned char *ip = pkt->m_data; - - if((m = i4b_Dgetmbuf(sizeof(msg_packet_ind_t))) != NULL) - { - msg_packet_ind_t *mp = (msg_packet_ind_t *)m->m_data; - - mp->header.type = MSG_PACKET_IND; - mp->header.cdid = -1; - mp->driver = driver; - mp->driver_unit = driver_unit; - mp->direction = dir; - memcpy(mp->pktdata, ip, - len m_data; - - ev->header.type = MSG_CONTR_EV_IND; - ev->header.cdid = -1; - ev->controller = controller; - ev->event = attach; - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * link a driver(unit) to a B-channel(controller,unit,channel) - *---------------------------------------------------------------------------*/ -static int -i4b_link_bchandrvr(call_desc_t *cd) -{ - struct isdn_l3_driver *d = cd->l3drv; - - if (d == NULL || d->l3driver == NULL || d->l3driver->get_linktab == NULL) - { - cd->ilt = NULL; - return 1; - } - - cd->ilt = d->l3driver->get_linktab(d->l1_token, - cd->channelid); - - cd->l4_driver = isdn_l4_get_driver(cd->bchan_driver_index, cd->bchan_driver_unit); - if (cd->l4_driver != NULL) - cd->l4_driver_softc = cd->l4_driver->get_softc(cd->bchan_driver_unit); - else - cd->l4_driver_softc = NULL; - - if(cd->l4_driver == NULL || cd->l4_driver_softc == NULL || cd->ilt == NULL) - return(-1); - - if (d->l3driver->set_l4_driver != NULL) - { - d->l3driver->set_l4_driver(d->l1_token, - cd->channelid, cd->l4_driver, cd->l4_driver_softc); - } - - cd->l4_driver->set_linktab(cd->l4_driver_softc, cd->ilt); - - /* activate B channel */ - - (*cd->ilt->bchannel_driver->bch_config)(cd->ilt->l1token, cd->ilt->channel, cd->bprot, 1); - - return(0); -} - -/*---------------------------------------------------------------------------* - * unlink a driver(unit) from a B-channel(controller,unit,channel) - *---------------------------------------------------------------------------*/ -static void -i4b_unlink_bchandrvr(call_desc_t *cd) -{ - struct isdn_l3_driver *d = cd->l3drv; - - /* - * XXX - what's this *cd manipulation for? Shouldn't we - * close the bchannel driver first and then just set ilt to NULL - * in *cd? - */ - if (d == NULL || d->l3driver == NULL || d->l3driver->get_linktab == NULL) - { - cd->ilt = NULL; - return; - } - else - { - cd->ilt = d->l3driver->get_linktab( - d->l1_token, cd->channelid); - } - - /* deactivate B channel */ - - (*cd->ilt->bchannel_driver->bch_config)(cd->ilt->l1token, cd->ilt->channel, cd->bprot, 0); -} - -/*--------------------------------------------------------------------------- - - How shorthold mode works for OUTGOING connections - ================================================= - - |<---- unchecked-window ------->|<-checkwindow->|<-safetywindow>| - -idletime_state: IST_NONCHK IST_CHECK IST_SAFE - - | | | | - time>>+-------------------------------+---------------+---------------+-... - | | | | - | |<--idle_time-->|<--earlyhup--->| - |<-----------------------unitlen------------------------------->| - - - unitlen - specifies the time a charging unit lasts - idle_time - specifies the thime the line must be idle at the - end of the unit to be elected for hangup - earlyhup - is the beginning of a timing safety zone before the - next charging unit starts - - The algorithm works as follows: lets assume the unitlen is 100 - secons, idle_time is 40 seconds and earlyhup is 10 seconds. - The line then must be idle 50 seconds after the begin of the - current unit and it must then be quiet for 40 seconds. if it - has been quiet for this 40 seconds, the line is closed 10 - seconds before the next charging unit starts. In case there was - any traffic within the idle_time, the line is not closed. - It does not matter whether there was any traffic between second - 0 and second 50 or not. - - - How shorthold mode works for INCOMING connections - ================================================= - - it is just possible to specify a maximum idle time for incoming - connections, after this time of no activity on the line the line - is closed. - ----------------------------------------------------------------------------*/ - -static time_t -i4b_get_idletime(call_desc_t *cd) -{ - if (cd->l4_driver != NULL && cd->l4_driver_softc != NULL - && cd->l4_driver->get_idletime) - return cd->l4_driver->get_idletime(cd->l4_driver_softc); - return cd->last_active_time; -} - -/*---------------------------------------------------------------------------* - * B channel idle check timeout setup - *---------------------------------------------------------------------------*/ -static void -i4b_l4_setup_timeout(call_desc_t *cd) -{ - NDBGL4(L4_TIMO, "%ld: direction %d, shorthold algorithm %d", - (long)SECOND, cd->dir, cd->shorthold_data.shorthold_algorithm); - - cd->timeout_active = 0; - cd->idletime_state = IST_IDLE; - - if((cd->dir == DIR_INCOMING) && (cd->max_idle_time > 0)) - { - /* incoming call: simple max idletime check */ - - START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz/2); - cd->timeout_active = 1; - NDBGL4(L4_TIMO, "%ld: incoming-call, setup max_idle_time to %ld", (long)SECOND, (long)cd->max_idle_time); - } - else if((cd->dir == DIR_OUTGOING) && (cd->shorthold_data.idle_time > 0)) - { - switch( cd->shorthold_data.shorthold_algorithm ) - { - default: /* fall into the old fix algorithm */ - case SHA_FIXU: - i4b_l4_setup_timeout_fix_unit( cd ); - break; - - case SHA_VARU: - i4b_l4_setup_timeout_var_unit( cd ); - break; - } - } - else - { - NDBGL4(L4_TIMO, "no idle_timeout configured"); - } -} - -/*---------------------------------------------------------------------------* - * fixed unit algorithm B channel idle check timeout setup - *---------------------------------------------------------------------------*/ -static void -i4b_l4_setup_timeout_fix_unit(call_desc_t *cd) -{ - /* outgoing call */ - - if((cd->shorthold_data.idle_time > 0) && (cd->shorthold_data.unitlen_time == 0)) - { - /* outgoing call: simple max idletime check */ - - START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz/2); - cd->timeout_active = 1; - NDBGL4(L4_TIMO, "%ld: outgoing-call, setup idle_time to %ld", - (long)SECOND, (long)cd->shorthold_data.idle_time); - } - else if((cd->shorthold_data.unitlen_time > 0) && (cd->shorthold_data.unitlen_time > (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time))) - { - /* outgoing call: full shorthold mode check */ - - START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz*(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time))); - cd->timeout_active = 1; - cd->idletime_state = IST_NONCHK; - NDBGL4(L4_TIMO, "%ld: outgoing-call, start %ld sec nocheck window", - (long)SECOND, (long)(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time))); - - if(cd->aocd_flag == 0) - { - cd->units_type = CHARGE_CALC; - cd->cunits++; - i4b_l4_charging_ind(cd); - } - } - else - { - /* parms somehow got wrong .. */ - - NDBGL4(L4_ERR, "%ld: ERROR: idletime[%ld]+earlyhup[%ld] > unitlength[%ld]!", - (long)SECOND, (long)cd->shorthold_data.idle_time, (long)cd->shorthold_data.earlyhup_time, (long)cd->shorthold_data.unitlen_time); - } -} - -/*---------------------------------------------------------------------------* - * variable unit algorithm B channel idle check timeout setup - *---------------------------------------------------------------------------*/ -static void -i4b_l4_setup_timeout_var_unit(call_desc_t *cd) -{ - /* outgoing call: variable unit idletime check */ - - /* - * start checking for an idle connect one second before the end of the unit. - * The one second takes into account of rounding due to the driver only - * using the seconds and not the uSeconds of the current time - */ - cd->idletime_state = IST_CHECK; /* move directly to the checking state */ - - START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz * (cd->shorthold_data.unitlen_time - 1) ); - cd->timeout_active = 1; - NDBGL4(L4_TIMO, "%ld: outgoing-call, var idle time - setup to %ld", - (long)SECOND, (long)cd->shorthold_data.unitlen_time); -} - - -/*---------------------------------------------------------------------------* - * B channel idle check timeout function - *---------------------------------------------------------------------------*/ -void -i4b_idle_check(call_desc_t *cd) -{ - int s; - - if(cd->cdid == CDID_UNUSED) - return; - - s = splnet(); - - /* failsafe */ - - if(cd->timeout_active == 0) - { - NDBGL4(L4_ERR, "ERROR: timeout_active == 0 !!!"); - } - else - { - cd->timeout_active = 0; - } - - /* incoming connections, simple idletime check */ - - if(cd->dir == DIR_INCOMING) - { - if((i4b_get_idletime(cd) + cd->max_idle_time) <= SECOND) - { - struct isdn_l3_driver *d = cd->l3drv; - NDBGL4(L4_TIMO, "%ld: incoming-call, line idle timeout, disconnecting!", (long)SECOND); - d->l3driver->N_DISCONNECT_REQUEST(cd, - (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); - i4b_l4_idle_timeout_ind(cd); - } - else - { - NDBGL4(L4_TIMO, "%ld: incoming-call, activity, last_active=%ld, max_idle=%ld", (long)SECOND, (long)i4b_get_idletime(cd), (long)cd->max_idle_time); - - START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz/2); - cd->timeout_active = 1; - } - } - - /* outgoing connections */ - - else if(cd->dir == DIR_OUTGOING) - { - switch( cd->shorthold_data.shorthold_algorithm ) - { - case SHA_FIXU: - i4b_idle_check_fix_unit( cd ); - break; - case SHA_VARU: - i4b_idle_check_var_unit( cd ); - break; - default: - NDBGL4(L4_TIMO, "%ld: bad value for shorthold_algorithm of %d", - (long)SECOND, cd->shorthold_data.shorthold_algorithm); - i4b_idle_check_fix_unit( cd ); - break; - } - } - splx(s); -} - -/*---------------------------------------------------------------------------* - * fixed unit algorithm B channel idle check timeout function - *---------------------------------------------------------------------------*/ -static void -i4b_idle_check_fix_unit(call_desc_t *cd) -{ - struct isdn_l3_driver *d = cd->l3drv; - - /* simple idletime calculation */ - - if((cd->shorthold_data.idle_time > 0) && (cd->shorthold_data.unitlen_time == 0)) - { - if((i4b_get_idletime(cd) + cd->shorthold_data.idle_time) <= SECOND) - { - NDBGL4(L4_TIMO, "%ld: outgoing-call-st, idle timeout, disconnecting!", (long)SECOND); - d->l3driver->N_DISCONNECT_REQUEST(cd, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); - i4b_l4_idle_timeout_ind(cd); - } - else - { - NDBGL4(L4_TIMO, "%ld: outgoing-call-st, activity, last_active=%ld, max_idle=%ld", - (long)SECOND, (long)i4b_get_idletime(cd), (long)cd->shorthold_data.idle_time); - START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz/2); - cd->timeout_active = 1; - } - } - - /* full shorthold mode calculation */ - - else if((cd->shorthold_data.unitlen_time > 0) - && (cd->shorthold_data.unitlen_time > (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time))) - { - switch(cd->idletime_state) - { - - case IST_NONCHK: /* end of non-check time */ - - START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz*(cd->shorthold_data.idle_time)); - cd->idletimechk_start = SECOND; - cd->idletime_state = IST_CHECK; - cd->timeout_active = 1; - NDBGL4(L4_TIMO, "%ld: outgoing-call, idletime check window reached!", (long)SECOND); - break; - - case IST_CHECK: /* end of idletime chk */ - if((i4b_get_idletime(cd) > cd->idletimechk_start) && - (i4b_get_idletime(cd) <= SECOND)) - { /* activity detected */ - START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz*(cd->shorthold_data.earlyhup_time)); - cd->timeout_active = 1; - cd->idletime_state = IST_SAFE; - NDBGL4(L4_TIMO, "%ld: outgoing-call, activity at %ld, wait earlyhup-end", (long)SECOND, (long)i4b_get_idletime(cd)); - } - else - { /* no activity, hangup */ - NDBGL4(L4_TIMO, "%ld: outgoing-call, idle timeout, last activity at %ld", (long)SECOND, (long)i4b_get_idletime(cd)); - d->l3driver->N_DISCONNECT_REQUEST(cd, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); - i4b_l4_idle_timeout_ind(cd); - cd->idletime_state = IST_IDLE; - } - break; - - case IST_SAFE: /* end of earlyhup time */ - - START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz*(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time+cd->shorthold_data.earlyhup_time))); - cd->timeout_active = 1; - cd->idletime_state = IST_NONCHK; - - if(cd->aocd_flag == 0) - { - cd->units_type = CHARGE_CALC; - cd->cunits++; - i4b_l4_charging_ind(cd); - } - - NDBGL4(L4_TIMO, "%ld: outgoing-call, earlyhup end, wait for idletime start", (long)SECOND); - break; - - default: - NDBGL4(L4_ERR, "outgoing-call: invalid idletime_state value!"); - cd->idletime_state = IST_IDLE; - break; - } - } -} - -/*---------------------------------------------------------------------------* - * variable unit algorithm B channel idle check timeout function - *---------------------------------------------------------------------------*/ -static void -i4b_idle_check_var_unit(call_desc_t *cd) -{ - switch(cd->idletime_state) - { - - /* see if there has been any activity within the last idle_time seconds */ - case IST_CHECK: - if( i4b_get_idletime(cd) > (SECOND - cd->shorthold_data.idle_time)) - { /* activity detected */ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001 - cd->idle_timeout_handle = -#endif - /* check again in one second */ - START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz); - cd->timeout_active = 1; - cd->idletime_state = IST_CHECK; - NDBGL4(L4_TIMO, "%ld: outgoing-call, var idle timeout - activity at %ld, continuing", (long)SECOND, (long)i4b_get_idletime(cd)); - } - else - { /* no activity, hangup */ - struct isdn_l3_driver *d = cd->l3drv; - NDBGL4(L4_TIMO, "%ld: outgoing-call, var idle timeout - last activity at %ld", (long)SECOND, (long)i4b_get_idletime(cd)); - d->l3driver->N_DISCONNECT_REQUEST(cd, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); - i4b_l4_idle_timeout_ind(cd); - cd->idletime_state = IST_IDLE; - } - break; - - default: - NDBGL4(L4_ERR, "outgoing-call: var idle timeout invalid idletime_state value!"); - cd->idletime_state = IST_IDLE; - break; - } -} - -#endif /* NISDN > 0 */ diff --git a/sys/netisdn/i4b_l4.h b/sys/netisdn/i4b_l4.h deleted file mode 100644 index d1e79d4788f6..000000000000 --- a/sys/netisdn/i4b_l4.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_l4.h - kernel interface to userland header file - * --------------------------------------------------- - * - * $Id: i4b_l4.h,v 1.10 2005/12/10 23:51:50 elad Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Thu Apr 27 13:28:01 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _NETISDN_I4B_L4_H_ -#define _NETISDN_I4B_L4_H_ - -extern void i4bputqueue ( struct mbuf *m ); -extern void i4bputqueue_hipri(struct mbuf *m); -extern void i4b_l4_accounting(int, int, int, int, int, int, int, int); -extern void i4b_l4_alert_ind ( call_desc_t *cd ); -extern void i4b_l4_charging_ind( call_desc_t *cd ); -extern void i4b_l4_connect_active_ind ( call_desc_t *cd ); -extern void i4b_l4_connect_ind ( call_desc_t *cd ); -extern void i4b_l4_daemon_attached(void); -extern void i4b_l4_daemon_detached(void); -extern void i4b_l4_dialout( int driver, int driver_unit ); -extern void i4b_l4_dialoutnumber(int driver, int driver_unit, int cmdlen, char *cmd); -extern void i4b_l4_disconnect_ind ( call_desc_t *cd ); -extern void i4b_l4_drvrdisc (int cdid); -extern void i4b_l4_negcomplete( call_desc_t *cd ); -extern void i4b_l4_ifstate_changed( call_desc_t *cd, int new_state ); -extern void i4b_l4_idle_timeout_ind( call_desc_t *cd ); -extern void i4b_l4_info_ind ( call_desc_t *cd ); -extern void i4b_l4_packet_ind(int, int, int, struct mbuf *pkt); -extern void i4b_l4_l12stat(struct isdn_l3_driver *, int layer, int state); -extern void i4b_l4_pdeact(struct isdn_l3_driver *, int numactive); -extern void i4b_l4_teiasg(struct isdn_l3_driver *, int tei); -extern void i4b_l4_status_ind ( call_desc_t *cd ); -extern void i4b_l4_proceeding_ind ( call_desc_t *cd ); -extern void i4b_idle_check(call_desc_t *cdp); -extern call_desc_t * cd_by_cdid ( unsigned int cdid ); -extern void freecd_by_cd ( call_desc_t *cd ); -call_desc_t *cd_by_isdnifcr(int isdnif, int cr, int crf); -void free_all_cd_of_isdnif(int isdnif); -extern unsigned char get_rand_cr ( int unit ); -extern call_desc_t * reserve_cd ( void ); -extern void T400_start ( call_desc_t *cd ); -extern void T400_stop ( call_desc_t *cd ); -extern void update_controller_leds(struct isdn_l3_driver *d); - -#endif /* !_NETISDN_I4B_L4_H_ */ diff --git a/sys/netisdn/i4b_l4if.c b/sys/netisdn/i4b_l4if.c deleted file mode 100644 index 23dfaf7fa369..000000000000 --- a/sys/netisdn/i4b_l4if.c +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_l4if.c - Layer 3 interface to Layer 4 - * ------------------------------------------- - * - * $Id: i4b_l4if.c,v 1.19 2005/12/11 12:25:06 christos Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_l4if.c,v 1.19 2005/12/11 12:25:06 christos Exp $"); - -#ifdef __FreeBSD__ -#include "i4bq931.h" -#else -#define NI4BQ931 1 -#endif -#if NI4BQ931 > 0 - -#include -#include -#include -#include -#include -#include - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#include -#else -#include -#include -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -void n_connect_request(struct call_desc *cd); -void n_connect_response(struct call_desc *cd, int response, int cause); -void n_disconnect_request(struct call_desc *cd, int cause); -void n_alert_request(struct call_desc *cd); -void n_mgmt_command(struct isdn_l3_driver *drv, int cmd, void *parm); - -/*---------------------------------------------------------------------------* - * i4b_mdl_status_ind - status indication from lower layers - *---------------------------------------------------------------------------*/ -int -i4b_mdl_status_ind(struct isdn_l3_driver *d, int status, int parm) -{ - int sendup, update_leds = 0; - int i; - - NDBGL3(L3_MSG, "isdnif = %d, status = %d, parm = %d", - d->isdnif, status, parm); - - switch(status) - { - case STI_ATTACH: - if (parm) { - NDBGL3(L3_MSG, "STI_ATTACH: attaching isdnif %d", d->isdnif); - } else { - NDBGL3(L3_MSG, "STI_ATTACH: dettaching isdnif %d", d->isdnif); - } - break; - - case STI_L1STAT: - i4b_l4_l12stat(d, 1, parm); - update_leds = 1; - NDBGL3(L3_MSG, "STI_L1STAT: isdnif %d layer 1 = %s", d->isdnif, status ? "up" : "down"); - break; - - case STI_L2STAT: - i4b_l4_l12stat(d, 2, parm); - update_leds = 1; - NDBGL3(L3_MSG, "STI_L2STAT: isdnif %d layer 2 = %s", d->isdnif, status ? "up" : "down"); - break; - - case STI_TEIASG: - d->tei = parm; - i4b_l4_teiasg(d, parm); - update_leds = 1; - NDBGL3(L3_MSG, "STI_TEIASG: isdnif %d TEI = %d = 0x%02x", d->isdnif, parm, parm); - break; - - case STI_PDEACT: /* L1 T4 timeout */ - NDBGL3(L3_ERR, "STI_PDEACT: isdnif %d TEI = %d = 0x%02x", d->isdnif, parm, parm); - - update_leds = 1; - sendup = 0; - - for(i=0; i < num_call_desc; i++) - { - if(call_desc[i].isdnif == d->isdnif) - { - i4b_l3_stop_all_timers(&(call_desc[i])); - if(call_desc[i].cdid != CDID_UNUSED) { - sendup++; - call_desc[i].cdid = CDID_UNUSED; - } - } - } - - d->dl_est = DL_DOWN; - - for (i = 0; i < d->nbch; i++) - d->bch_state[i] = BCH_ST_FREE; - d->tei = -1; - - if(sendup) - { - i4b_l4_pdeact(d, sendup); - } - break; - - case STI_NOL1ACC: /* no outgoing access to S0 */ - NDBGL3(L3_ERR, "STI_NOL1ACC: isdnif %d no outgoing access to S0", d->isdnif); - update_leds = 1; - - for(i=0; i < num_call_desc; i++) - { - if(call_desc[i].isdnif == d->isdnif) - { - if(call_desc[i].cdid != CDID_UNUSED) - { - SET_CAUSE_TYPE(call_desc[i].cause_in, CAUSET_I4B); - SET_CAUSE_VAL(call_desc[i].cause_in, CAUSE_I4B_L1ERROR); - i4b_l4_disconnect_ind(&(call_desc[i])); - } - } - } - d->dl_est = DL_DOWN; - - for (i = 0; i < d->nbch; i++) - d->bch_state[i] = BCH_ST_FREE; - d->tei = -1; - - break; - - default: - NDBGL3(L3_ERR, "ERROR, isdnif %d, unknown status value %d!", d->isdnif, status); - break; - } - - if (update_leds && d != NULL) - update_controller_leds(d); - - return(0); -} - -void -update_controller_leds(struct isdn_l3_driver *d) -{ - intptr_t leds = 0; - - if (d->tei != -1) - leds |= CMRLEDS_TEI; - if (d->bch_state[CHAN_B1] != BCH_ST_FREE) - leds |= CMRLEDS_B0; - if (d->bch_state[CHAN_B2] != BCH_ST_FREE) - leds |= CMRLEDS_B1; - - d->l3driver->N_MGMT_COMMAND(d, CMR_SETLEDS, (void*)leds); -} - -/*---------------------------------------------------------------------------* - * send command to the lower layers - *---------------------------------------------------------------------------*/ -void -n_mgmt_command(struct isdn_l3_driver *d, int cmd, void *parm) -{ - int i; - - switch(cmd) - { - case CMR_DOPEN: - NDBGL3(L3_MSG, "CMR_DOPEN for isdnif %d", d->isdnif); - - for(i=0; i < num_call_desc; i++) - { - if(call_desc[i].isdnif == d->isdnif) - { - call_desc[i].cdid = CDID_UNUSED; - } - } - d->dl_est = DL_DOWN; - for (i = 0; i < d->nbch; i++) - d->bch_state[i] = BCH_ST_FREE; - d->tei = -1; - - break; - - case CMR_DCLOSE: - NDBGL3(L3_MSG, "CMR_DCLOSE for isdnif %d", d->isdnif); - break; - - default: - NDBGL3(L3_MSG, "unknown cmd %d for isdnif %d", - cmd, d->isdnif); - break; - } - - i4b_mdl_command_req(d, cmd, parm); -} - -/*---------------------------------------------------------------------------* - * handle connect request message from userland - *---------------------------------------------------------------------------*/ -void -n_connect_request(struct call_desc *cd) -{ - next_l3state(cd, EV_SETUPRQ); -} - -/*---------------------------------------------------------------------------* - * handle setup response message from userland - *---------------------------------------------------------------------------*/ -void -n_connect_response(struct call_desc *cd, int response, int cause) -{ - struct isdn_l3_driver *d = cd->l3drv; - int chstate; - - T400_stop(cd); - - cd->response = response; - cd->cause_out = cause; - - switch(response) - { - case SETUP_RESP_ACCEPT: - next_l3state(cd, EV_SETACRS); - chstate = BCH_ST_USED; - break; - - case SETUP_RESP_REJECT: - next_l3state(cd, EV_SETRJRS); - chstate = BCH_ST_FREE; - break; - - case SETUP_RESP_DNTCRE: - next_l3state(cd, EV_SETDCRS); - chstate = BCH_ST_FREE; - break; - - default: /* failsafe */ - next_l3state(cd, EV_SETDCRS); - chstate = BCH_ST_FREE; - NDBGL3(L3_ERR, "unknown response, doing SETUP_RESP_DNTCRE"); - break; - } - - if((cd->channelid >= 0) && (cd->channelid < d->nbch)) - { - d->bch_state[cd->channelid] = chstate; - /* - * XXX: don't call l2 function for active cards - */ - if (d->l3driver->N_DOWNLOAD == NULL) - i4b_l2_channel_set_state(cd->l3drv, - cd->channelid, chstate); - update_controller_leds(d); - } - else - { - NDBGL3(L3_MSG, "Warning, invalid channelid %d, response = %d\n", cd->channelid, response); - } -} - -/*---------------------------------------------------------------------------* - * handle disconnect request message from userland - *---------------------------------------------------------------------------*/ -void -n_disconnect_request(struct call_desc *cd, int cause) -{ - cd->cause_out = cause; - - next_l3state(cd, EV_DISCRQ); -} - -/*---------------------------------------------------------------------------* - * handle alert request message from userland - *---------------------------------------------------------------------------*/ -void -n_alert_request(struct call_desc *cd) -{ - next_l3state(cd, EV_ALERTRQ); -} - -#endif /* NI4BQ931 > 0 */ diff --git a/sys/netisdn/i4b_l4mgmt.c b/sys/netisdn/i4b_l4mgmt.c deleted file mode 100644 index bb41a98a9bc5..000000000000 --- a/sys/netisdn/i4b_l4mgmt.c +++ /dev/null @@ -1,380 +0,0 @@ -/* $NetBSD: i4b_l4mgmt.c,v 1.18 2010/01/18 16:37:41 pooka Exp $ */ - -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_l4mgmt.c - layer 4 calldescriptor management utilites - * ----------------------------------------------------------- - * - * $Id: i4b_l4mgmt.c,v 1.18 2010/01/18 16:37:41 pooka Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_l4mgmt.c,v 1.18 2010/01/18 16:37:41 pooka Exp $"); - -#include "isdn.h" - -#if NISDN > 0 - -#include -#include -#include -#include -#include -#include - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#if defined(__FreeBSD__) -#if defined (__FreeBSD_version) && __FreeBSD_version <= 400000 -#include -#else -#include -#endif -#endif - -#ifdef __FreeBSD__ -#include -#include -#else -#include -#include -#endif - -#include -#include -#include -#include - -#include -#include -#include - -static unsigned int get_cdid(void); - -static void i4b_init_callout(call_desc_t *); -static void i4b_stop_callout(call_desc_t *cd); - -call_desc_t call_desc[N_CALL_DESC]; /* call descriptor array */ -int num_call_desc = 0; - -/*---------------------------------------------------------------------------* - * return a new unique call descriptor id - * -------------------------------------- - * returns a new calldescriptor id which is used to uniquely identyfy - * a single call in the communication between kernel and userland. - * this cdid is then used to associate a calldescriptor with an id. - *---------------------------------------------------------------------------*/ -static unsigned int -get_cdid(void) -{ - static unsigned int cdid_count = 0; - int i; - int x; - - x = splnet(); - - /* get next id */ - - cdid_count++; - -again: - if(cdid_count == CDID_UNUSED) /* zero is invalid */ - cdid_count++; - else if(cdid_count > CDID_MAX) /* wraparound ? */ - cdid_count = 1; - - /* check if id already in use */ - - for(i=0; i < num_call_desc; i++) - { - if(call_desc[i].cdid == cdid_count) - { - cdid_count++; - goto again; - } - } - - splx(x); - - return(cdid_count); -} - -/*---------------------------------------------------------------------------* - * reserve a calldescriptor for later usage - * ---------------------------------------- - * searches the calldescriptor array until an unused - * descriptor is found, gets a new calldescriptor id - * and reserves it by putting the id into the cdid field. - * returns pointer to the calldescriptor. - *---------------------------------------------------------------------------*/ -call_desc_t * -reserve_cd(void) -{ - call_desc_t *cd; - int x; - int i; - - x = splnet(); - - cd = NULL; - - for(i=0; i < num_call_desc; i++) - { - if(call_desc[i].cdid == CDID_UNUSED) - { - cd = &(call_desc[i]); /* get pointer to descriptor */ - NDBGL4(L4_MSG, "found free cd - index=%d cdid=%u", - i, call_desc[i].cdid); - break; - } - } - if (cd == NULL && num_call_desc < N_CALL_DESC) { - i = num_call_desc++; - cd = &(call_desc[i]); /* get pointer to descriptor */ - NDBGL4(L4_MSG, "found free cd - index=%d cdid=%u", - i, call_desc[i].cdid); - } - if (cd != NULL) { - memset(cd, 0, sizeof(call_desc_t)); /* clear it */ - cd->cdid = get_cdid(); /* fill in new cdid */ - } - - splx(x); - - if(cd == NULL) - panic("reserve_cd: no free call descriptor available!"); - - i4b_init_callout(cd); - - return(cd); -} - -/*---------------------------------------------------------------------------* - * free a calldescriptor - * --------------------- - * free a unused calldescriptor by giving address of calldescriptor - * and writing a 0 into the cdid field marking it as unused. - *---------------------------------------------------------------------------*/ -void -freecd_by_cd(call_desc_t *cd) -{ - int i; - int x = splnet(); - - for(i=0; i < num_call_desc; i++) - { - if( (call_desc[i].cdid != CDID_UNUSED) && - (&(call_desc[i]) == cd) ) - { - NDBGL4(L4_MSG, "releasing cd - index=%d cdid=%u cr=%d", - i, call_desc[i].cdid, cd->cr); - call_desc[i].cdid = CDID_UNUSED; - break; - } - } - - if(i == N_CALL_DESC) - panic("freecd_by_cd: ERROR, cd not found, cr = %d", cd->cr); - - splx(x); -} - -/* - * ISDN is gone, get rid of all CDs for it - */ -void free_all_cd_of_isdnif(int isdnif) -{ - int i; - int x = splnet(); - - for(i=0; i < num_call_desc; i++) - { - if( (call_desc[i].cdid != CDID_UNUSED) && - call_desc[i].isdnif == isdnif) { - NDBGL4(L4_MSG, "releasing cd - index=%d cdid=%u cr=%d", - i, call_desc[i].cdid, call_desc[i].cr); - if (call_desc[i].callouts_inited) - i4b_stop_callout(&call_desc[i]); - call_desc[i].cdid = CDID_UNUSED; - call_desc[i].isdnif = -1; - call_desc[i].l3drv = NULL; - } - } - - splx(x); -} - -/*---------------------------------------------------------------------------* - * return pointer to calldescriptor by giving the calldescriptor id - * ---------------------------------------------------------------- - * lookup a calldescriptor in the calldescriptor array by looking - * at the cdid field. return pointer to calldescriptor if found, - * else return NULL if not found. - *---------------------------------------------------------------------------*/ -call_desc_t * -cd_by_cdid(unsigned int cdid) -{ - int i; - - for(i=0; i < num_call_desc; i++) - { - if(call_desc[i].cdid == cdid) - { - NDBGL4(L4_MSG, "found cdid - index=%d cdid=%u cr=%d", - i, call_desc[i].cdid, call_desc[i].cr); - i4b_init_callout(&call_desc[i]); - return(&(call_desc[i])); - } - } - return(NULL); -} - -/*---------------------------------------------------------------------------* - * search calldescriptor - * --------------------- - * This routine searches for the calldescriptor for a passive controller - * given by unit number, callreference and callreference flag. - * It returns a pointer to the calldescriptor if found, else a NULL. - *---------------------------------------------------------------------------*/ -call_desc_t * -cd_by_isdnifcr(int isdnif, int cr, int crf) -{ - int i; - - for(i=0; i < num_call_desc; i++) { - if (call_desc[i].cdid != CDID_UNUSED - && call_desc[i].isdnif == isdnif - && call_desc[i].cr == cr - && call_desc[i].crflag == crf) { - NDBGL4(L4_MSG, "found cd, index=%d cdid=%u cr=%d", - i, call_desc[i].cdid, call_desc[i].cr); - i4b_init_callout(&call_desc[i]); - return(&(call_desc[i])); - } - } - return(NULL); -} - -/*---------------------------------------------------------------------------* - * generate 7 bit "random" number used for outgoing Call Reference - *---------------------------------------------------------------------------*/ -unsigned char -get_rand_cr(int unit) -{ - register int i, j; - static u_char val, retval; - static int called = 42; - struct timeval t; - - val += ++called; - - for(i=0; i < 50 ; i++, val++) - { - int found = 1; - -#if defined(__FreeBSD__) - -#ifdef RANDOMDEV - read_random((char *)&val, sizeof(val)); -#else - val = (u_char)random(); -#endif /* RANDOMDEV */ - -#else - getmicrotime(&t); - val |= unit+i; - val <<= i; - val ^= (t.tv_sec >> 8) ^ t.tv_usec; - val <<= i; - val ^= t.tv_sec ^ (t.tv_usec >> 8); -#endif - - retval = val & 0x7f; - - if(retval == 0 || retval == 0x7f) - continue; - - for(j=0; j < num_call_desc; j++) - { - if( (call_desc[j].cdid != CDID_UNUSED) && - (call_desc[j].cr == retval) ) - { - found = 0; - break; - } - } - - if(found) - return(retval); - } - return(0); /* XXX */ -} - -static void -i4b_stop_callout(call_desc_t *cd) -{ - if (!cd->callouts_inited) - return; - - callout_stop(&cd->idle_timeout_handle); - callout_stop(&cd->T303_callout); - callout_stop(&cd->T305_callout); - callout_stop(&cd->T308_callout); - callout_stop(&cd->T309_callout); - callout_stop(&cd->T310_callout); - callout_stop(&cd->T313_callout); - callout_stop(&cd->T400_callout); -} - -/*---------------------------------------------------------------------------* - * initialize the callout handles for FreeBSD - *---------------------------------------------------------------------------*/ -void -i4b_init_callout(call_desc_t *cd) -{ - if(cd->callouts_inited == 0) - { - callout_init(&cd->idle_timeout_handle, 0); - callout_init(&cd->T303_callout, 0); - callout_init(&cd->T305_callout, 0); - callout_init(&cd->T308_callout, 0); - callout_init(&cd->T309_callout, 0); - callout_init(&cd->T310_callout, 0); - callout_init(&cd->T313_callout, 0); - callout_init(&cd->T400_callout, 0); - cd->callouts_inited = 1; - } -} - -#endif /* NISDN > 0 */ diff --git a/sys/netisdn/i4b_l4timer.c b/sys/netisdn/i4b_l4timer.c deleted file mode 100644 index 05f26c1623be..000000000000 --- a/sys/netisdn/i4b_l4timer.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_l4timer.c - timer and timeout handling for layer 4 - * -------------------------------------------------------- - * - * $Id: i4b_l4timer.c,v 1.6 2005/12/11 12:25:06 christos Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_l4timer.c,v 1.6 2005/12/11 12:25:06 christos Exp $"); - -#include "isdn.h" - -#if NISDN > 0 - -#include -#include -#include -#include -#include -#include - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#else -#include -#include -#endif - -#include -#include -#include - -#include - -/*---------------------------------------------------------------------------* - * timer T400 timeout function - *---------------------------------------------------------------------------*/ -static void -T400_timeout(call_desc_t *cd) -{ - NDBGL4(L4_ERR, "cr = %d", cd->cr); -} - -/*---------------------------------------------------------------------------* - * timer T400 start - *---------------------------------------------------------------------------*/ -void -T400_start(call_desc_t *cd) -{ - if (cd->T400 == TIMER_ACTIVE) - return; - - NDBGL4(L4_MSG, "cr = %d", cd->cr); - cd->T400 = TIMER_ACTIVE; - - START_TIMER(cd->T400_callout, T400_timeout, cd, T400DEF); -} - -/*---------------------------------------------------------------------------* - * timer T400 stop - *---------------------------------------------------------------------------*/ -void -T400_stop(call_desc_t *cd) -{ - int s; - s = splnet(); - - if(cd->T400 == TIMER_ACTIVE) - { - STOP_TIMER(cd->T400_callout, T400_timeout, cd); - cd->T400 = TIMER_IDLE; - } - splx(s); - NDBGL4(L4_MSG, "cr = %d", cd->cr); -} - -#endif /* NISDN > 0 */ diff --git a/sys/netisdn/i4b_lme.c b/sys/netisdn/i4b_lme.c deleted file mode 100644 index 718698e70adb..000000000000 --- a/sys/netisdn/i4b_lme.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_lme.c - layer management entity - * ------------------------------------- - * - * $Id: i4b_lme.c,v 1.9 2005/12/11 12:25:06 christos Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_lme.c,v 1.9 2005/12/11 12:25:06 christos Exp $"); - -#ifdef __FreeBSD__ -#include "i4bq921.h" -#else -#define NI4BQ921 1 -#endif -#if NI4BQ921 > 0 - -#include -#include -#include -#include -#include -#include - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#else -#include -#include -#endif - -#include -#include -#include -#include -#include -#include - -/*---------------------------------------------------------------------------* - * mdl assign indication handler - *---------------------------------------------------------------------------*/ -void -i4b_mdl_assign_ind(l2_softc_t *l2sc) -{ - NDBGL2(L2_PRIM, "isdnif %d", l2sc->drv->isdnif); - - i4b_l1_activate(l2sc); - - if(l2sc->tei_valid == TEI_VALID) - { - l2sc->T202func = (void(*)(void*))i4b_tei_verify; - l2sc->N202 = N202DEF; - i4b_tei_verify(l2sc); - } - else - { - l2sc->T202func = (void(*)(void*))i4b_tei_assign; - l2sc->N202 = N202DEF; - i4b_tei_assign(l2sc); - } -} - -/*---------------------------------------------------------------------------* - * i4b_mdl_error_ind handler (Q.921 01/94 pp 156) - *---------------------------------------------------------------------------*/ -void -i4b_mdl_error_ind(l2_softc_t *l2sc, const char *where, int errorcode) -{ -#if DO_I4B_DEBUG - static const char *error_text[] = { - "MDL_ERR_A: rx'd unsolicited response - supervisory (F=1)", - "MDL_ERR_B: rx'd unsolicited response - DM (F=1)", - "MDL_ERR_C: rx'd unsolicited response - UA (F=1)", - "MDL_ERR_D: rx'd unsolicited response - UA (F=0)", - "MDL_ERR_E: rx'd unsolicited response - DM (F=0)", - "MDL_ERR_F: peer initiated re-establishment - SABME", - "MDL_ERR_G: unsuccessful transmission N200times - SABME", - "MDL_ERR_H: unsuccessful transmission N200times - DIS", - "MDL_ERR_I: unsuccessful transmission N200times - Status ENQ", - "MDL_ERR_J: other error - N(R) error", - "MDL_ERR_K: other error - rx'd FRMR response", - "MDL_ERR_L: other error - rx'd undefined frame", - "MDL_ERR_M: other error - receipt of I field not permitted", - "MDL_ERR_N: other error - rx'd frame with wrong size", - "MDL_ERR_O: other error - N201 error", - "MDL_ERR_MAX: i4b_mdl_error_ind called with wrong parameter!!!" - }; -#endif - - if(errorcode > MDL_ERR_MAX) - errorcode = MDL_ERR_MAX; - - NDBGL2(L2_ERROR, "isdnif = %d, location = %s", - l2sc->drv->isdnif, where); - NDBGL2(L2_ERROR, "error = %s", error_text[errorcode]); - - switch(errorcode) - { - case MDL_ERR_A: - case MDL_ERR_B: - break; - - case MDL_ERR_C: - case MDL_ERR_D: - i4b_tei_verify(l2sc); - break; - - case MDL_ERR_E: - case MDL_ERR_F: - break; - - case MDL_ERR_G: - case MDL_ERR_H: - i4b_tei_verify(l2sc); - break; - - case MDL_ERR_I: - case MDL_ERR_J: - case MDL_ERR_K: - case MDL_ERR_L: - case MDL_ERR_M: - case MDL_ERR_N: - case MDL_ERR_O: - break; - - default: - break; - } -} - -#endif /* NI4BQ921 > 0 */ diff --git a/sys/netisdn/i4b_mbuf.c b/sys/netisdn/i4b_mbuf.c deleted file mode 100644 index ebc9cb9f10da..000000000000 --- a/sys/netisdn/i4b_mbuf.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b - mbuf handling support routines - * ------------------------------------ - * - * $Id: i4b_mbuf.c,v 1.6 2010/01/18 16:29:51 pooka Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_mbuf.c,v 1.6 2010/01/18 16:29:51 pooka Exp $"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#ifndef I4B_MBUF_DEBUG -#define I4B_MBUF_DEBUG -#endif -#undef I4B_MBUF_TYPE_DEBUG - -#ifdef I4B_MBUF_TYPE_DEBUG - -#ifdef __FreeBSD__ - -#define MT_DCHAN 42 -#define MT_BCHAN 43 - -#else /* NetBSD */ - -#define MT_DCHAN MT_DATA -#define MT_BCHAN MT_DATA - -#endif - -#define MT_I4B_D MT_DCHAN -#define MT_I4B_B MT_BCHAN - -#else /* ! I4B_MBUF_TYPE_DEBUG */ - -#define MT_I4B_D MT_DATA -#define MT_I4B_B MT_DATA - -#endif /* I4B_MBUF_TYPE_DEBUG */ - -/*---------------------------------------------------------------------------* - * allocate D-channel mbuf space - *---------------------------------------------------------------------------*/ -struct mbuf* -i4b_Dgetmbuf(int len) -{ - struct mbuf *m; - - if(len > MCLBYTES) /* if length > max extension size */ - { - -#ifdef I4B_MBUF_DEBUG - printf("i4b_getmbuf: error - len(%d) > MCLBYTES(%d)\n", - len, MCLBYTES); -#endif - - return(NULL); - } - - MGETHDR(m, M_DONTWAIT, MT_I4B_D); /* get mbuf with pkthdr */ - - /* did we actually get the mbuf ? */ - - if(!m) - { - -#ifdef I4B_MBUF_DEBUG - printf("i4b_getbuf: error - MGETHDR failed!\n"); -#endif - - return(NULL); - } - - if(len >= MHLEN) - { - MCLGET(m, M_DONTWAIT); - - if(!(m->m_flags & M_EXT)) - { - m_freem(m); - -#ifdef I4B_MBUF_DEBUG - printf("i4b_getbuf: error - MCLGET failed, len(%d)\n", len); -#endif - - return (NULL); - } - } - - m->m_len = len; - - return(m); -} - -/*---------------------------------------------------------------------------* - * free a D-channel mbuf - *---------------------------------------------------------------------------*/ -void -i4b_Dfreembuf(struct mbuf *m) -{ - if(m) - m_freem(m); -} - -/*---------------------------------------------------------------------------* - * clear a D-channel ifqueue from data - *---------------------------------------------------------------------------*/ -void -i4b_Dcleanifq(struct ifqueue *ifq) -{ - struct mbuf *m; - int x = splnet(); - - while(!IF_QEMPTY(ifq)) - { - IF_DEQUEUE(ifq, m); - i4b_Dfreembuf(m); - } - - splx(x); -} - -/*---------------------------------------------------------------------------* - * allocate B-channel mbuf space - *---------------------------------------------------------------------------*/ -struct mbuf* -i4b_Bgetmbuf(int len) -{ - struct mbuf *m; - - if(len > MCLBYTES) /* if length > max extension size */ - { - -#ifdef I4B_MBUF_DEBUG - printf("i4b_getmbuf: error - len(%d) > MCLBYTES(%d)\n", - len, MCLBYTES); -#endif - - return(NULL); - } - - MGETHDR(m, M_DONTWAIT, MT_I4B_B); /* get mbuf with pkthdr */ - - /* did we actually get the mbuf ? */ - - if(!m) - { - -#ifdef I4B_MBUF_DEBUG - printf("i4b_getbuf: error - MGETHDR failed!\n"); -#endif - - return(NULL); - } - - if(len >= MHLEN) - { - MCLGET(m, M_DONTWAIT); - - if(!(m->m_flags & M_EXT)) - { - m_freem(m); - -#ifdef I4B_MBUF_DEBUG - printf("i4b_getbuf: error - MCLGET failed, len(%d)\n", len); -#endif - - return (NULL); - } - } - - m->m_len = len; - - return(m); -} - -/*---------------------------------------------------------------------------* - * free a B-channel mbuf - *---------------------------------------------------------------------------*/ -void -i4b_Bfreembuf(struct mbuf *m) -{ - if(m) - m_freem(m); -} - -/*---------------------------------------------------------------------------* - * clear a B-channel ifqueue from data - *---------------------------------------------------------------------------*/ -void -i4b_Bcleanifq(struct ifqueue *ifq) -{ - struct mbuf *m; - int x = splnet(); - - while(!IF_QEMPTY(ifq)) - { - IF_DEQUEUE(ifq, m); - i4b_Bfreembuf(m); - } - - splx(x); -} - -/* EOF */ diff --git a/sys/netisdn/i4b_mbuf.h b/sys/netisdn/i4b_mbuf.h deleted file mode 100644 index 33f2b4e435fc..000000000000 --- a/sys/netisdn/i4b_mbuf.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b - mbuf handling support routines - * -------------------------------------- - * - * $Id: i4b_mbuf.h,v 1.3 2005/12/10 23:51:50 elad Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Mar 3 14:30:09 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _NETISDN_I4B_MBUF_H_ -#define _NETISDN_I4B_MBUF_H_ - -/* layer 1 / layer 2 comunication: 3rd ph_data_req parameter */ -#define MBUF_DONTFREE 0 -#define MBUF_FREE 1 - -#define IF_QEMPTY(ifq) ((ifq)->ifq_len == 0) - -struct mbuf *i4b_Dgetmbuf( int ); -void i4b_Dfreembuf( struct mbuf *m ); -void i4b_Dcleanifq( struct ifqueue * ); - -struct mbuf *i4b_Bgetmbuf( int ); -void i4b_Bfreembuf( struct mbuf *m ); -void i4b_Bcleanifq( struct ifqueue * ); - -#endif /* !_NETISDN_I4B_MBUF_H_ */ - -/* EOF */ diff --git a/sys/netisdn/i4b_q931.c b/sys/netisdn/i4b_q931.c deleted file mode 100644 index 473be37ae0ce..000000000000 --- a/sys/netisdn/i4b_q931.c +++ /dev/null @@ -1,726 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_q931.c - Q931 received messages handling - * -------------------------------------------- - * - * $Id: i4b_q931.c,v 1.23 2018/09/03 16:29:36 riastradh Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_q931.c,v 1.23 2018/09/03 16:29:36 riastradh Exp $"); - -#ifdef __FreeBSD__ -#include "i4bq931.h" -#else -#define NI4BQ931 1 -#endif - -#if NI4BQ931 > 0 - -#include -#include -#include -#include -#include -#include - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#include -#else -#include -#include -#include -#endif - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -unsigned int i4b_l3_debug = L3_DEBUG_DEFAULT; - -/* protocol independent causes -> Q.931 causes */ - -unsigned char cause_tab_q931[CAUSE_I4B_MAX] = { - CAUSE_Q850_NCCLR, /* CAUSE_I4B_NORMAL -> normal call clearing */ - CAUSE_Q850_USRBSY, /* CAUSE_I4B_BUSY -> user busy */ - CAUSE_Q850_NOCAVAIL, /* CAUSE_I4B_NOCHAN -> no circuit/channel available*/ - CAUSE_Q850_INCDEST, /* CAUSE_I4B_INCOMP -> incompatible destination */ - CAUSE_Q850_CALLREJ, /* CAUSE_I4B_REJECT -> call rejected */ - CAUSE_Q850_DSTOOORDR, /* CAUSE_I4B_OOO -> destination out of order */ - CAUSE_Q850_TMPFAIL, /* CAUSE_I4B_TMPFAIL -> temporary failure */ - CAUSE_Q850_USRBSY, /* CAUSE_I4B_L1ERROR -> L1 error / persistent deact XXX */ - CAUSE_Q850_USRBSY, /* CAUSE_I4B_LLDIAL -> no dialout on leased line XXX */ -}; - -/*---------------------------------------------------------------------------* - * setup cr ref flag according to direction - *---------------------------------------------------------------------------*/ -unsigned char -setup_cr(call_desc_t *cd, unsigned char cr) -{ - if(cd->crflag == CRF_ORIG) - return(cr & 0x7f); /* clear cr ref flag */ - else if(cd->crflag == CRF_DEST) - return(cr | 0x80); /* set cr ref flag */ - else - panic("setup_cr: invalid crflag!"); -} - -/*---------------------------------------------------------------------------* - * decode and process a Q.931 message - *---------------------------------------------------------------------------*/ -void -i4b_decode_q931(int isdnif, int msg_len, u_char *msg_ptr) -{ - call_desc_t *cd = NULL; - int codeset = CODESET_0; - int old_codeset = CODESET_0; - int shift_flag = UNSHIFTED; - int crlen = 0; - int crval = 0; - int crflag = 0; - int i; - int offset; - int s; - - /* check protocol discriminator */ - - if(*msg_ptr != PD_Q931) - { - static int protoflag = -1; /* print only once .. */ - - if(*msg_ptr != protoflag) - { - NDBGL3(L3_P_MSG, "unknown protocol discriminator 0x%x!", *msg_ptr); - protoflag = *msg_ptr; - } - return; - } - - msg_ptr++; - msg_len--; - - s = splnet(); /* this has to be protected ! */ - - /* extract call reference */ - - crlen = *msg_ptr & CRLENGTH_MASK; - msg_ptr++; - msg_len--; - - if (crlen != 0) - { - crval += *msg_ptr & 0x7f; - crflag = (*msg_ptr >> 7) & 0x01; - msg_ptr++; - msg_len--; - - for(i=1; i < crlen; i++) - { - crval += *msg_ptr; - msg_ptr++; - msg_len--; - } - } - else - { - crval = 0; - crflag = 0; - } - - NDBGL3(L3_P_MSG, "Call Ref, len %d, val %d, flag %d", crlen, crval, crflag); - - /* find or allocate calldescriptor */ - - if((cd = cd_by_isdnifcr(isdnif, crval, - crflag == CRF_DEST ? CRF_ORIG : CRF_DEST)) == NULL) - { - if(*msg_ptr == SETUP) - { - struct isdn_l3_driver *drv; - - drv = isdn_find_l3_by_isdnif(isdnif); - /* get and init new calldescriptor */ - - cd = reserve_cd(); /* cdid filled in */ - cd->isdnif = isdnif; - cd->l3drv = drv; - cd->cr = crval; - cd->crflag = CRF_DEST; /* we are the dest side */ - cd->l4_driver = NULL; /* reset link tab ptrs */ - cd->l4_driver_softc = NULL; - } - else - { -/*XXX*/ if(crval != 0) /* ignore global call references */ - { - NDBGL3(L3_P_ERR, "cannot find calldescriptor for cr = 0x%x, crflag = 0x%x, msg = 0x%x, frame = ", crval, crflag, *msg_ptr); - i4b_print_frame(msg_len, msg_ptr); - } - splx(s); - return; - } - } - - splx(s); - - /* decode and handle message type */ - - i4b_decode_q931_message(cd, *msg_ptr); - msg_ptr++; - msg_len--; - - /* process information elements */ - - while(msg_len > 0) - { - /* check for shift codeset IE */ - - if((*msg_ptr & 0x80) && ((*msg_ptr & 0xf0) == SOIE_SHIFT)) - { - if(!(*msg_ptr & SHIFT_LOCK)) - shift_flag = SHIFTED; - - old_codeset = codeset; - codeset = *msg_ptr & CODESET_MASK; - - if((shift_flag != SHIFTED) && - (codeset <= old_codeset)) - { - NDBGL3(L3_P_ERR, "Q.931 lockingshift proc violation, shift %d -> %d", old_codeset, codeset); - codeset = old_codeset; - } - msg_len--; - msg_ptr++; - } - - /* process one IE for selected codeset */ - - switch(codeset) - { - case CODESET_0: - offset = i4b_decode_q931_cs0_ie(cd, msg_len, msg_ptr); - msg_len -= offset; - msg_ptr += offset; - break; - - default: - NDBGL3(L3_P_ERR, "unknown codeset %d, ", codeset); - i4b_print_frame(msg_len, msg_ptr); - msg_len = 0; - break; - } - - /* check for non-locking shifts */ - - if(shift_flag == SHIFTED) - { - shift_flag = UNSHIFTED; - codeset = old_codeset; - } - } - next_l3state(cd, cd->event); -} - -/*---------------------------------------------------------------------------* - * decode and process one Q.931 codeset 0 information element - *---------------------------------------------------------------------------*/ -int -i4b_decode_q931_cs0_ie(call_desc_t *cd, int msg_len, u_char *msg_ptr) -{ - int i, j; - size_t len; - char *p; - - switch(*msg_ptr) - { - -/*********/ -/* Q.931 */ -/*********/ - /* single byte IE's */ - - case IEI_SENDCOMPL: - NDBGL3(L3_P_MSG, "IEI_SENDCOMPL"); - return(1); - break; - - /* multi byte IE's */ - - case IEI_SEGMMSG: /* segmented message */ - NDBGL3(L3_P_MSG, "IEI_SEGMENTED_MESSAGE"); - break; - - case IEI_BEARERCAP: /* bearer capability */ - switch(msg_ptr[2]) - { - case 0x80: /* speech */ - case 0x89: /* restricted digital info */ - case 0x90: /* 3.1 kHz audio */ -/* XXX */ cd->bprot = BPROT_NONE; - NDBGL3(L3_P_MSG, "IEI_BEARERCAP - Telephony"); - break; - - case 0x88: /* unrestricted digital info */ -/* XXX */ cd->bprot = BPROT_RHDLC; - NDBGL3(L3_P_MSG, "IEI_BEARERCAP - Raw HDLC"); - break; - - default: -/* XXX */ cd->bprot = BPROT_NONE; - NDBGL3(L3_P_ERR, "IEI_BEARERCAP - Unsupported B-Protocol 0x%x", msg_ptr[2]); - break; - } - break; - - case IEI_CAUSE: /* cause */ - if(msg_ptr[2] & 0x80) - { - cd->cause_in = msg_ptr[3] & 0x7f; - NDBGL3(L3_P_MSG, "IEI_CAUSE = %d", msg_ptr[3] & 0x7f); - } - else - { - cd->cause_in = msg_ptr[4] & 0x7f; - NDBGL3(L3_P_MSG, "IEI_CAUSE = %d", msg_ptr[4] & 0x7f); - } - break; - - case IEI_CALLID: /* call identity */ - NDBGL3(L3_P_MSG, "IEI_CALL_IDENTITY"); - break; - - case IEI_CALLSTATE: /* call state */ - cd->call_state = msg_ptr[2] & 0x3f; - NDBGL3(L3_P_MSG, "IEI_CALLSTATE = %d", cd->call_state); - break; - - case IEI_CHANNELID: /* channel id */ - if((msg_ptr[2] & 0xf4) != 0x80) - { - cd->channelid = CHAN_NO; - NDBGL3(L3_P_ERR, "IEI_CHANNELID, unsupported value 0x%x", msg_ptr[2]); - } - else - { - int old_chanid = cd->channelid; - switch(msg_ptr[2] & 0x03) - { - case IE_CHAN_ID_NO: - cd->channelid = CHAN_NO; - break; - case IE_CHAN_ID_B1: - cd->channelid = CHAN_B1; - break; - case IE_CHAN_ID_B2: - cd->channelid = CHAN_B2; - break; - case IE_CHAN_ID_ANY: - cd->channelid = CHAN_ANY; - break; - } - cd->channelexcl = (msg_ptr[2] & 0x08) >> 3; - - NDBGL3(L3_P_MSG, "IEI_CHANNELID - channel %d, exclusive = %d", cd->channelid, cd->channelexcl); - - /* if this is the first time we know the real channel, - * reserve it */ - if (old_chanid != cd->channelid) - { - if((cd->channelid == CHAN_B1) || (cd->channelid == CHAN_B2)) - { - struct isdn_l3_driver *d = cd->l3drv; - - if (i4b_l2_channel_get_state(d, cd->channelid) == BCH_ST_FREE) { - if (d != NULL) { - d->bch_state[cd->channelid] = BCH_ST_RSVD; - update_controller_leds(d); - } - i4b_l2_channel_set_state(d, cd->channelid, BCH_ST_RSVD); - } else - NDBGL3(L3_P_ERR, "IE ChannelID, Channel NOT free!!"); - } - else if(cd->channelid == CHAN_NO) - { - NDBGL3(L3_P_MSG, "IE ChannelID, SETUP with channel = No channel (CW)"); - } - else /* cd->channelid == CHAN_ANY */ - { - NDBGL3(L3_P_ERR, "ERROR: IE ChannelID, SETUP with channel = Any channel!"); - } - } - } - break; - - case IEI_PROGRESSI: /* progress indicator */ - NDBGL3(L3_P_MSG, "IEI_PROGRESSINDICATOR"); - break; - - case IEI_NETSPCFAC: /* network specific fac */ - NDBGL3(L3_P_MSG, "IEI_NETSPCFAC"); - break; - - case IEI_NOTIFIND: /* notification indicator */ - NDBGL3(L3_P_MSG, "IEI_NOTIFICATION_INDICATOR"); - break; - - case IEI_DISPLAY: /* display */ - memcpy(cd->display, &msg_ptr[2], uimin(DISPLAY_MAX, msg_ptr[1])); - cd->display[uimin(DISPLAY_MAX, msg_ptr[1])] = '\0'; - NDBGL3(L3_P_MSG, "IEI_DISPLAY = %s", cd->display); - break; - - case IEI_DATETIME: /* date/time */ - i = 2; - j = msg_ptr[1]; - p = cd->datetime; - *p = '\0'; - - len = 0; - for(j = msg_ptr[1]; j > 0; j--, i++) { - snprintf(p + len, sizeof(cd->datetime) - len, - "%02d", msg_ptr[i]); - len = strlen(p); - } - - NDBGL3(L3_P_MSG, "IEI_DATETIME = %s", cd->datetime); - break; - - case IEI_KEYPAD: /* keypad facility */ - NDBGL3(L3_P_MSG, "IEI_KEYPAD_FACILITY"); - break; - - case IEI_SIGNAL: /* signal type */ - NDBGL3(L3_P_MSG, "IEI_SIGNAL = %d", msg_ptr[2]); - break; - - case IEI_INFRATE: /* information rate */ - NDBGL3(L3_P_MSG, "IEI_INFORMATION_RATE"); - break; - - case IEI_ETETDEL: /* end to end transit delay */ - NDBGL3(L3_P_MSG, "IEI_END_TO_END_TRANSIT_DELAY"); - break; - - case IEI_CUG: /* closed user group */ - NDBGL3(L3_P_MSG, "IEI_CLOSED_USER_GROUP"); - break; - - case IEI_CALLINGPN: /* calling party no */ - cd->type_plan = msg_ptr[2] & 0x7f; - if(msg_ptr[2] & 0x80) /* no presentation/screening indicator ? */ - { - memcpy(cd->src_telno, &msg_ptr[3], uimin(TELNO_MAX, msg_ptr[1]-1)); - cd->src_telno[uimin(TELNO_MAX, msg_ptr[1] - 1)] = '\0'; - cd->scr_ind = SCR_NONE; - cd->prs_ind = PRS_NONE; - } - else - { - memcpy(cd->src_telno, &msg_ptr[4], uimin(TELNO_MAX, msg_ptr[1]-2)); - cd->src_telno[uimin(TELNO_MAX, msg_ptr[1] - 2)] = '\0'; - cd->scr_ind = (msg_ptr[3] & 0x03) + SCR_USR_NOSC; - cd->prs_ind = ((msg_ptr[3] >> 5) & 0x03) + PRS_ALLOWED; - } - NDBGL3(L3_P_MSG, "IEI_CALLINGPN = %s", cd->src_telno); - break; - - case IEI_CALLINGPS: /* calling party subaddress */ - NDBGL3(L3_P_MSG, "IEI_CALLINGPS"); - memcpy(cd->src_subaddr, &msg_ptr[1], uimin(SUBADDR_MAX, msg_ptr[1]-1)); - break; - - case IEI_CALLEDPN: /* called party number */ - memcpy(cd->dst_telno, &msg_ptr[3], uimin(TELNO_MAX, msg_ptr[1]-1)); - cd->dst_telno[uimin(TELNO_MAX, msg_ptr [1] - 1)] = '\0'; - NDBGL3(L3_P_MSG, "IEI_CALLED = %s", cd->dst_telno); - break; - - case IEI_CALLEDPS: /* called party subaddress */ - NDBGL3(L3_P_MSG, "IEI_CALLEDPS"); - memcpy(cd->dest_subaddr, &msg_ptr[1], uimin(SUBADDR_MAX, msg_ptr[1]-1)); - break; - - case IEI_REDIRNO: /* redirecting number */ - NDBGL3(L3_P_MSG, "IEI_REDIRECTING_NUMBER"); - break; - - case IEI_TRNSEL: /* transit network selection */ - NDBGL3(L3_P_MSG, "IEI_TRANSIT_NETWORK_SELECTION"); - break; - - case IEI_RESTARTI: /* restart indicator */ - NDBGL3(L3_P_MSG, "IEI_RESTART_INDICATOR"); - break; - - case IEI_LLCOMPAT: /* low layer compat */ - NDBGL3(L3_P_MSG, "IEI_LLCOMPAT"); - break; - - case IEI_HLCOMPAT: /* high layer compat */ - NDBGL3(L3_P_MSG, "IEI_HLCOMPAT"); - break; - - case IEI_USERUSER: /* user-user */ - NDBGL3(L3_P_MSG, "IEI_USER_USER"); - break; - - case IEI_ESCAPE: /* escape for extension */ - NDBGL3(L3_P_MSG, "IEI_ESCAPE"); - break; - -/*********/ -/* Q.932 */ -/*********/ - case IEI_FACILITY: /* facility */ - NDBGL3(L3_P_MSG, "IEI_FACILITY"); - if(i4b_aoc(msg_ptr, cd) > -1) - i4b_l4_charging_ind(cd); - break; - -/*********/ -/* Q.95x */ -/*********/ - case IEI_CONCTDNO: /* connected number */ - NDBGL3(L3_P_MSG, "IEI_CONCTDNO"); - break; - - - default: - NDBGL3(L3_P_ERR, "Unknown IE %d - ", *msg_ptr); - i4b_print_frame(msg_ptr[1]+2, msg_ptr); - break; - } - return(msg_ptr[1] + 2); -} - -/*---------------------------------------------------------------------------* - * decode and process one Q.931 codeset 0 information element - *---------------------------------------------------------------------------*/ -void -i4b_decode_q931_message(call_desc_t *cd, u_char message_type) -{ - const char *m = NULL; - - cd->event = EV_ILL; - - switch(message_type) - { - /* call establishment */ - - case ALERT: - cd->event = EV_ALERT; - m = "ALERT"; - break; - - case CALL_PROCEEDING: - cd->event = EV_CALLPRC; - m = "CALL_PROCEEDING"; - break; - - case PROGRESS: - cd->event = EV_PROGIND; - m = "PROGRESS"; - break; - - case SETUP: - m = "SETUP"; - cd->bprot = BPROT_NONE; - cd->cause_in = 0; - cd->cause_out = 0; - cd->dst_telno[0] = '\0'; - cd->src_telno[0] = '\0'; - cd->channelid = CHAN_NO; - cd->channelexcl = 0; - cd->display[0] = '\0'; - cd->datetime[0] = '\0'; - cd->event = EV_SETUP; - break; - - case CONNECT: - m = "CONNECT"; - cd->datetime[0] = '\0'; - cd->event = EV_CONNECT; - break; - - case SETUP_ACKNOWLEDGE: - m = "SETUP_ACKNOWLEDGE"; - cd->event = EV_SETUPAK; - break; - - case CONNECT_ACKNOWLEDGE: - m = "CONNECT_ACKNOWLEDGE"; - cd->event = EV_CONACK; - break; - - /* call information */ - - case USER_INFORMATION: - m = "USER_INFORMATION"; - break; - - case SUSPEND_REJECT: - m = "SUSPEND_REJECT"; - break; - - case RESUME_REJECT: - m = "RESUME_REJECT"; - break; - - case HOLD: - m = "HOLD"; - break; - - case SUSPEND: - m = "SUSPEND"; - break; - - case RESUME: - m = "RESUME"; - break; - - case HOLD_ACKNOWLEDGE: - m = "HOLD_ACKNOWLEDGE"; - break; - - case SUSPEND_ACKNOWLEDGE: - m = "SUSPEND_ACKNOWLEDGE"; - break; - - case RESUME_ACKNOWLEDGE: - m = "RESUME_ACKNOWLEDGE"; - break; - - case HOLD_REJECT: - m = "HOLD_REJECT"; - break; - - case RETRIEVE: - m = "RETRIEVE"; - break; - - case RETRIEVE_ACKNOWLEDGE: - m = "RETRIEVE_ACKNOWLEDGE"; - break; - - case RETRIEVE_REJECT: - m = "RETRIEVE_REJECT"; - break; - - /* call clearing */ - - case DISCONNECT: - m = "DISCONNECT"; - cd->event = EV_DISCONN; - break; - - case RESTART: - m = "RESTART"; - break; - - case RELEASE: - m = "RELEASE"; - cd->event = EV_RELEASE; - break; - - case RESTART_ACKNOWLEDGE: - m = "RESTART_ACKNOWLEDGE"; - break; - - case RELEASE_COMPLETE: - m = "RELEASE_COMPLETE"; - cd->event = EV_RELCOMP; - break; - - /* misc messages */ - - case SEGMENT: - m = "SEGMENT"; - break; - - case FACILITY: - m = "FACILITY"; - cd->event = EV_FACILITY; - break; - - case REGISTER: - m = "REGISTER"; - break; - - case NOTIFY: - m = "NOTIFY"; - break; - - case STATUS_ENQUIRY: - m = "STATUS_ENQUIRY"; - cd->event = EV_STATENQ; - break; - - case CONGESTION_CONTROL: - m = "CONGESTION_CONTROL"; - break; - - case INFORMATION: - m = "INFORMATION"; - cd->event = EV_INFO; - break; - - case STATUS: - m = "STATUS"; - cd->event = EV_STATUS; - break; - - default: - NDBGL3(L3_P_ERR, "isdnif %d, cr = 0x%02x, msg = 0x%02x", cd->isdnif, cd->cr, message_type); - break; - } - if(m) - { - NDBGL3(L3_PRIM, "%s: isdnif %d, cr = 0x%02x\n", m, cd->isdnif, cd->cr); - } -} - -#endif /* NI4BQ931 > 0 */ diff --git a/sys/netisdn/i4b_q931.h b/sys/netisdn/i4b_q931.h deleted file mode 100644 index 712918dd7447..000000000000 --- a/sys/netisdn/i4b_q931.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_q931.h - Q931 handling header file - * -------------------------------------- - * - * $Id: i4b_q931.h,v 1.4 2005/12/10 23:51:50 elad Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Thu Apr 27 11:07:37 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _NETISDN_I4B_Q931_H_ -#define _NETISDN_I4B_Q931_H_ - -/* extension bit */ - -#define EXT_LAST 0x80 /* last octett */ - -/* reserve space in mbuf */ - -#define I_FRAME_HDRLEN 4 /* to be added by layer 2 */ - -/* SHIFT */ - -#define CODESET_MASK 0x07 -#define UNSHIFTED 0 -#define SHIFTED 1 -#define CRLENGTH_MASK 0x0f - -/* CONNECT */ - -#define MSG_CONNECT_LEN 4 /* length of a connect message */ - -/* DISCONNECT */ - -#define MSG_DISCONNECT_LEN 8 /* length of a disconnect message */ - -/* RELEASE COMPLETE */ - -#define MSG_RELEASE_COMPLETE_LEN 8 /* length of release complete msg */ - -/* for outgoing causes */ - -#define CAUSE_LEN 2 -#define CAUSE_STD_LOC_OUT 0x80 /* std = CCITT, loc = user */ - -/* SETUP */ - -#define MSG_SETUP_LEN 18 /* without number strings ! */ - -#define IEI_BEARERCAP_LEN 2 /* 2 octetts length */ - -#define IT_CAP_SPEECH 0x80 /* BC: information xfer capability */ -#define IT_CAP_UNR_DIG_INFO 0x88 /* BC: information xfer capability */ - -#define IT_RATE_64K 0x90 /* BC: information xfer rate */ -#define IT_UL1_G711A 0xa3 /* layer1 proto G.711 A-law */ - -#define IEI_CHANNELID_LEN 0x01 /* length of channel id */ -#define CHANNELID_B1 0x81 /* channel = B1 (outgoing) */ -#define CHANNELID_B2 0x82 /* channel = B2 (outgoing) */ -#define CHANNELID_ANY 0x83 /* channel = any channel (outgoing) */ - -#define IE_CHAN_ID_NO 0x00 /* no channel (incoming) */ -#define IE_CHAN_ID_B1 0x01 /* B1 channel (incoming) */ -#define IE_CHAN_ID_B2 0x02 /* B2 channel (incoming) */ -#define IE_CHAN_ID_ANY 0x03 /* ANY channel (incoming) */ - -#define NUMBER_TYPEPLAN 0x81 /* type of number/numbering plan */ - -#define IEI_CALLINGPN_LEN 1 /* without number string ! */ - -#define IEI_CALLEDPN_LEN 1 /* without number string ! */ - -/* CONNECT_ACK */ - -#define MSG_CONNECT_ACK_LEN 4 /* length of a connect ack message */ - -/* STATUS */ - -#define MSG_STATUS_LEN 11 -#define CALLSTATE_LEN 1 - -/* RELEASE */ - -#define MSG_RELEASE_LEN 8 /* length of release msg */ - -/* ALERT */ - -#define MSG_ALERT_LEN 4 /* length of a alert message */ - -#endif /* !_NETISDN_I4B_Q931_H_ */ - -/* EOF */ diff --git a/sys/netisdn/i4b_q932fac.c b/sys/netisdn/i4b_q932fac.c deleted file mode 100644 index 688be492c98a..000000000000 --- a/sys/netisdn/i4b_q932fac.c +++ /dev/null @@ -1,572 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_q932fac.c - Q932 facility handling - * -------------------------------------- - * - * $Id: i4b_q932fac.c,v 1.5 2005/12/11 12:25:06 christos Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_q932fac.c,v 1.5 2005/12/11 12:25:06 christos Exp $"); - -#ifdef __FreeBSD__ -#include "i4bq931.h" -#else -#define NI4BQ931 1 -#endif -#if NI4BQ931 > 0 - -#include -#include -#include -#include -#include -#include - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#else -#include -#include -#endif - -#include -#include -#include - -#include -#include -#include -#include - -#include - -static int do_component(int length); -static void next_state(int class, int form, int code, int val); - -static int byte_len; -static unsigned char *byte_buf; -static int state; - -static int units; -static int operation_value; - -/*---------------------------------------------------------------------------* - * decode Q.931/Q.932 facility info element - *---------------------------------------------------------------------------*/ -int -i4b_aoc(unsigned char *buf, call_desc_t *cd) -{ - int len; - - cd->units_type = CHARGE_INVALID; - cd->units = -1; - - buf++; /* length */ - - len = *buf; - - buf++; /* protocol profile */ - - switch(*buf & 0x1f) - { - case FAC_PROTO_ROP: - break; - - case FAC_PROTO_CMIP: - NDBGL3(L3_A_MSG, "CMIP Protocol (Q.941), UNSUPPORTED"); - return(-1); - break; - - case FAC_PROTO_ACSE: - NDBGL3(L3_A_MSG, "ACSE Protocol (X.217/X.227), UNSUPPORTED!"); - return(-1); - break; - - default: - NDBGL3(L3_A_ERR, "Unknown Protocol, UNSUPPORTED!"); - return(-1); - break; - } - - NDBGL3(L3_A_MSG, "Remote Operations Protocol"); - - /* next byte */ - - buf++; - len--; - - /* initialize variables for do_component */ - - byte_len = 0; - byte_buf = buf; - state = ST_EXP_COMP_TYP; - - /* decode facility */ - - do_component(len); - - switch(operation_value) - { - case FAC_OPVAL_AOC_D_CUR: - cd->units_type = CHARGE_AOCD; - cd->units = 0; - return(0); - break; - - case FAC_OPVAL_AOC_D_UNIT: - cd->units_type = CHARGE_AOCD; - cd->units = units; - return(0); - break; - - case FAC_OPVAL_AOC_E_CUR: - cd->units_type = CHARGE_AOCE; - cd->units = 0; - return(0); - break; - - case FAC_OPVAL_AOC_E_UNIT: - cd->units_type = CHARGE_AOCE; - cd->units = units; - return(0); - break; - - default: - cd->units_type = CHARGE_INVALID; - cd->units = -1; - return(-1); - break; - } - return(-1); -} - -/*---------------------------------------------------------------------------* - * handle a component recursively - *---------------------------------------------------------------------------*/ -static int -do_component(int length) -{ - int comp_tag_class; /* component tag class */ - int comp_tag_form; /* component form: constructor or primitive */ - int comp_tag_code; /* component code depending on class */ - int comp_length = 0; /* component length */ - -again: - - /*----------------------------------------*/ - /* first component element: component tag */ - /*----------------------------------------*/ - - /* tag class bits */ - - comp_tag_class = (*byte_buf & 0xc0) >> 6; - - switch(comp_tag_class) - { - case FAC_TAGCLASS_UNI: - break; - case FAC_TAGCLASS_APW: - break; - case FAC_TAGCLASS_COS: - break; - case FAC_TAGCLASS_PRU: - break; - } - - /* tag form bit */ - - comp_tag_form = (*byte_buf & 0x20) > 5; - - /* tag code bits */ - - comp_tag_code = *byte_buf & 0x1f; - - if(comp_tag_code == 0x1f) - { - comp_tag_code = 0; - - byte_buf++; - byte_len++; - - while(*byte_buf & 0x80) - { - comp_tag_code += (*byte_buf & 0x7f); - byte_buf++; - byte_len++; - } - comp_tag_code += (*byte_buf & 0x7f); - } - else - { - comp_tag_code = (*byte_buf & 0x1f); - } - - byte_buf++; - byte_len++; - - /*--------------------------------------------*/ - /* second component element: component length */ - /*--------------------------------------------*/ - - comp_length = 0; - - if(*byte_buf & 0x80) - { - int i = *byte_buf & 0x7f; - - byte_len += i; - - for(;i > 0;i++) - { - byte_buf++; - comp_length += (*byte_buf * (i*256)); - } - } - else - { - comp_length = *byte_buf & 0x7f; - } - - next_state(comp_tag_class, comp_tag_form, comp_tag_code, -1); - - byte_len++; - byte_buf++; - - /*---------------------------------------------*/ - /* third component element: component contents */ - /*---------------------------------------------*/ - - if(comp_tag_form) /* == constructor */ - { - do_component(comp_length); - } - else - { - int val = 0; - if(comp_tag_class == FAC_TAGCLASS_UNI) - { - switch(comp_tag_code) - { - case FAC_CODEUNI_INT: - case FAC_CODEUNI_ENUM: - case FAC_CODEUNI_BOOL: - if(comp_length) - { - int i; - - for(i = comp_length-1; i >= 0; i--) - { - val += (*byte_buf + (i*255)); - byte_buf++; - byte_len++; - } - } - break; - default: - if(comp_length) - { - int i; - - for(i = comp_length-1; i >= 0; i--) - { - byte_buf++; - byte_len++; - } - } - break; - } - } - - else /* comp_tag_class != FAC_TAGCLASS_UNI */ - { - if(comp_length) - { - int i; - - for(i = comp_length-1; i >= 0; i--) - { - val += (*byte_buf + (i*255)); - byte_buf++; - byte_len++; - } - } - } - next_state(comp_tag_class, comp_tag_form, comp_tag_code, val); - } - - if(byte_len < length) - goto again; - - return(byte_len); -} - -/*---------------------------------------------------------------------------* - * invoke component - *---------------------------------------------------------------------------*/ -static void -F_1_1(int val) -{ - if(val == -1) - { - state = ST_EXP_INV_ID; - } -} - -/*---------------------------------------------------------------------------* - * return result - *---------------------------------------------------------------------------*/ -static void -F_1_2(int val) -{ - if(val == -1) - state = ST_EXP_NIX; -} -/*---------------------------------------------------------------------------* - * return error - *---------------------------------------------------------------------------*/ -static void -F_1_3(int val) -{ - if(val == -1) - state = ST_EXP_NIX; -} -/*---------------------------------------------------------------------------* - * reject - *---------------------------------------------------------------------------*/ -static void -F_1_4(int val) -{ - if(val == -1) - state = ST_EXP_NIX; -} - -/*---------------------------------------------------------------------------* - * invoke id - *---------------------------------------------------------------------------*/ -static void -F_2(int val) -{ - if(val != -1) - { - NDBGL3(L3_A_MSG, "Invoke ID = %d", val); - state = ST_EXP_OP_VAL; - } -} - -/*---------------------------------------------------------------------------* - * operation value - *---------------------------------------------------------------------------*/ -static void -F_3(int val) -{ - if(val != -1) - { - NDBGL3(L3_A_MSG, "Operation Value = %d", val); - - operation_value = val; - - if((val == FAC_OPVAL_AOC_D_UNIT) || (val == FAC_OPVAL_AOC_E_UNIT)) - { - units = 0; - state = ST_EXP_INFO; - } - else - { - state = ST_EXP_NIX; - } - } -} - -/*---------------------------------------------------------------------------* - * specific charging units - *---------------------------------------------------------------------------*/ -static void -F_4(int val) -{ - if(val == -1) - state = ST_EXP_RUL; -} - -/*---------------------------------------------------------------------------* - * free of charge - *---------------------------------------------------------------------------*/ -static void -F_4_1(int val) -{ - if(val == -1) - { - NDBGL3(L3_A_MSG, "Free of Charge"); - /* units = 0; XXXX */ - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * charge not available - *---------------------------------------------------------------------------*/ -static void -F_4_2(int val) -{ - if(val == -1) - { - NDBGL3(L3_A_MSG, "Charge not available"); - /* units = -1; XXXXXX ??? */ - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * recorded units list - *---------------------------------------------------------------------------*/ -static void -F_5(int val) -{ - if(val == -1) - state = ST_EXP_RU; -} - -/*---------------------------------------------------------------------------* - * recorded units - *---------------------------------------------------------------------------*/ -static void -F_6(int val) -{ - if(val == -1) - state = ST_EXP_RNOU; -} - -/*---------------------------------------------------------------------------* - * number of units - *---------------------------------------------------------------------------*/ -static void -F_7(int val) -{ - if(val != -1) - { - NDBGL3(L3_A_MSG, "Number of Units = %d", val); - units = val; - state = ST_EXP_TOCI; - } -} - -/*---------------------------------------------------------------------------* - * subtotal/total - *---------------------------------------------------------------------------*/ -static void -F_8(int val) -{ - if(val != -1) - { - NDBGL3(L3_A_MSG, "Subtotal/Total = %d", val); - /* type_of_charge = val; */ - state = ST_EXP_DBID; - } -} - -/*---------------------------------------------------------------------------* - * billing_id - *---------------------------------------------------------------------------*/ -static void -F_9(int val) -{ - if(val != -1) - { - NDBGL3(L3_A_MSG, "Billing ID = %d", val); - /* billing_id = val; */ - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static struct statetab { - int currstate; /* input: current state we are in */ - int form; /* input: current tag form */ - int class; /* input: current tag class */ - int code; /* input: current tag code */ - void (*func)(int); /* output: func to exec */ -} statetab[] = { - -/* current state tag form tag class tag code function */ -/* --------------------- ---------------------- ---------------------- ---------------------- ----------------*/ - {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 1, F_1_1 }, - {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 2, F_1_2 }, - {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 3, F_1_3 }, - {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 4, F_1_4 }, - {ST_EXP_INV_ID, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_2 }, - {ST_EXP_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_3 }, - {ST_EXP_INFO, FAC_TAGFORM_CON, FAC_TAGCLASS_UNI, FAC_CODEUNI_SEQ, F_4 }, - {ST_EXP_INFO, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_NULL, F_4_1 }, - {ST_EXP_INFO, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 1, F_4_2 }, - {ST_EXP_RUL, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 1, F_5 }, - {ST_EXP_RU, FAC_TAGFORM_CON, FAC_TAGCLASS_UNI, FAC_CODEUNI_SEQ, F_6 }, - {ST_EXP_RNOU, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_7 }, - {ST_EXP_TOCI, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 2, F_8 }, - {ST_EXP_DBID, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 3, F_9 }, - {-1, -1, -1, -1, NULL } -}; - -/*---------------------------------------------------------------------------* - * state decode for do_component - *---------------------------------------------------------------------------*/ -static void -next_state(int class, int form, int code, int val) -{ - int i; - - for(i=0; ; i++) - { - if((statetab[i].currstate > state) || - (statetab[i].currstate == -1)) - { - break; - } - - if((statetab[i].currstate == state) && - (statetab[i].form == form) && - (statetab[i].class == class) && - (statetab[i].code == code)) - { - (*statetab[i].func)(val); - break; - } - } -} - -#endif /* NI4BQ931 > 0 */ diff --git a/sys/netisdn/i4b_q932fac.h b/sys/netisdn/i4b_q932fac.h deleted file mode 100644 index a3f249c69861..000000000000 --- a/sys/netisdn/i4b_q932fac.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_q932fac.h - Q932 facility handling header file - * -------------------------------------------------- - * - * $Id: i4b_q932fac.h,v 1.3 2005/12/10 23:51:50 elad Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Thu Apr 27 11:07:52 2000] - * - *--------------------------------------------------------------------------- - * - * - Q.932 (03/93) Generic Procedures for the Control of - * ISDN Supplementaty Services - * - Q.950 (03/93) Supplementary Services Protocols, Structure and - * General Principles - * - ETS 300 179 (10/92) Advice Of Charge: charging information during - * the call (AOC-D) supplementary service Service description - * - ETS 300 180 (10/92) Advice Of Charge: charging information at the - * end of call (AOC-E) supplementary service Service description - * - ETS 300 181 (04/93) Advice Of Charge (AOC) supplementary service - * Functional capabilities and information flows - * - ETS 300 182 (04/93) Advice Of Charge (AOC) supplementary service - * Digital Subscriber Signalling System No. one (DSS1) protocol - * - X.208 Specification of Abstract Syntax Notation One (ASN.1) - * - X.209 Specification of Basic Encoding Rules for - * Abstract Syntax Notation One (ASN.1) - * - "ASN.1 Abstract Syntax Notation One", Walter Gora, DATACOM-Verlag - * 1992, 3rd Edition (ISBN 3-89238-062-7) (german !) - * - *---------------------------------------------------------------------------*/ - -#ifndef _NETISDN_I4B_Q932FAC_H_ -#define _NETISDN_I4B_Q932FAC_H_ - -/* protocols */ -#define FAC_PROTO_ROP 0x11 -#define FAC_PROTO_CMIP 0x12 -#define FAC_PROTO_ACSE 0x13 - -/* tag classes */ -#define FAC_TAGCLASS_UNI 0x00 -#define FAC_TAGCLASS_APW 0x01 -#define FAC_TAGCLASS_COS 0x02 -#define FAC_TAGCLASS_PRU 0x03 - -/* tag forms */ -#define FAC_TAGFORM_PRI 0x00 -#define FAC_TAGFORM_CON 0x01 - -/* class UNIVERSAL values */ -#define FAC_CODEUNI_BOOL 1 -#define FAC_CODEUNI_INT 2 -#define FAC_CODEUNI_BITS 3 -#define FAC_CODEUNI_OCTS 4 -#define FAC_CODEUNI_NULL 5 -#define FAC_CODEUNI_OBJI 6 -#define FAC_CODEUNI_OBJD 7 -#define FAC_CODEUNI_EXT 8 -#define FAC_CODEUNI_REAL 9 -#define FAC_CODEUNI_ENUM 10 -#define FAC_CODEUNI_R11 11 -#define FAC_CODEUNI_R12 12 -#define FAC_CODEUNI_R13 13 -#define FAC_CODEUNI_R14 14 -#define FAC_CODEUNI_R15 15 -#define FAC_CODEUNI_SEQ 16 -#define FAC_CODEUNI_SET 17 -#define FAC_CODEUNI_NSTR 18 -#define FAC_CODEUNI_PSTR 19 -#define FAC_CODEUNI_TSTR 20 -#define FAC_CODEUNI_VSTR 21 -#define FAC_CODEUNI_ISTR 22 -#define FAC_CODEUNI_UTIME 23 -#define FAC_CODEUNI_GTIME 24 -#define FAC_CODEUNI_GSTR 25 -#define FAC_CODEUNI_VISTR 26 -#define FAC_CODEUNI_GNSTR 27 - -/* operation values */ -#define FAC_OPVAL_UUS 1 -#define FAC_OPVAL_CUG 2 -#define FAC_OPVAL_MCID 3 -#define FAC_OPVAL_BTPY 4 -#define FAC_OPVAL_ETPY 5 -#define FAC_OPVAL_ECT 6 - -#define FAC_OPVAL_DIV_ACT 7 -#define FAC_OPVAL_DIV_DEACT 8 -#define FAC_OPVAL_DIV_ACTSN 9 -#define FAC_OPVAL_DIV_DEACTSN 10 -#define FAC_OPVAL_DIV_INTER 11 -#define FAC_OPVAL_DIV_INFO 12 -#define FAC_OPVAL_DIV_CALLDEF 13 -#define FAC_OPVAL_DIV_CALLRER 14 -#define FAC_OPVAL_DIV_LINF2 15 -#define FAC_OPVAL_DIV_INVS 16 -#define FAC_OPVAL_DIV_INTER1 17 -#define FAC_OPVAL_DIV_LINF1 18 -#define FAC_OPVAL_DIV_LINF3 19 - -#define FAC_OPVAL_ER_CRCO 20 -#define FAC_OPVAL_ER_MGMT 21 -#define FAC_OPVAL_ER_CANC 22 - -#define FAC_OPVAL_MLPP_QUERY 24 -#define FAC_OPVAL_MLPP_CALLR 25 -#define FAC_OPVAL_MLPP_CALLP 26 - -#define FAC_OPVAL_AOC_REQ 30 -#define FAC_OPVAL_AOC_S_CUR 31 -#define FAC_OPVAL_AOC_S_SPC 32 -#define FAC_OPVAL_AOC_D_CUR 33 -#define FAC_OPVAL_AOC_D_UNIT 34 -#define FAC_OPVAL_AOC_E_CUR 35 -#define FAC_OPVAL_AOC_E_UNIT 36 -#define FAC_OPVAL_AOC_IDOFCRG 37 - -#define FAC_OPVAL_CONF_BEG 40 -#define FAC_OPVAL_CONF_ADD 41 -#define FAC_OPVAL_CONF_SPLIT 42 -#define FAC_OPVAL_CONF_DROP 43 -#define FAC_OPVAL_CONF_ISOLATE 44 -#define FAC_OPVAL_CONF_REATT 45 -#define FAC_OPVAL_CONF_PDISC 46 -#define FAC_OPVAL_CONF_FCONF 47 -#define FAC_OPVAL_CONF_END 48 -#define FAC_OPVAL_CONF_IDCFE 49 - -#define FAC_OPVAL_REVC_REQ 60 - -enum states { - ST_EXP_COMP_TYP, - ST_EXP_INV_ID, - ST_EXP_OP_VAL, - ST_EXP_INFO, - ST_EXP_RUL, - ST_EXP_RU, - ST_EXP_RNOU, - ST_EXP_TOCI, - ST_EXP_DBID, - - ST_EXP_NIX -}; - -/* EOF */ - -#endif /* !_NETISDN_I4B_Q932FAC_H_ */ diff --git a/sys/netisdn/i4b_rbch.c b/sys/netisdn/i4b_rbch.c deleted file mode 100644 index ed947dc204a7..000000000000 --- a/sys/netisdn/i4b_rbch.c +++ /dev/null @@ -1,1225 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_rbch.c - device driver for raw B channel data - * --------------------------------------------------- - * - * $Id: i4b_rbch.c,v 1.30 2018/09/03 16:29:36 riastradh Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_rbch.c,v 1.30 2018/09/03 16:29:36 riastradh Exp $"); - -#include "isdnbchan.h" - -#if NISDNBCHAN > 0 - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#if defined (__NetBSD__) || defined (__OpenBSD__) -#define termioschars(t) memcpy((t)->c_cc, &ttydefchars, sizeof((t)->c_cc)) -#endif - -#ifdef __FreeBSD__ - -#if defined(__FreeBSD__) && __FreeBSD__ == 3 -#include "opt_devfs.h" -#endif - -#ifdef DEVFS -#include -#endif - -#endif /* __FreeBSD__ */ - -#ifdef __NetBSD__ -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#include -#else -#include -#include -#include -#endif - -#include -#include -#include - -#include - -#ifdef __bsdi__ -#include -#endif - -#ifdef OS_USES_POLL -#include -#include -#else -#include -#include -#endif - -#if defined(__FreeBSD__) && __FreeBSD__ >= 3 -#include -#endif - -#define I4BRBCHACCT 1 /* enable accounting messages */ -#define I4BRBCHACCTINTVL 2 /* accounting msg interval in secs */ - -static struct rbch_softc { - - int sc_unit; /* unit number */ - - int sc_devstate; /* state of driver */ -#define ST_IDLE 0x00 -#define ST_CONNECTED 0x01 -#define ST_ISOPEN 0x02 -#define ST_RDWAITDATA 0x04 -#define ST_WRWAITEMPTY 0x08 -#define ST_NOBLOCK 0x10 - - int sc_bprot; /* B-ch protocol used */ - - call_desc_t *sc_cd; /* Call Descriptor */ - isdn_link_t *sc_ilt; /* B-channel driver/state */ - - struct termios it_in; - - struct ifqueue sc_hdlcq; /* hdlc read queue */ -#define I4BRBCHMAXQLEN 10 - - struct selinfo selp; /* select / poll */ - -#if defined(__FreeBSD__) && __FreeBSD__ == 3 -#ifdef DEVFS - void *devfs_token; /* device filesystem */ -#endif -#endif - -#if I4BRBCHACCT -#if defined(__FreeBSD__) - struct callout_handle sc_callout; -#endif -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 - struct callout sc_callout; -#endif - - int sc_iinb; /* isdn driver # of inbytes */ - int sc_ioutb; /* isdn driver # of outbytes */ - int sc_linb; /* last # of bytes rx'd */ - int sc_loutb; /* last # of bytes tx'd */ - int sc_fn; /* flag, first null acct */ -#endif -} rbch_softc[NISDNBCHAN]; - -static void rbch_rx_data_rdy(void *softc); -static void rbch_tx_queue_empty(void *softc); -static void rbch_connect(void *softc, void *cdp); -static void rbch_disconnect(void *softc, void *cdp); -static void rbch_clrq(void *softc); -static void rbch_activity(void *softc, int rxtx); -static void rbch_dialresponse(void *softc, int status, cause_t cause); -static void rbch_updown(void *softc, int updown); -static void rbch_set_linktab(void *softc, isdn_link_t *ilt); -static void* rbch_get_softc(int unit); - - -#ifndef __FreeBSD__ -#define PDEVSTATIC /* - not static - */ -#define IOCTL_CMD_T u_long -void isdnbchanattach(void); -int isdnbchanopen(dev_t dev, int flag, int fmt, struct lwp *l); -int isdnbchanclose(dev_t dev, int flag, int fmt, struct lwp *l); -int isdnbchanread(dev_t dev, struct uio *uio, int ioflag); -int isdnbchanwrite(dev_t dev, struct uio *uio, int ioflag); -int isdnbchanioctl(dev_t dev, IOCTL_CMD_T cmd, void *arg, int flag, struct lwp* l); -#ifdef OS_USES_POLL -int isdnbchanpoll(dev_t dev, int events, struct lwp *l); -int isdnbchankqfilter(dev_t dev, struct knote *kn); -#else -PDEVSTATIC int isdnbchanselect(dev_t dev, int rw, struct lwp *l); -#endif -#endif - -#ifdef __NetBSD__ -const struct cdevsw isdnbchan_cdevsw = { - .d_open = isdnbchanopen, - .d_close = isdnbchanclose, - .d_read = isdnbchanread, - .d_write = isdnbchanwrite, - .d_ioctl = isdnbchanioctl, - .d_stop = nostop, - .d_tty = notty, - .d_poll = isdnbchanpoll, - .d_mmap = nommap, - .d_kqfilter = nokqfilter, - .d_discard = nodiscard, - .d_flag = D_OTHER -}; -#endif /* __NetBSD__ */ - -#if BSD > 199306 && defined(__FreeBSD__) -#define PDEVSTATIC static -#define IOCTL_CMD_T u_long - -PDEVSTATIC d_open_t isdnbchanopen; -PDEVSTATIC d_close_t isdnbchanclose; -PDEVSTATIC d_read_t isdnbchanread; -PDEVSTATIC d_read_t isdnbchanwrite; -PDEVSTATIC d_ioctl_t isdnbchanioctl; - -#ifdef OS_USES_POLL -PDEVSTATIC d_poll_t isdnbchanpoll; -#define POLLFIELD isdnbchanpoll -#else -PDEVSTATIC d_select_t isdnbchanselect; -#define POLLFIELD isdnbchanselect -#endif - -#define CDEV_MAJOR 57 - -#if defined(__FreeBSD__) && __FreeBSD__ >= 4 -static struct cdevsw isdnbchan_cdevsw = { - /* open */ isdnbchanopen, - /* close */ isdnbchanclose, - /* read */ isdnbchanread, - /* write */ isdnbchanwrite, - /* ioctl */ isdnbchanioctl, - /* poll */ POLLFIELD, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "isdnbchan", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, - /* bmaj */ -1 -}; -#else -static struct cdevsw isdnbchan_cdevsw = { - isdnbchanopen, isdnbchanclose, isdnbchanread, isdnbchanwrite, - isdnbchanioctl, nostop, noreset, nodevtotty, - POLLFIELD, nommap, NULL, "isdnbchan", NULL, -1 -}; -#endif - -static void isdnbchanattach(void *); -PSEUDO_SET(isdnbchanattach, i4b_rbch); - -/*===========================================================================* - * DEVICE DRIVER ROUTINES - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * initialization at kernel load time - *---------------------------------------------------------------------------*/ -static void -isdnbchaninit(void *unused) -{ -#if defined(__FreeBSD__) && __FreeBSD__ >= 4 - cdevsw_add(&isdnbchan_cdevsw); -#else - dev_t dev = makedev(CDEV_MAJOR, 0); - cdevsw_add(&dev, &isdnbchan_cdevsw, NULL); -#endif -} - -SYSINIT(isdnbchandev, SI_SUB_DRIVERS, - SI_ORDER_MIDDLE+CDEV_MAJOR, &isdnbchaninit, NULL); - -#endif /* BSD > 199306 && defined(__FreeBSD__) */ - -#ifdef __bsdi__ -int isdnbchanmatch(device_t parent, cfdata_t cf, void *aux); -void dummy_isdnbchanattach(struct device*, struct device *, void *); - -#define CDEV_MAJOR 61 - -static struct cfdriver isdnbchancd = - { NULL, "isdnbchan", isdnbchanmatch, dummy_isdnbchanattach, DV_DULL, - sizeof(struct cfdriver) }; -struct devsw isdnbchansw = - { &isdnbchancd, - isdnbchanopen, isdnbchanclose, isdnbchanread, isdnbchanwrite, - isdnbchanioctl, seltrue, nommap, nostrat, - nodump, nopsize, 0, nostop -}; - -int -isdnbchanmatch(device_t parent, cfdata_t cf, void *aux) -{ - printf("isdnbchanmatch: aux=0x%x\n", aux); - return 1; -} -void -dummy_isdnbchanattach(device_t parent, device_t self, void *aux) -{ - printf("dummy_isdnbchanattach: aux=0x%x\n", aux); -} -#endif /* __bsdi__ */ - - -static const struct isdn_l4_driver_functions -rbch_driver_functions = { - rbch_rx_data_rdy, - rbch_tx_queue_empty, - rbch_activity, - rbch_connect, - rbch_disconnect, - rbch_dialresponse, - rbch_updown, - rbch_get_softc, - rbch_set_linktab, - NULL -}; - -static int rbch_driver_id = -1; - -/*---------------------------------------------------------------------------* - * interface attach routine - *---------------------------------------------------------------------------*/ -PDEVSTATIC void -#ifdef __FreeBSD__ -isdnbchanattach(void *dummy) -#else -isdnbchanattach(void) -#endif -{ - int i; - - rbch_driver_id = isdn_l4_driver_attach("isdnbchan", NISDNBCHAN, &rbch_driver_functions); - - for(i=0; i < NISDNBCHAN; i++) - { -#if defined(__FreeBSD__) -#if __FreeBSD__ == 3 - -#ifdef DEVFS - rbch_softc[i].devfs_token = - devfs_add_devswf(&isdnbchan_cdevsw, i, DV_CHR, - UID_ROOT, GID_WHEEL, 0600, - "isdnbchan%d", i); -#endif - -#else - make_dev(&isdnbchan_cdevsw, i, - UID_ROOT, GID_WHEEL, 0600, "isdnbchan%d", i); -#endif -#endif - -#if I4BRBCHACCT -#if defined(__FreeBSD__) - callout_handle_init(&rbch_softc[i].sc_callout); -#endif -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 - callout_init(&rbch_softc[i].sc_callout, 0); - selinit(&rbch_softc[i].selp); -#endif - rbch_softc[i].sc_fn = 1; -#endif - rbch_softc[i].sc_unit = i; - rbch_softc[i].sc_devstate = ST_IDLE; - rbch_softc[i].sc_hdlcq.ifq_maxlen = I4BRBCHMAXQLEN; - rbch_softc[i].it_in.c_ispeed = rbch_softc[i].it_in.c_ospeed = 64000; - termioschars(&rbch_softc[i].it_in); - } -} - -/*---------------------------------------------------------------------------* - * open rbch device - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdnbchanopen(dev_t dev, int flag, int fmt, - struct lwp *l) -{ - int unit = minor(dev); - - if(unit >= NISDNBCHAN) - return(ENXIO); - - if(rbch_softc[unit].sc_devstate & ST_ISOPEN) - return(EBUSY); - -#if 0 - rbch_clrq(unit); -#endif - - rbch_softc[unit].sc_devstate |= ST_ISOPEN; - - NDBGL4(L4_RBCHDBG, "unit %d, open", unit); - - return(0); -} - -/*---------------------------------------------------------------------------* - * close rbch device - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdnbchanclose(dev_t dev, int flag, int fmt, - struct lwp *l) -{ - int unit = minor(dev); - struct rbch_softc *sc = &rbch_softc[unit]; - - if(sc->sc_devstate & ST_CONNECTED) - i4b_l4_drvrdisc(sc->sc_cd->cdid); - - sc->sc_devstate &= ~ST_ISOPEN; - - rbch_clrq(sc); - - NDBGL4(L4_RBCHDBG, "channel %d, closed", unit); - - return(0); -} - -/*---------------------------------------------------------------------------* - * read from rbch device - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdnbchanread(dev_t dev, struct uio *uio, int ioflag) -{ - struct mbuf *m; - int error = 0; - int unit = minor(dev); - struct ifqueue *iqp; - struct rbch_softc *sc = &rbch_softc[unit]; - - int s; - - NDBGL4(L4_RBCHDBG, "unit %d, enter read", unit); - - s = splnet(); - if(!(sc->sc_devstate & ST_ISOPEN)) - { - splx(s); - NDBGL4(L4_RBCHDBG, "unit %d, read while not open", unit); - return(EIO); - } - - if((sc->sc_devstate & ST_NOBLOCK)) - { - if(!(sc->sc_devstate & ST_CONNECTED)) { - splx(s); - return(EWOULDBLOCK); - } - - if(sc->sc_bprot == BPROT_RHDLC) - iqp = &sc->sc_hdlcq; - else - iqp = sc->sc_ilt->rx_queue; - - if(IF_QEMPTY(iqp) && (sc->sc_devstate & ST_ISOPEN)) { - splx(s); - return(EWOULDBLOCK); - } - } - else - { - while(!(sc->sc_devstate & ST_CONNECTED)) - { - NDBGL4(L4_RBCHDBG, "unit %d, wait read init", unit); - - if((error = tsleep((void *) &rbch_softc[unit], - TTIPRI | PCATCH, - "rrrbch", 0 )) != 0) - { - splx(s); - NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep", unit, error); - return(error); - } - } - - if(sc->sc_bprot == BPROT_RHDLC) - iqp = &sc->sc_hdlcq; - else - iqp = sc->sc_ilt->rx_queue; - - while(IF_QEMPTY(iqp) && (sc->sc_devstate & ST_ISOPEN)) - { - sc->sc_devstate |= ST_RDWAITDATA; - - NDBGL4(L4_RBCHDBG, "unit %d, wait read data", unit); - - if((error = tsleep((void *) &sc->sc_ilt->rx_queue, - TTIPRI | PCATCH, - "rrbch", 0 )) != 0) - { - splx(s); - NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep read", unit, error); - sc->sc_devstate &= ~ST_RDWAITDATA; - return(error); - } else if (!(sc->sc_devstate & ST_CONNECTED)) { - splx(s); - return 0; - } - } - } - - IF_DEQUEUE(iqp, m); - - NDBGL4(L4_RBCHDBG, "unit %d, read %d bytes", unit, m->m_len); - - if(m && m->m_len) - { - error = uiomove(m->m_data, m->m_len, uio); - } - else - { - NDBGL4(L4_RBCHDBG, "unit %d, error %d uiomove", unit, error); - error = EIO; - } - - if(m) - i4b_Bfreembuf(m); - - splx(s); - - return(error); -} - -/*---------------------------------------------------------------------------* - * write to rbch device - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdnbchanwrite(dev_t dev, struct uio * uio, int ioflag) -{ - struct mbuf *m; - int error = 0; - int unit = minor(dev); - struct rbch_softc *sc = &rbch_softc[unit]; - - int s; - - NDBGL4(L4_RBCHDBG, "unit %d, write", unit); - - s = splnet(); - if(!(sc->sc_devstate & ST_ISOPEN)) - { - NDBGL4(L4_RBCHDBG, "unit %d, write while not open", unit); - splx(s); - return(EIO); - } - - if((sc->sc_devstate & ST_NOBLOCK)) - { - if(!(sc->sc_devstate & ST_CONNECTED)) { - splx(s); - return(EWOULDBLOCK); - } - if(IF_QFULL(sc->sc_ilt->tx_queue) && (sc->sc_devstate & ST_ISOPEN)) { - splx(s); - return(EWOULDBLOCK); - } - } - else - { - while(!(sc->sc_devstate & ST_CONNECTED)) - { - NDBGL4(L4_RBCHDBG, "unit %d, write wait init", unit); - - error = tsleep((void *) &rbch_softc[unit], - TTIPRI | PCATCH, - "wrrbch", 0 ); - if(error == ERESTART) { - splx(s); - return (ERESTART); - } - else if(error == EINTR) - { - splx(s); - NDBGL4(L4_RBCHDBG, "unit %d, EINTR during wait init", unit); - return(EINTR); - } - else if(error) - { - splx(s); - NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep init", unit, error); - return(error); - } - tsleep((void *) &rbch_softc[unit], TTIPRI | PCATCH, "xrbch", (hz*1)); - } - - while(IF_QFULL(sc->sc_ilt->tx_queue) && (sc->sc_devstate & ST_ISOPEN)) - { - sc->sc_devstate |= ST_WRWAITEMPTY; - - NDBGL4(L4_RBCHDBG, "unit %d, write queue full", unit); - - if ((error = tsleep((void *) &sc->sc_ilt->tx_queue, - TTIPRI | PCATCH, - "wrbch", 0)) != 0) { - sc->sc_devstate &= ~ST_WRWAITEMPTY; - if(error == ERESTART) - { - splx(s); - return(ERESTART); - } - else if(error == EINTR) - { - splx(s); - NDBGL4(L4_RBCHDBG, "unit %d, EINTR during wait write", unit); - return(error); - } - else if(error) - { - splx(s); - NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep write", unit, error); - return(error); - } - else if (!(sc->sc_devstate & ST_CONNECTED)) { - splx(s); - return 0; - } - } - } - } - - if(!(sc->sc_devstate & ST_ISOPEN)) - { - NDBGL4(L4_RBCHDBG, "unit %d, not open anymore", unit); - splx(s); - return(EIO); - } - - if((m = i4b_Bgetmbuf(BCH_MAX_DATALEN)) != NULL) - { - m->m_len = uimin(BCH_MAX_DATALEN, uio->uio_resid); - - NDBGL4(L4_RBCHDBG, "unit %d, write %d bytes", unit, m->m_len); - - error = uiomove(m->m_data, m->m_len, uio); - - if(IF_QFULL(sc->sc_ilt->tx_queue)) - { - m_freem(m); - } - else - { - IF_ENQUEUE(sc->sc_ilt->tx_queue, m); - } - - (*sc->sc_ilt->bchannel_driver->bch_tx_start)(sc->sc_ilt->l1token, sc->sc_ilt->channel); - } - - splx(s); - - return(error); -} - -/*---------------------------------------------------------------------------* - * rbch device ioctl handlibg - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdnbchanioctl(dev_t dev, IOCTL_CMD_T cmd, void *data, int flag, - struct lwp *l) -{ - int error = 0; - int unit = minor(dev); - struct rbch_softc *sc = &rbch_softc[unit]; - - switch(cmd) - { - case FIOASYNC: /* Set async mode */ - if (*(int *)data) - { - NDBGL4(L4_RBCHDBG, "unit %d, setting async mode", unit); - } - else - { - NDBGL4(L4_RBCHDBG, "unit %d, clearing async mode", unit); - } - break; - - case FIONBIO: - if (*(int *)data) - { - NDBGL4(L4_RBCHDBG, "unit %d, setting non-blocking mode", unit); - sc->sc_devstate |= ST_NOBLOCK; - } - else - { - NDBGL4(L4_RBCHDBG, "unit %d, clearing non-blocking mode", unit); - sc->sc_devstate &= ~ST_NOBLOCK; - } - break; - - case TIOCCDTR: /* Clear DTR */ - if(sc->sc_devstate & ST_CONNECTED) - { - NDBGL4(L4_RBCHDBG, "unit %d, disconnecting for DTR down", unit); - i4b_l4_drvrdisc(sc->sc_cd->cdid); - } - break; - - case I4B_RBCH_DIALOUT: - { - size_t x; - - for (x = 0; x < TELNO_MAX && ((char *)data)[x]; x++) - ; - if (x) - { - NDBGL4(L4_RBCHDBG, "%d, attempting dialout to %s", unit, (char *)data); - i4b_l4_dialoutnumber(rbch_driver_id, unit, x, (char *)data); - break; - } - /* fall through to SDTR */ - } - - case TIOCSDTR: /* Set DTR */ - NDBGL4(L4_RBCHDBG, "unit %d, attempting dialout (DTR)", unit); - i4b_l4_dialout(rbch_driver_id, unit); - break; - - case TIOCSETA: /* Set termios struct */ - break; - - case TIOCGETA: /* Get termios struct */ - *(struct termios *)data = sc->it_in; - break; - - case TIOCMGET: - *(int *)data = TIOCM_LE|TIOCM_DTR|TIOCM_RTS|TIOCM_CTS|TIOCM_DSR; - if (sc->sc_devstate & ST_CONNECTED) - *(int *)data |= TIOCM_CD; - break; - - case I4B_RBCH_VR_REQ: - { - msg_vr_req_t *mvr; - - mvr = (msg_vr_req_t *)data; - - mvr->version = VERSION; - mvr->release = REL; - mvr->step = STEP; - break; - } - - default: /* Unknown stuff */ - NDBGL4(L4_RBCHDBG, "(minor=%d) ioctl, unknown cmd %lx", unit, (u_long)cmd); - error = EINVAL; - break; - } - return(error); -} - -#ifdef OS_USES_POLL - -/*---------------------------------------------------------------------------* - * device driver poll - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdnbchanpoll(dev_t dev, int events, struct lwp *l) -{ - int revents = 0; /* Events we found */ - int s; - int unit = minor(dev); - struct rbch_softc *sc = &rbch_softc[unit]; - - /* We can't check for anything but IN or OUT */ - - s = splhigh(); - - if(!(sc->sc_devstate & ST_ISOPEN)) - { - splx(s); - return(POLLNVAL); - } - - /* - * Writes are OK if we are connected and the - * transmit queue can take them - */ - - if((events & (POLLOUT|POLLWRNORM)) && - (sc->sc_devstate & ST_CONNECTED) && - !IF_QFULL(sc->sc_ilt->tx_queue)) - { - revents |= (events & (POLLOUT|POLLWRNORM)); - } - - /* ... while reads are OK if we have any data */ - - if((events & (POLLIN|POLLRDNORM)) && - (sc->sc_devstate & ST_CONNECTED)) - { - struct ifqueue *iqp; - - if(sc->sc_bprot == BPROT_RHDLC) - iqp = &sc->sc_hdlcq; - else - iqp = sc->sc_ilt->rx_queue; - - if(!IF_QEMPTY(iqp)) - revents |= (events & (POLLIN|POLLRDNORM)); - } - - if(revents == 0) - selrecord(l, &sc->selp); - - splx(s); - return(revents); -} - -static void -filt_i4brbchdetach(struct knote *kn) -{ - struct rbch_softc *sc = kn->kn_hook; - int s; - - s = splhigh(); - SLIST_REMOVE(&sc->selp.sel_klist, kn, knote, kn_selnext); - splx(s); -} - -static int -filt_i4brbchread(struct knote *kn, long hint) -{ - struct rbch_softc *sc = kn->kn_hook; - struct ifqueue *iqp; - - if ((sc->sc_devstate & ST_CONNECTED) == 0) - return (0); - - if (sc->sc_bprot == BPROT_RHDLC) - iqp = &sc->sc_hdlcq; - else - iqp = sc->sc_ilt->rx_queue; - - if (IF_QEMPTY(iqp)) - return (0); - - kn->kn_data = 0; /* XXXLUKEM (thorpej): what to put here? */ - return (1); -} - -static const struct filterops i4brbchread_filtops = { - .f_isfd = 1, - .f_attach = NULL, - .f_detach = filt_i4brbchdetach, - .f_event = filt_i4brbchread, -}; - -static int -filt_i4brbchwrite(struct knote *kn, long hint) -{ - struct rbch_softc *sc = kn->kn_hook; - - if ((sc->sc_devstate & ST_CONNECTED) == 0) - return (0); - - if (IF_QFULL(sc->sc_ilt->tx_queue)) - return (0); - - kn->kn_data = 0; /* XXXLUKEM (thorpej): what to put here? */ - return (1); -} - -static const struct filterops i4brbchwrite_filtops = { - .f_isfd = 1, - .f_attach = NULL, - .f_detach = filt_i4brbchdetach, - .f_event = filt_i4brbchwrite, -}; - -int -isdnbchankqfilter(dev_t dev, struct knote *kn) -{ - struct rbch_softc *sc = &rbch_softc[minor(dev)]; - struct klist *klist; - int s; - - switch (kn->kn_filter) { - case EVFILT_READ: - klist = &sc->selp.sel_klist; - kn->kn_fop = &i4brbchread_filtops; - break; - - case EVFILT_WRITE: - klist = &sc->selp.sel_klist; - kn->kn_fop = &i4brbchwrite_filtops; - break; - - default: - return (EINVAL); - } - - kn->kn_hook = sc; - - s = splhigh(); - SLIST_INSERT_HEAD(klist, kn, kn_selnext); - splx(s); - - return (0); -} - -#else /* OS_USES_POLL */ - -/*---------------------------------------------------------------------------* - * device driver select - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdnbchanselect(dev_t dev, int rw, struct lwp *l) -{ - int unit = minor(dev); - struct rbch_softc *sc = &rbch_softc[unit]; - int s; - - s = splhigh(); - - if(!(sc->sc_devstate & ST_ISOPEN)) - { - splx(s); - NDBGL4(L4_RBCHDBG, "(minor=%d) not open anymore", unit); - return(1); - } - - if(sc->sc_devstate & ST_CONNECTED) - { - struct ifqueue *iqp; - - switch(rw) - { - case FREAD: - if(sc->sc_bprot == BPROT_RHDLC) - iqp = &sc->sc_hdlcq; - else - iqp = isdn_linktab[unit]->rx_queue; - - if(!IF_QEMPTY(iqp)) - { - splx(s); - return(1); - } - break; - - case FWRITE: - if(!IF_QFULL(isdn_linktab[unit]->rx_queue)) - { - splx(s); - return(1); - } - break; - - default: - splx(s); - return 0; - } - } - selrecord(l, &sc->selp); - splx(s); - return(0); -} - -#endif /* OS_USES_POLL */ - -#if I4BRBCHACCT -/*---------------------------------------------------------------------------* - * watchdog routine - *---------------------------------------------------------------------------*/ -static void -rbch_timeout(struct rbch_softc *sc) -{ - bchan_statistics_t bs; - - /* get # of bytes in and out from the HSCX driver */ - - (*sc->sc_ilt->bchannel_driver->bch_stat) - (sc->sc_ilt->l1token, sc->sc_ilt->channel, &bs); - - sc->sc_ioutb += bs.outbytes; - sc->sc_iinb += bs.inbytes; - - if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn) - { - int ri = (sc->sc_iinb - sc->sc_linb)/I4BRBCHACCTINTVL; - int ro = (sc->sc_ioutb - sc->sc_loutb)/I4BRBCHACCTINTVL; - - if((sc->sc_iinb == sc->sc_linb) && (sc->sc_ioutb == sc->sc_loutb)) - sc->sc_fn = 0; - else - sc->sc_fn = 1; - - sc->sc_linb = sc->sc_iinb; - sc->sc_loutb = sc->sc_ioutb; - - if (sc->sc_cd) - i4b_l4_accounting(sc->sc_cd->cdid, ACCT_DURING, - sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_ioutb, sc->sc_iinb); - } - START_TIMER(sc->sc_callout, rbch_timeout, sc, I4BRBCHACCTINTVL*hz); -} -#endif /* I4BRBCHACCT */ - -/*===========================================================================* - * ISDN INTERFACE ROUTINES - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * this routine is called from L4 handler at connect time - *---------------------------------------------------------------------------*/ -static void -rbch_connect(void *softc, void *cdp) -{ - call_desc_t *cd = (call_desc_t *)cdp; - struct rbch_softc *sc = softc; - - sc->sc_bprot = cd->bprot; - -#if I4BRBCHACCT - if(sc->sc_bprot == BPROT_RHDLC) - { - sc->sc_iinb = 0; - sc->sc_ioutb = 0; - sc->sc_linb = 0; - sc->sc_loutb = 0; - - START_TIMER(sc->sc_callout, rbch_timeout, sc, I4BRBCHACCTINTVL*hz); - } -#endif - if(!(sc->sc_devstate & ST_CONNECTED)) - { - NDBGL4(L4_RBCHDBG, "B channel %d at ISDN %d, wakeup", - cd->channelid, cd->isdnif); - sc->sc_devstate |= ST_CONNECTED; - sc->sc_cd = cdp; - wakeup((void *)sc); - selnotify(&sc->selp, 0, 0); - } -} - -/*---------------------------------------------------------------------------* - * this routine is called from L4 handler at disconnect time - *---------------------------------------------------------------------------*/ -static void -rbch_disconnect(void *softc, void *cdp) -{ - call_desc_t *cd = cdp; - struct rbch_softc *sc = softc; - - int s; - - if(cd != sc->sc_cd) - { - NDBGL4(L4_RBCHDBG, "B channel %d at ISDN %d not active", - cd->channelid, cd->isdnif); - return; - } - - s = splnet(); - - NDBGL4(L4_RBCHDBG, "B channel %d at ISDN %d disconnect", - cd->channelid, cd->isdnif); - - sc->sc_devstate &= ~ST_CONNECTED; - -#if I4BRBCHACCT - if (sc->sc_cd) - i4b_l4_accounting(sc->sc_cd->cdid, ACCT_FINAL, - sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_ioutb, sc->sc_iinb); - - STOP_TIMER(sc->sc_callout, rbch_timeout, sc); -#endif - - sc->sc_cd = NULL; - if (sc->sc_devstate & ST_RDWAITDATA) - wakeup(&sc->sc_ilt->rx_queue); - if (sc->sc_devstate & ST_WRWAITEMPTY) - wakeup(&sc->sc_ilt->tx_queue); - - splx(s); - - selnotify(&sc->selp, 0, 0); -} - -/*---------------------------------------------------------------------------* - * feedback from daemon in case of dial problems - *---------------------------------------------------------------------------*/ -static void -rbch_dialresponse(void *softc, int status, - cause_t cause) -{ -} - -/*---------------------------------------------------------------------------* - * interface up/down - *---------------------------------------------------------------------------*/ -static void -rbch_updown(void *softc, int updown) -{ -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * when a new frame (mbuf) has been received and is to be put on - * the rx queue. - *---------------------------------------------------------------------------*/ -static void -rbch_rx_data_rdy(void *softc) -{ - struct rbch_softc *sc = softc; - - if(sc->sc_bprot == BPROT_RHDLC) - { - register struct mbuf *m; - - if((m = *sc->sc_ilt->rx_mbuf) == NULL) - return; - - m->m_pkthdr.len = m->m_len; - - if(IF_QFULL(&sc->sc_hdlcq)) - { - NDBGL4(L4_RBCHDBG, "(minor=%d) hdlc rx queue full!", sc->sc_unit); - m_freem(m); - } - else - { - IF_ENQUEUE(&sc->sc_hdlcq, m); - } - } - - if(sc->sc_devstate & ST_RDWAITDATA) - { - NDBGL4(L4_RBCHDBG, "(minor=%d) wakeup", sc->sc_unit); - sc->sc_devstate &= ~ST_RDWAITDATA; - wakeup((void *) &sc->sc_ilt->rx_queue); - } - else - { - NDBGL4(L4_RBCHDBG, "(minor=%d) NO wakeup", sc->sc_unit); - } - selnotify(&sc->selp, 0, 0); -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * when the last frame has been sent out and there is no - * further frame (mbuf) in the tx queue. - *---------------------------------------------------------------------------*/ -static void -rbch_tx_queue_empty(void *softc) -{ - struct rbch_softc *sc = softc; - - if(sc->sc_devstate & ST_WRWAITEMPTY) - { - NDBGL4(L4_RBCHDBG, "(minor=%d): wakeup", sc->sc_unit); - sc->sc_devstate &= ~ST_WRWAITEMPTY; - wakeup((void *) &sc->sc_ilt->tx_queue); - } - else - { - NDBGL4(L4_RBCHDBG, "(minor=%d) NO wakeup", sc->sc_unit); - } - selnotify(&sc->selp, 0, 0); -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * each time a packet is received or transmitted - *---------------------------------------------------------------------------*/ -static void -rbch_activity(void *softc, int rxtx) -{ - struct rbch_softc *sc = softc; - - if (sc->sc_cd) - sc->sc_cd->last_active_time = SECOND; - selnotify(&sc->selp, 0, 0); -} - -/*---------------------------------------------------------------------------* - * clear an hdlc rx queue for a rbch unit - *---------------------------------------------------------------------------*/ -static void -rbch_clrq(void *softc) -{ - struct rbch_softc *sc = softc; - struct mbuf *m; - int s; - - for(;;) - { - s = splnet(); - IF_DEQUEUE(&sc->sc_hdlcq, m); - splx(s); - - if(m) - m_freem(m); - else - break; - } -} - -/*---------------------------------------------------------------------------* - * setup the isdn_linktab for this driver - *---------------------------------------------------------------------------*/ -static void -rbch_set_linktab(void *softc, isdn_link_t *ilt) -{ - struct rbch_softc *sc = softc; - sc->sc_ilt = ilt; -} - -/*---------------------------------------------------------------------------* - * initialize this drivers linktab - *---------------------------------------------------------------------------*/ -static void* -rbch_get_softc(int unit) -{ - return &rbch_softc[unit]; -} - -/*===========================================================================*/ - -#endif /* NISDNBCHAN > 0 */ diff --git a/sys/netisdn/i4b_rbch_ioctl.h b/sys/netisdn/i4b_rbch_ioctl.h deleted file mode 100644 index 1ddf103e7db8..000000000000 --- a/sys/netisdn/i4b_rbch_ioctl.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_rbch_ioctl.h raw B-channel driver interface ioctls - * ------------------------------------------------------ - * - * $Id: i4b_rbch_ioctl.h,v 1.3 2015/09/06 06:01:01 dholland Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 22:07:12 1999] - * - *---------------------------------------------------------------------------*/ - -#ifndef _NETISDN_I4B_RBCH_IOCTL_H_ -#define _NETISDN_I4B_RBCH_IOCTL_H_ - -#include - -/*---------------------------------------------------------------------------* - * instruct the rbch device to dial the given number - *---------------------------------------------------------------------------*/ - -typedef char telno_t[TELNO_MAX]; - -#define I4B_RBCH_DIALOUT _IOW('R', 1, telno_t) - -/*---------------------------------------------------------------------------* - * request version and release info from kernel part - *---------------------------------------------------------------------------*/ - -#define I4B_RBCH_VR_REQ _IOR('R', 2, msg_vr_req_t) - -#endif /* !_NETISDN_I4B_RBCH_IOCTL_H_ */ diff --git a/sys/netisdn/i4b_sframe.c b/sys/netisdn/i4b_sframe.c deleted file mode 100644 index 07318f6e366d..000000000000 --- a/sys/netisdn/i4b_sframe.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_sframe.c - s frame handling routines - * ---------------------------------------- - * - * $Id: i4b_sframe.c,v 1.8 2005/12/11 12:25:06 christos Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_sframe.c,v 1.8 2005/12/11 12:25:06 christos Exp $"); - -#ifdef __FreeBSD__ -#include "i4bq921.h" -#else -#define NI4BQ921 1 -#endif -#if NI4BQ921 > 0 - -#include -#include -#include -#include -#include -#include - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#else -#include -#include -#endif - -#include -#include -#include -#include -#include -#include - -/*---------------------------------------------------------------------------* - * process s frame - *---------------------------------------------------------------------------*/ -void -i4b_rxd_s_frame(l2_softc_t *l2sc, struct isdn_l3_driver *drv, struct mbuf *m) -{ - u_char *ptr = m->m_data; - - if(!((l2sc->tei_valid == TEI_VALID) && - (l2sc->tei == GETTEI(*(ptr+OFF_TEI))))) - { - i4b_Dfreembuf(m); - return; - } - - l2sc->rxd_CR = GETCR(*(ptr + OFF_SAPI)); - l2sc->rxd_PF = GETSPF(*(ptr + OFF_SNR)); - l2sc->rxd_NR = GETSNR(*(ptr + OFF_SNR)); - - i4b_rxd_ack(l2sc, drv, l2sc->rxd_NR); - - switch(*(ptr + OFF_SRCR)) - { - case RR: - l2sc->stat.rx_rr++; /* update statistics */ - NDBGL2(L2_S_MSG, "rx'd RR, N(R) = %d", l2sc->rxd_NR); - i4b_next_l2state(l2sc, drv, EV_RXRR); - break; - - case RNR: - l2sc->stat.rx_rnr++; /* update statistics */ - NDBGL2(L2_S_MSG, "rx'd RNR, N(R) = %d", l2sc->rxd_NR); - i4b_next_l2state(l2sc, drv, EV_RXRNR); - break; - - case REJ: - l2sc->stat.rx_rej++; /* update statistics */ - NDBGL2(L2_S_MSG, "rx'd REJ, N(R) = %d", l2sc->rxd_NR); - i4b_next_l2state(l2sc, drv, EV_RXREJ); - break; - - default: - l2sc->stat.err_rx_bads++; /* update statistics */ - NDBGL2(L2_S_ERR, "ERROR, unknown code, frame = "); - i4b_print_frame(m->m_len, m->m_data); - break; - } - i4b_Dfreembuf(m); -} - -/*---------------------------------------------------------------------------* - * transmit RR command - *---------------------------------------------------------------------------*/ -void -i4b_tx_rr_command(l2_softc_t *l2sc, pbit_t pbit) -{ - struct mbuf *m; - - NDBGL2(L2_S_MSG, "tx RR, isdnif = %d", l2sc->drv->isdnif); - - m = i4b_build_s_frame(l2sc, CR_CMD_TO_NT, pbit, RR); - - l2sc->driver->ph_data_req(l2sc->l1_token, m, MBUF_FREE); - - l2sc->stat.tx_rr++; /* update statistics */ -} - -/*---------------------------------------------------------------------------* - * transmit RR response - *---------------------------------------------------------------------------*/ -void -i4b_tx_rr_response(l2_softc_t *l2sc, fbit_t fbit) -{ - struct mbuf *m; - - NDBGL2(L2_S_MSG, "tx RR, isdnif = %d", l2sc->drv->isdnif); - - m = i4b_build_s_frame(l2sc, CR_RSP_TO_NT, fbit, RR); - - l2sc->driver->ph_data_req(l2sc->l1_token, m, MBUF_FREE); - - l2sc->stat.tx_rr++; /* update statistics */ -} - -/*---------------------------------------------------------------------------* - * transmit RNR command - *---------------------------------------------------------------------------*/ -void -i4b_tx_rnr_command(l2_softc_t *l2sc, pbit_t pbit) -{ - struct mbuf *m; - - NDBGL2(L2_S_MSG, "tx RNR, isdnif = %d", l2sc->drv->isdnif); - - m = i4b_build_s_frame(l2sc, CR_CMD_TO_NT, pbit, RNR); - - l2sc->driver->ph_data_req(l2sc->l1_token, m, MBUF_FREE); - - l2sc->stat.tx_rnr++; /* update statistics */ -} - -/*---------------------------------------------------------------------------* - * transmit RNR response - *---------------------------------------------------------------------------*/ -void -i4b_tx_rnr_response(l2_softc_t *l2sc, fbit_t fbit) -{ - struct mbuf *m; - - NDBGL2(L2_S_MSG, "tx RNR, isdnif = %d", l2sc->drv->isdnif); - - m = i4b_build_s_frame(l2sc, CR_RSP_TO_NT, fbit, RNR); - - l2sc->driver->ph_data_req(l2sc->l1_token, m, MBUF_FREE); - - l2sc->stat.tx_rnr++; /* update statistics */ -} - -/*---------------------------------------------------------------------------* - * transmit REJ response - *---------------------------------------------------------------------------*/ -void -i4b_tx_rej_response(l2_softc_t *l2sc, fbit_t fbit) -{ - struct mbuf *m; - - NDBGL2(L2_S_MSG, "tx REJ, isdnif = %d", l2sc->drv->isdnif); - - m = i4b_build_s_frame(l2sc, CR_RSP_TO_NT, fbit, REJ); - - l2sc->driver->ph_data_req(l2sc->l1_token, m, MBUF_FREE); - - l2sc->stat.tx_rej++; /* update statistics */ -} - -/*---------------------------------------------------------------------------* - * build S-frame for sending - *---------------------------------------------------------------------------*/ -struct mbuf * -i4b_build_s_frame(l2_softc_t *l2sc, crbit_to_nt_t crbit, pbit_t pbit, u_char type) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(S_FRAME_LEN)) == NULL) - return(NULL); - - PUTSAPI(SAPI_CCP, crbit, m->m_data[OFF_SAPI]); - - PUTTEI(l2sc->tei, m->m_data[OFF_TEI]); - - m->m_data[OFF_SRCR] = type; - - m->m_data[OFF_SNR] = (l2sc->vr << 1) | (pbit & 0x01); - - return(m); -} - -#endif /* NI4BQ921 > 0 */ diff --git a/sys/netisdn/i4b_tei.c b/sys/netisdn/i4b_tei.c deleted file mode 100644 index 0fd634be28e4..000000000000 --- a/sys/netisdn/i4b_tei.c +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_tei.c - tei handling procedures - * ----------------------------------- - * - * $Id: i4b_tei.c,v 1.10 2007/01/24 13:08:15 hubertf Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_tei.c,v 1.10 2007/01/24 13:08:15 hubertf Exp $"); - -#ifdef __FreeBSD__ -#include "i4bq921.h" -#else -#define NI4BQ921 1 -#endif -#if NI4BQ921 > 0 - -#include -#include -#include -#include -#include -#include -#include - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#if defined(__FreeBSD__) -#if defined (__FreeBSD_version) && __FreeBSD_version <= 400000 -#include -#else -#include -#endif -#endif - -#ifdef __FreeBSD__ -#include -#include -#else -#include -#include -#endif - -#include -#include -#include -#include -#include - -#include -#include - -/*---------------------------------------------------------------------------* - * handle a received TEI management frame - *---------------------------------------------------------------------------*/ -void -i4b_tei_rxframe(l2_softc_t *l2sc, struct isdn_l3_driver *drv, struct mbuf *m) -{ - u_char *ptr = m->m_data; - - switch(*(ptr + OFF_MT)) - { - case MT_ID_ASSIGN: - if( (*(ptr + OFF_RIL) == l2sc->last_ril) && - (*(ptr + OFF_RIH) == l2sc->last_rih)) - { - l2sc->tei = GET_TEIFROMAI(*(ptr+OFF_AI)); - l2sc->tei_valid = TEI_VALID; - - if(l2sc->T202 == TIMER_ACTIVE) - i4b_T202_stop(l2sc); - - i4b_mdl_status_ind(drv, STI_TEIASG, l2sc->tei); - - log(LOG_INFO, "i4b: isdnif %d, assigned TEI = %d = 0x%02x\n", l2sc->drv->isdnif, l2sc->tei, l2sc->tei); - - NDBGL2(L2_TEI_MSG, "TEI ID Assign - TEI = %d", l2sc->tei); - - i4b_next_l2state(l2sc, drv, EV_MDASGRQ); - } - break; - - case MT_ID_DENY: - if( (*(ptr + OFF_RIL) == l2sc->last_ril) && - (*(ptr + OFF_RIH) == l2sc->last_rih)) - { - l2sc->tei_valid = TEI_INVALID; - l2sc->tei = GET_TEIFROMAI(*(ptr+OFF_AI)); - - if(l2sc->tei == GROUP_TEI) - { - log(LOG_WARNING, "i4b: isdnif %d, denied TEI, no TEI values available from exchange!\n", l2sc->drv->isdnif); - NDBGL2(L2_TEI_ERR, "TEI ID Denied, No TEI values available from exchange!"); - } - else - { - log(LOG_WARNING, "i4b: isdnif %d, denied TEI = %d = 0x%02x\n", l2sc->drv->isdnif, l2sc->tei, l2sc->tei); - NDBGL2(L2_TEI_ERR, "TEI ID Denied - TEI = %d", l2sc->tei); - } - i4b_mdl_status_ind(drv, STI_TEIASG, -1); - i4b_next_l2state(l2sc, drv, EV_MDERRRS); - } - break; - - case MT_ID_CHK_REQ: - if( (l2sc->tei_valid == TEI_VALID) && - ( (l2sc->tei == GET_TEIFROMAI(*(ptr+OFF_AI))) || - (GROUP_TEI == GET_TEIFROMAI(*(ptr+OFF_AI))) )) - { - static int lasttei = -1; - - if(l2sc->tei != lasttei) - { - NDBGL2(L2_TEI_MSG, "TEI ID Check Req - TEI = %d", l2sc->tei); - lasttei = l2sc->tei; - } - - if(l2sc->T202 == TIMER_ACTIVE) - i4b_T202_stop(l2sc); - i4b_tei_chkresp(l2sc); - } - break; - - case MT_ID_REMOVE: - if( (l2sc->tei_valid == TEI_VALID) && - ( (l2sc->tei == GET_TEIFROMAI(*(ptr+OFF_AI))) || - (l2sc->tei == GET_TEIFROMAI(*(ptr+OFF_AI))))) - { - l2sc->tei_valid = TEI_INVALID; - l2sc->tei = GET_TEIFROMAI(*(ptr+OFF_AI)); - - log(LOG_INFO, "i4b: isdnif %d, removed TEI = %d = 0x%02x\n", drv->isdnif, l2sc->tei, l2sc->tei); - NDBGL2(L2_TEI_MSG, "TEI ID Remove - TEI = %d", l2sc->tei); - i4b_mdl_status_ind(drv, STI_TEIASG, -1); - i4b_next_l2state(l2sc, drv, EV_MDREMRQ); - } - break; - - default: - NDBGL2(L2_TEI_ERR, "UNKNOWN TEI MGMT Frame, type = 0x%x", *(ptr + OFF_MT)); - i4b_print_frame(m->m_len, m->m_data); - break; - } - i4b_Dfreembuf(m); -} - -/*---------------------------------------------------------------------------* - * allocate and fill up a TEI management frame for sending - *---------------------------------------------------------------------------*/ -static struct mbuf * -build_tei_mgmt_frame(l2_softc_t *l2sc, unsigned char type) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(TEI_MGMT_FRM_LEN)) == NULL) - return(NULL); - - m->m_data[TEIM_SAPIO] = 0xfc; /* SAPI = 63, CR = 0, EA = 0 */ - m->m_data[TEIM_TEIO] = 0xff; /* TEI = 127, EA = 1 */ - m->m_data[TEIM_UIO] = UI; /* UI */ - m->m_data[TEIM_MEIO] = MEI; /* MEI */ - m->m_data[TEIM_MTO] = type; /* message type */ - - switch(type) - { - case MT_ID_REQEST: - i4b_make_rand_ri(l2sc); - m->m_data[TEIM_RILO] = l2sc->last_ril; - m->m_data[TEIM_RIHO] = l2sc->last_rih; - m->m_data[TEIM_AIO] = (GROUP_TEI << 1) | 0x01; - break; - - case MT_ID_CHK_RSP: - i4b_make_rand_ri(l2sc); - m->m_data[TEIM_RILO] = l2sc->last_ril; - m->m_data[TEIM_RIHO] = l2sc->last_rih; - m->m_data[TEIM_AIO] = (l2sc->tei << 1) | 0x01; - break; - - case MT_ID_VERIFY: - m->m_data[TEIM_RILO] = 0; - m->m_data[TEIM_RIHO] = 0; - m->m_data[TEIM_AIO] = (l2sc->tei << 1) | 0x01; - break; - - default: - i4b_Dfreembuf(m); - panic("build_tei_mgmt_frame: invalid type"); - break; - } - l2sc->stat.tx_tei++; - return(m); -} - -/*---------------------------------------------------------------------------* - * i4b_tei_assign - TEI assignment procedure (Q.921, 5.3.2, pp 24) - * T202func and N202 _MUST_ be set prior to calling this function ! - *---------------------------------------------------------------------------*/ -void -i4b_tei_assign(l2_softc_t *l2sc) -{ - struct mbuf *m; - - NDBGL2(L2_TEI_MSG, "tx TEI ID_Request"); - - m = build_tei_mgmt_frame(l2sc, MT_ID_REQEST); - - if(m == NULL) - panic("i4b_tei_assign: no mbuf"); - - i4b_T202_start(l2sc); - - l2sc->driver->ph_data_req(l2sc->l1_token, m, MBUF_FREE); -} - -/*---------------------------------------------------------------------------* - * i4b_tei_assign - TEI verify procedure (Q.921, 5.3.5, pp 29) - * T202func and N202 _MUST_ be set prior to calling this function ! - *---------------------------------------------------------------------------*/ -void -i4b_tei_verify(l2_softc_t *l2sc) -{ - struct mbuf *m; - - NDBGL2(L2_TEI_MSG, "tx TEI ID_Verify"); - - m = build_tei_mgmt_frame(l2sc, MT_ID_VERIFY); - - if(m == NULL) - panic("i4b_tei_verify: no mbuf"); - - i4b_T202_start(l2sc); - - l2sc->driver->ph_data_req(l2sc->l1_token, m, MBUF_FREE); -} - -/*---------------------------------------------------------------------------* - * i4b_tei_chkresp - TEI check response procedure (Q.921, 5.3.5, pp 29) - *---------------------------------------------------------------------------*/ -void -i4b_tei_chkresp(l2_softc_t *l2sc) -{ - struct mbuf *m; - static int lasttei = 0; - - if(l2sc->tei != lasttei) - { - lasttei = l2sc->tei; - NDBGL2(L2_TEI_MSG, "tx TEI ID_Check_Response"); - } - - m = build_tei_mgmt_frame(l2sc, MT_ID_CHK_RSP); - - if(m == NULL) - panic("i4b_tei_chkresp: no mbuf"); - - l2sc->driver->ph_data_req(l2sc->l1_token, m, MBUF_FREE); -} - -/*---------------------------------------------------------------------------* - * generate some 16 bit "random" number used for TEI mgmt Ri field - *---------------------------------------------------------------------------*/ -void -i4b_make_rand_ri(l2_softc_t *l2sc) -{ - -#if defined(__FreeBSD__) - - u_short val; - -#ifdef RANDOMDEV - read_random((char *)&val, sizeof(val)); -#else - val = (u_short)random(); -#endif /* RANDOMDEV */ - -#else - - register u_short val; - register int i; - static int called = 42; - struct timeval t; - - val = (l2sc->last_rih << 8) | l2sc->last_ril; - - val += ++called; - - for(i=0; i < 50 ; i++, val++) - { - getmicrotime(&t); - val |= l2sc->drv->isdnif+i; - val <<= i; - val ^= (t.tv_sec >> 16) ^ t.tv_usec; - val <<= i; - val ^= t.tv_sec ^ (t.tv_usec >> 16); - - if(val != 0 && val != 0xffff) - break; - } -#endif - l2sc->last_rih = (val >> 8) & 0x00ff; - l2sc->last_ril = val & 0x00ff; -} - -#endif /* NI4BQ921 > 0 */ diff --git a/sys/netisdn/i4b_tel.c b/sys/netisdn/i4b_tel.c deleted file mode 100644 index ea92954e32ea..000000000000 --- a/sys/netisdn/i4b_tel.c +++ /dev/null @@ -1,2045 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_tel.c - device driver for ISDN telephony - * -------------------------------------------- - * - * $Id: i4b_tel.c,v 1.29 2018/09/03 16:29:36 riastradh Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_tel.c,v 1.29 2018/09/03 16:29:36 riastradh Exp $"); - -#include "isdntel.h" - -#if NISDNTEL > 0 - -#undef I4BTELDEBUG - -#include -#include - -#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__NetBSD__) -#include -#include -#else -#include -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __FreeBSD__ - -#if defined(__FreeBSD__) && __FreeBSD__ == 3 -#include "opt_devfs.h" -#endif - -#ifdef DEVFS -#include -#endif - -#endif /* __FreeBSD__ */ - -#ifdef __bsdi__ -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#include -#else -#include -#include -#include -#endif - -#include -#include -#include - -#include - -/* minor number: lower 6 bits = unit number */ -#define UNITBITS 6 -#define UNITMASK 0x3f -#define UNIT(n) (minor(n) & UNITMASK) - -/* minor number: upper 2 bits = function number */ - -#define FUNCMASK 0x03 -#define FUNC(n) (((minor(n)) >> UNITBITS) & FUNCMASK) - -#define FUNCTEL 0 /* 0 = normal i4btel device */ -#define FUNCDIAL 1 /* 1 = i4bteld dialout device */ - -#define NOFUNCS 2 /* number of device classes */ - -typedef struct tel_softc { - - /* used only in func = FUNCTEL */ - - isdn_link_t *isdn_linktab; /* isdn linktab */ - int audiofmt; /* audio format conversion */ - u_char *rcvttab; /* conversion table on read */ - u_char *wcvttab; /* conversion table on write */ - call_desc_t *cdp; /* call descriptor pointer */ - - /* link from FUNCTEL to FUNCDIAL */ - struct tel_softc * dialer; - - /* used only in func = FUNCDIAL */ - - char result; /* result code for dial dev */ - - /* used in func = FUNCDIAL and func = FUNCTEL*/ - - int devstate; /* state of this unit */ -#define ST_IDLE 0x00 /* idle */ -#define ST_CONNECTED 0x01 /* isdn connected state */ -#define ST_ISOPEN 0x02 /* userland opened */ -#define ST_RDWAITDATA 0x04 /* userland read waiting */ -#define ST_WRWAITEMPTY 0x08 /* userland write waiting */ -#define ST_TONE 0x10 /* tone generator */ - - struct selinfo selp; /* select / poll */ - -#if defined(__FreeBSD__) && __FreeBSD__ == 3 -#ifdef DEVFS - void *devfs_token; /* token for DEVFS */ -#endif -#endif - struct i4b_tel_tones tones; - int toneidx; - int toneomega; - int tonefreq; - -} tel_sc_t; - -static tel_sc_t tel_sc[NISDNTEL][NOFUNCS]; - -/* forward decl */ - -static void tel_rx_data_rdy(void *softc); -static void tel_tx_queue_empty(void *softc); -static void tel_connect(void *softc, void *cdp); -static void tel_disconnect(void *softc, void *cdp); -static void tel_tone(tel_sc_t *sc); -static void tel_activity(void *softc, int rxtx); -static void tel_updown(void *softc, int updown); -static void tel_dialresponse(void *softc, int status, cause_t cause); -static void* tel_get_softc(int unit); -static void tel_set_linktab(void *softc, isdn_link_t *ilt); - -/* audio format conversion tables */ -static unsigned char a2u_tab[]; -static unsigned char u2a_tab[]; -static unsigned char bitreverse[]; -static u_char sinetab[]; - -#ifndef __FreeBSD__ -#define PDEVSTATIC /* - not static - */ -PDEVSTATIC void isdntelattach(void); -PDEVSTATIC int isdntelioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l); - -int isdntelopen(dev_t dev, int flag, int fmt, struct lwp *l); -int isdntelclose(dev_t dev, int flag, int fmt, struct lwp *l); -int isdntelread(dev_t dev, struct uio *uio, int ioflag); -int isdntelwrite(dev_t dev, struct uio * uio, int ioflag); - -#ifdef OS_USES_POLL -int isdntelpoll(dev_t dev, int events, struct lwp *l); -int isdntelkqfilter(dev_t dev, struct knote *kn); -#else -int isdntelsel(dev_t dev, int rw, struct lwp *l); -#endif - -#endif /* __FreeBSD__ */ - -#ifdef __NetBSD__ -const struct cdevsw isdntel_cdevsw = { - .d_open = isdntelopen, - .d_close = isdntelclose, - .d_read = isdntelread, - .d_write = isdntelwrite, - .d_ioctl = isdntelioctl, - .d_stop = nostop, - .d_tty = notty, - .d_poll = isdntelpoll, - .d_mmap = nommap, - .d_kqfilter = isdntelkqfilter, - .d_discard = nodiscard, - .d_flag = D_OTHER -}; -#endif /* __NetBSD__ */ - -#if BSD > 199306 && defined(__FreeBSD__) - -#define PDEVSTATIC static -PDEVSTATIC d_open_t i4btelopen; -PDEVSTATIC d_close_t i4btelclose; -PDEVSTATIC d_read_t i4btelread; -PDEVSTATIC d_read_t i4btelwrite; -PDEVSTATIC d_ioctl_t i4btelioctl; - -#ifdef OS_USES_POLL -PDEVSTATIC d_poll_t i4btelpoll; -#define POLLFIELD i4btelpoll -#else -PDEVSTATIC d_select_t i4btelsel; -#define POLLFIELD i4btelsel -#endif - -#define CDEV_MAJOR 56 - -#if defined(__FreeBSD__) && __FreeBSD__ >= 4 -static struct cdevsw i4btel_cdevsw = { - /* open */ i4btelopen, - /* close */ i4btelclose, - /* read */ i4btelread, - /* write */ i4btelwrite, - /* ioctl */ i4btelioctl, - /* poll */ POLLFIELD, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "i4btel", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, - /* bmaj */ -1 -}; -#else -static struct cdevsw i4btel_cdevsw = { - i4btelopen, i4btelclose, i4btelread, i4btelwrite, - i4btelioctl, nostop, noreset, nodevtotty, - POLLFIELD, nommap, NULL, "i4btel", NULL, -1 -}; -#endif - -PDEVSTATIC void isdntelinit(void *unused); -PDEVSTATIC void isdntelattach(void *); - -PSEUDO_SET(isdntelattach, i4b_tel); - -/*===========================================================================* - * DEVICE DRIVER ROUTINES - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * initialization at kernel load time - *---------------------------------------------------------------------------*/ -PDEVSTATIC void -isdntelinit(void *unused) -{ -#if defined(__FreeBSD__) && __FreeBSD__ >= 4 - cdevsw_add(&i4btel_cdevsw); -#else - dev_t dev = makedev(CDEV_MAJOR, 0); - cdevsw_add(&dev, &i4btel_cdevsw, NULL); -#endif -} - -SYSINIT(i4bteldev, SI_SUB_DRIVERS, - SI_ORDER_MIDDLE+CDEV_MAJOR, &i4btelinit, NULL); - -#endif /* BSD > 199306 && defined(__FreeBSD__) */ - -#ifdef __bsdi__ - -int i4btelsel(dev_t dev, int rw, struct lwp *l); -int i4btelmatch(device_t parent, cfdata_t cf, void *aux); -void dummy_i4btelattach(struct device*, struct device *, void *); - -#define CDEV_MAJOR 62 - -static struct cfdriver i4btelcd = - { NULL, "i4btel", i4btelmatch, dummy_i4btelattach, DV_DULL, - sizeof(struct cfdriver) }; -struct devsw i4btelsw = - { &i4btelcd, - i4btelopen, i4btelclose, i4btelread, i4btelwrite, - i4btelioctl, i4btelsel, nommap, nostrat, - nodump, nopsize, 0, nostop -}; - -int -i4btelmatch(device_t parent, cfdata_t cf, void *aux) -{ - NDBGL4(L4_TELDBG, "aux=0x%x", aux); - return 1; -} - -void -dummy_i4btelattach(device_t parent, device_t self, void *aux) -{ - NDBGL4(L4_TELDBG, "aux=0x%x", aux); -} - -#endif /* __bsdi__ */ - -static const struct isdn_l4_driver_functions -tel_driver = { - tel_rx_data_rdy, - tel_tx_queue_empty, - tel_activity, - tel_connect, - tel_disconnect, - tel_dialresponse, - tel_updown, - tel_get_softc, - tel_set_linktab, - NULL -}; - -static int isdntel_driver_id = -1; - -/*---------------------------------------------------------------------------* - * interface attach routine - *---------------------------------------------------------------------------*/ -PDEVSTATIC void -#ifdef __FreeBSD__ -isdntelattach(void *dummy) -#else -isdntelattach(void) -#endif -{ - int i, j; - - isdntel_driver_id = isdn_l4_driver_attach("isdntel", NISDNTEL, &tel_driver); - - for(i=0; i < NISDNTEL; i++) - { - for(j=0; j < NOFUNCS; j++) - { - selinit(&tel_sc[i][j].selp); - - tel_sc[i][j].devstate = ST_IDLE; - tel_sc[i][j].audiofmt = CVT_NONE; - tel_sc[i][j].rcvttab = 0; - tel_sc[i][j].wcvttab = 0; - tel_sc[i][j].result = 0; - - if (j == FUNCTEL) - tel_sc[i][FUNCTEL].dialer = &tel_sc[i][FUNCDIAL]; - else - tel_sc[i][j].dialer = NULL; - -#if defined(__FreeBSD__) -#if __FreeBSD__ == 3 - -#ifdef DEVFS - -/* XXX */ tel_sc[i][j].devfs_token - = devfs_add_devswf(&i4btel_cdevsw, i, DV_CHR, - UID_ROOT, GID_WHEEL, 0600, - "i4btel%d", i); -#endif - -#else - switch(j) - { - case FUNCTEL: /* normal i4btel device */ - make_dev(&i4btel_cdevsw, i, - UID_ROOT, GID_WHEEL, - 0600, "i4btel%d", i); - break; - - case FUNCDIAL: /* i4bteld dialout device */ - make_dev(&i4btel_cdevsw, i+(1<= NISDNTEL) - return(ENXIO); - - sc = &tel_sc[unit][func]; - - if(sc->devstate & ST_ISOPEN) - return(EBUSY); - - sc->devstate |= ST_ISOPEN; - - if(func == FUNCDIAL) - { - sc->result = 0; - } - - return(0); -} - -/*---------------------------------------------------------------------------* - * close tel device - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdntelclose(dev_t dev, int flag, int fmt, - struct lwp *l) -{ - int unit = UNIT(dev); - int func = FUNC(dev); - tel_sc_t *sc; - int error = 0; - int x; - - if(unit > NISDNTEL) - return(ENXIO); - - sc = &tel_sc[unit][func]; - - x = splnet(); - sc->devstate &= ~ST_TONE; - if((func == FUNCTEL) && - (sc->isdn_linktab != NULL && sc->isdn_linktab->tx_queue != NULL)) - { - while(!(IF_QEMPTY(sc->isdn_linktab->tx_queue))) - { - sc->devstate |= ST_WRWAITEMPTY; - - if((error = tsleep((void *) &sc->isdn_linktab->tx_queue, - TTIPRI | PCATCH, "wtcl", 0)) != 0) - { - break; - } - } - sc->devstate &= ~ST_WRWAITEMPTY; - } - - sc->devstate &= ~ST_ISOPEN; - splx(x); - wakeup((void *) &sc->tones); - - return(error); -} - -/*---------------------------------------------------------------------------* - * i4btelioctl - device driver ioctl routine - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdntelioctl(dev_t dev, u_long cmd, void *data, int flag, - struct lwp *l) -{ - int unit = UNIT(dev); - int func = FUNC(dev); - int error = 0; - struct mbuf *m; - int s; - - tel_sc_t *sc = &tel_sc[unit][func]; - - if(func == FUNCTEL) - { - switch(cmd) - { - case I4B_TEL_GETAUDIOFMT: - *(int *)data = sc->audiofmt; - break; - - case I4B_TEL_SETAUDIOFMT: - switch (*(int *)data) - { - case CVT_NONE: - sc->rcvttab = 0; - sc->wcvttab = 0; - break; - case CVT_ALAW2ULAW: - /* ISDN: A-law */ - /* user: mu-law */ - sc->rcvttab = a2u_tab; - sc->wcvttab = u2a_tab; - break; - case CVT_ULAW2ALAW: - /* ISDN: mu-law */ - /* user: A-law */ - sc->rcvttab = u2a_tab; - sc->wcvttab = a2u_tab; - break; - default: - error = ENODEV; - break; - } - if(error == 0) - sc->audiofmt = *(int *)data; - break; - - case I4B_TEL_EMPTYINPUTQUEUE: - s = splnet(); - while((sc->devstate & ST_CONNECTED) && - (sc->devstate & ST_ISOPEN) && - !IF_QEMPTY(sc->isdn_linktab->rx_queue)) - { - IF_DEQUEUE(sc->isdn_linktab->rx_queue, m); - if(m) - i4b_Bfreembuf(m); - } - splx(s); - break; - - case I4B_TEL_VR_REQ: - { - msg_vr_req_t *mvr; - - mvr = (msg_vr_req_t *)data; - - mvr->version = VERSION; - mvr->release = REL; - mvr->step = STEP; - break; - } - case I4B_TEL_TONES: - { - struct i4b_tel_tones *tt; - - tt = (struct i4b_tel_tones *)data; - s = splnet(); - while ((sc->devstate & ST_TONE) && - sc->tones.duration[sc->toneidx] != 0) { - if((error = tsleep((void *) &sc->tones, - TTIPRI | PCATCH, "rtone", 0 )) != 0) { - splx(s); - return(error); - } - } - if(!(sc->devstate & ST_ISOPEN)) { - splx(s); - return (EIO); - } - if(!(sc->devstate & ST_CONNECTED)) { - splx(s); - return (EIO); - } - - sc->tones = *tt; - sc->toneidx = 0; - sc->tonefreq = tt->frequency[0]; - sc->devstate |= ST_TONE; - splx(s); - tel_tone(sc); - break; - } - - default: - error = ENOTTY; - break; - } - } - else if(func == FUNCDIAL) - { - switch(cmd) - { - default: - error = ENOTTY; - break; - } - } - return(error); -} - -/*---------------------------------------------------------------------------* - * read from tel device - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdntelread(dev_t dev, struct uio *uio, int ioflag) -{ - int unit = UNIT(dev); - int func = FUNC(dev); - - struct mbuf *m; - int s; - int error = 0; - - tel_sc_t *sc = &tel_sc[unit][func]; - - if(!(sc->devstate & ST_ISOPEN)) - return(EIO); - - if(func == FUNCTEL) - { - s = splnet(); - while((sc->devstate & ST_ISOPEN) && - (sc->devstate & ST_CONNECTED) && - IF_QEMPTY(sc->isdn_linktab->rx_queue)) - { - sc->devstate |= ST_RDWAITDATA; - - NDBGL4(L4_TELDBG, "i4btel%d, queue empty!", unit); - - if((error = tsleep((void *) &sc->isdn_linktab->rx_queue, - TTIPRI | PCATCH, - "rtel", 0 )) != 0) - { - sc->devstate &= ~ST_RDWAITDATA; - splx(s); - return(error); - } - } - - if(!(sc->devstate & ST_ISOPEN)) - { - splx(s); - return(EIO); - } - - if(!(sc->devstate & ST_CONNECTED)) - { - splx(s); - return(EIO); - } - - - IF_DEQUEUE(sc->isdn_linktab->rx_queue, m); - - if(m && m->m_len > 0) - { - register int i; - - for(i = 0; i < m->m_len; i++) - { - /* always reverse bit order from line */ - mtod(m,u_char *)[i] = bitreverse[mtod(m,u_char *)[i]]; - - /* convert if necessary */ - if(sc->rcvttab) - mtod(m,u_char *)[i] = sc->rcvttab[mtod(m,u_char *)[i]]; - } - error = uiomove(m->m_data, m->m_len, uio); - - NDBGL4(L4_TELDBG, "i4btel%d, mbuf (%d bytes), uiomove %d!", unit, m->m_len, error); - } - else - { - NDBGL4(L4_TELDBG, "i4btel%d, empty mbuf from queue!", unit); - error = EIO; - } - - if(m) - i4b_Bfreembuf(m); - - splx(s); - } - else if(func == FUNCDIAL) - { - s = splnet(); - while((sc->result == 0) && (sc->devstate & ST_ISOPEN)) - { - sc->devstate |= ST_RDWAITDATA; - - if((error = tsleep((void *) &sc->result, - TTIPRI | PCATCH, - "rtel1", 0 )) != 0) - { - sc->devstate &= ~ST_RDWAITDATA; - splx(s); - return(error); - } - } - - if(!(sc->devstate & ST_ISOPEN)) - { - splx(s); - return(EIO); - } - - if(sc->result != 0) - { - error = uiomove(&sc->result, 1, uio); - sc->result = 0; - } - else - { - error = EIO; - } - - splx(s); - } - return(error); -} - -/*---------------------------------------------------------------------------* - * write to tel device - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdntelwrite(dev_t dev, struct uio * uio, int ioflag) -{ - int unit = UNIT(dev); - int func = FUNC(dev); - struct mbuf *m; - int s; - int error = 0; - tel_sc_t *sc = &tel_sc[unit][func]; - - if(!(sc->devstate & ST_ISOPEN)) - { - return(EIO); - } - - if(func == FUNCTEL) - { - s = splnet(); - - if(!(sc->devstate & ST_CONNECTED)) { - splx(s); - return(EIO); - } - - sc->devstate &= ~ST_TONE; - while((IF_QFULL(sc->isdn_linktab->tx_queue)) && - (sc->devstate & ST_ISOPEN)) - { - sc->devstate |= ST_WRWAITEMPTY; - - if((error = tsleep((void *) &sc->isdn_linktab->tx_queue, - TTIPRI | PCATCH, "wtel", 0)) != 0) - { - sc->devstate &= ~ST_WRWAITEMPTY; - splx(s); - return(error); - } - } - - if(!(sc->devstate & ST_ISOPEN)) - { - splx(s); - return(EIO); - } - - if(!(sc->devstate & ST_CONNECTED)) - { - splx(s); - return(EIO); - } - - if((m = i4b_Bgetmbuf(BCH_MAX_DATALEN)) != NULL) - { - register int i; - - m->m_len = uimin(BCH_MAX_DATALEN, uio->uio_resid); - - error = uiomove(m->m_data, m->m_len, uio); - - for(i = 0; i < m->m_len; i++) - { - /* convert if necessary */ - if(sc->wcvttab) - mtod(m,u_char *)[i] = sc->wcvttab[mtod(m,u_char *)[i]]; - - /* always reverse bitorder to line */ - mtod(m,u_char *)[i] = bitreverse[mtod(m,u_char *)[i]]; - } - - if(IF_QFULL(sc->isdn_linktab->tx_queue)) - { - m_freem(m); - } - else - { - IF_ENQUEUE(sc->isdn_linktab->tx_queue, m); - } - - (*sc->isdn_linktab->bchannel_driver->bch_tx_start)(sc->isdn_linktab->l1token, sc->isdn_linktab->channel); - } - - splx(s); - } - else if(func == FUNCDIAL) - { - tel_sc_t *telsc = &tel_sc[unit][FUNCTEL]; - -#define CMDBUFSIZ 80 - char cmdbuf[CMDBUFSIZ]; - int len = uimin(CMDBUFSIZ-1, uio->uio_resid); - - error = uiomove(cmdbuf, len, uio); - - if(cmdbuf[0] == CMD_DIAL) - { - i4b_l4_dialoutnumber(isdntel_driver_id, unit, len-1, &cmdbuf[1]); - } - else if(cmdbuf[0] == CMD_HUP) - { - if (!(telsc->devstate & ST_CONNECTED)) - error = EIO; - else - i4b_l4_drvrdisc(telsc->cdp->cdid); - } - } - else - { - error = EIO; - } - - return(error); -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -#define NTONESAMP 32 -static void -tel_tone(tel_sc_t *sc) -{ - struct mbuf *m; - u_char *p; - int i; - - if((m = i4b_Bgetmbuf(NTONESAMP)) == NULL) { - printf("no mbuf in tel_tone\n"); - return; - } - p = m->m_data; - m->m_len = 0; - for (i = 0; i < NTONESAMP && (sc->devstate & ST_TONE); i++) { - - if (sc->tones.duration[sc->toneidx] > 0) { - if (--sc->tones.duration[sc->toneidx] == 0) { - sc->toneidx++; - if (sc->toneidx == I4B_TEL_MAXTONES) { - sc->devstate &= ~ST_TONE; - sc->toneomega = 0; - sc->tonefreq = 0; - } else if (sc->tones.frequency[sc->toneidx] == 0 && - sc->tones.duration[sc->toneidx] == 0) { - sc->devstate &= ~ST_TONE; - sc->toneomega = 0; - sc->tonefreq = 0; - } else { - sc->tonefreq = sc->tones.frequency[sc->toneidx]; - } - if (sc->tones.duration[sc->toneidx] == 0) { - wakeup((void *) &sc->tones); - } - } - } - - sc->toneomega += sc->tonefreq; - if (sc->toneomega >= 8000) - sc->toneomega -= 8000; - *p++ = bitreverse[sinetab[sc->toneomega]]; - m->m_len++; - } - IF_ENQUEUE(sc->isdn_linktab->tx_queue, m); - (*sc->isdn_linktab->bchannel_driver->bch_tx_start)(sc->isdn_linktab->l1token, sc->isdn_linktab->channel); -} - - -#ifdef OS_USES_POLL -/*---------------------------------------------------------------------------* - * device driver poll - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdntelpoll(dev_t dev, int events, struct lwp *l) -{ - int revents = 0; /* Events we found */ - int s; - int unit = UNIT(dev); - int func = FUNC(dev); - - tel_sc_t *sc = &tel_sc[unit][func]; - - s = splhigh(); - - if(!(sc->devstate & ST_ISOPEN)) - { - NDBGL4(L4_TELDBG, "i4btel%d, !ST_ISOPEN", unit); - splx(s); - return(0); - } - - if(func == FUNCTEL) - { - /* - * Writes are OK if we are connected and the - * transmit queue can take them - */ - - if((events & (POLLOUT|POLLWRNORM)) && - (sc->devstate & ST_CONNECTED) && - (sc->isdn_linktab != NULL) && - (!IF_QFULL(sc->isdn_linktab->tx_queue))) - { - NDBGL4(L4_TELDBG, "i4btel%d, POLLOUT", unit); - revents |= (events & (POLLOUT|POLLWRNORM)); - } - - /* ... while reads are OK if we have any data */ - - if((events & (POLLIN|POLLRDNORM)) && - (sc->devstate & ST_CONNECTED) && - (sc->isdn_linktab != NULL) && - (!IF_QEMPTY(sc->isdn_linktab->rx_queue))) - { - NDBGL4(L4_TELDBG, "i4btel%d, POLLIN", unit); - revents |= (events & (POLLIN|POLLRDNORM)); - } - - if(revents == 0) - { - NDBGL4(L4_TELDBG, "i4btel%d, selrecord", unit); - selrecord(l, &sc->selp); - } - } - else if(func == FUNCDIAL) - { - if(events & (POLLOUT|POLLWRNORM)) - { - NDBGL4(L4_TELDBG, "i4bteld%d, POLLOUT", unit); - revents |= (events & (POLLOUT|POLLWRNORM)); - } - - if(events & (POLLIN|POLLRDNORM)) - { - NDBGL4(L4_TELDBG, "i4bteld%d, POLLIN, result = %d", unit, sc->result); - if(sc->result != 0) - revents |= (events & (POLLIN|POLLRDNORM)); - } - - if(revents == 0) - { - NDBGL4(L4_TELDBG, "i4bteld%d, selrecord", unit); - selrecord(l, &sc->selp); - } - } - splx(s); - return(revents); -} - -static void -filt_i4btel_detach(struct knote *kn) -{ - tel_sc_t *sc = kn->kn_hook; - int s; - - s = splhigh(); - SLIST_REMOVE(&sc->selp.sel_klist, kn, knote, kn_selnext); - splx(s); -} - -static int -filt_i4btel_telread(struct knote *kn, long hint) -{ - tel_sc_t *sc = kn->kn_hook; - - if ((sc->devstate & ST_CONNECTED) == 0) - return (0); - if (sc->isdn_linktab == NULL) - return (0); - if (IF_QEMPTY(sc->isdn_linktab->rx_queue)) - return (0); - - kn->kn_data = 0; /* XXXLUKEM (thorpej): what to put here? */ - return (1); -} - -static const struct filterops i4btel_telread_filtops = { - .f_isfd = 1, - .f_attach = NULL, - .f_detach = filt_i4btel_detach, - .f_event = filt_i4btel_telread, -}; - -static int -filt_i4btel_telwrite(struct knote *kn, long hint) -{ - tel_sc_t *sc = kn->kn_hook; - - if ((sc->devstate & ST_CONNECTED) == 0) - return (0); - if (sc->isdn_linktab == NULL) - return (0); - if (IF_QFULL(sc->isdn_linktab->tx_queue)) - return (0); - - kn->kn_data = 0; /* XXXLUKEM (thorpej): what to put here? */ - return (1); -} - -static const struct filterops i4btel_telwrite_filtops = { - .f_isfd = 1, - .f_attach = NULL, - .f_detach = filt_i4btel_detach, - .f_event = filt_i4btel_telwrite, -}; - -static int -filt_i4btel_dialread(struct knote *kn, long hint) -{ - tel_sc_t *sc = kn->kn_hook; - - if (sc->result == 0) - return (0); - - kn->kn_data = 0; /* XXXLUKEM (thorpej): what to put here? */ - return (1); -} - -static const struct filterops i4btel_dialread_filtops = { - .f_isfd = 1, - .f_attach = NULL, - .f_detach = filt_i4btel_detach, - .f_event = filt_i4btel_dialread, -}; - -static const struct filterops i4btel_seltrue_filtops = { - .f_isfd = 1, - .f_attach = NULL, - .f_detach = filt_i4btel_detach, - .f_event = filt_seltrue, -}; - -int -isdntelkqfilter(dev_t dev, struct knote *kn) -{ - int s; - int unit = UNIT(dev); - int func = FUNC(dev); - - struct klist *klist; - tel_sc_t *sc = &tel_sc[unit][func]; - - switch (kn->kn_filter) { - case EVFILT_READ: - klist = &sc->selp.sel_klist; - if (func == FUNCTEL) - kn->kn_fop = &i4btel_telread_filtops; - else if (func == FUNCDIAL) - kn->kn_fop = &i4btel_dialread_filtops; - else - return (ENXIO); - break; - - case EVFILT_WRITE: - klist = &sc->selp.sel_klist; - if (func == FUNCTEL) - kn->kn_fop = &i4btel_telwrite_filtops; - else if (func == FUNCDIAL) - kn->kn_fop = &i4btel_seltrue_filtops; - else - return (ENXIO); - break; - - default: - return (EINVAL); - } - - kn->kn_hook = sc; - - s = splhigh(); - SLIST_INSERT_HEAD(klist, kn, kn_selnext); - splx(s); - - return (0); -} - -#else /* OS_USES_POLL */ - -/*---------------------------------------------------------------------------* - * device driver select - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -i4btelsel(dev_t dev, int rw, struct lwp *l) -{ - int s; - int unit = UNIT(dev); - int func = FUNC(dev); - - tel_sc_t *sc = &tel_sc[unit][func]; - - s = splhigh(); - - if (!(sc->devstate & ST_ISOPEN)) - { - NDBGL4(L4_TELDBG, "i4btel%d, !ST_ISOPEN", unit); - splx(s); - return(0); - } - - if (func == FUNCTEL) - { - /* Don't even bother if we're not connected */ - if (!(sc->devstate & ST_CONNECTED) || sc->isdn_linktab == NULL) - { - splx(s); - return 0; - } - - if (rw == FREAD) - { - if (!IF_QEMPTY(sc->isdn_linktab->rx_queue)) - { - NDBGL4(L4_TELDBG, "i4btel%d, FREAD", unit); - splx(s); - return 1; - } - } - else if (rw == FWRITE) - { - if (!IF_QFULL(sc->isdn_linktab->tx_queue)) - { - NDBGL4(L4_TELDBG, "i4btel%d, FWRITE", unit); - splx(s); - return 1; - } - } - } - else if (func == FUNCDIAL) - { - if (rw == FWRITE) - { - NDBGL4(L4_TELDBG, "i4bteld%d, FWRITE", unit); - splx(s); - return 1; - } - - if (rw == FREAD) - { - NDBGL4(L4_TELDBG, "i4bteld%d, FREAD, result = %d", unit, sc->result); - if (sc->result != 0) - { - splx(s); - return 1; - } - } - } - - NDBGL4(L4_TELDBG, "i4bteld%d, selrecord", unit); - selrecord(l, &sc->selp); - splx(s); - return 0; -} - -#endif /* OS_USES_POLL */ - -/*===========================================================================* - * ISDN INTERFACE ROUTINES - *===========================================================================*/ - -/*---------------------------------------------------------------------------* -* this routine is called from L4 handler at connect time - *---------------------------------------------------------------------------*/ -static void -tel_connect(void *softc, void *cdp) -{ - tel_sc_t *sc = softc; - - /* audio device */ - - sc->cdp = (call_desc_t *)cdp; - - sc->devstate |= ST_CONNECTED; - - /* dialer device */ - - sc = sc->dialer; - - if(sc->devstate == ST_ISOPEN) - { - sc->result = RSP_CONN; - - if(sc->devstate & ST_RDWAITDATA) - { - sc->devstate &= ~ST_RDWAITDATA; - wakeup((void *) &sc->result); - } - selnotify(&sc->selp, 0, 0); - } -} - -/*---------------------------------------------------------------------------* - * this routine is called from L4 handler at disconnect time - *---------------------------------------------------------------------------*/ -static void -tel_disconnect(void *softc, void *cdp) -{ - tel_sc_t *sc = softc; - - /* audio device */ - - sc->devstate &= ~ST_CONNECTED; - - if(sc->devstate & ST_RDWAITDATA) - { - sc->devstate &= ~ST_RDWAITDATA; - wakeup((void *) &sc->isdn_linktab->rx_queue); - } - - if(sc->devstate & ST_WRWAITEMPTY) - { - sc->devstate &= ~ST_WRWAITEMPTY; - wakeup((void *) &sc->isdn_linktab->tx_queue); - } - - /* dialer device */ - - sc = sc->dialer; - - if(sc->devstate & ST_ISOPEN) - { - sc->result = RSP_HUP; - - if(sc->devstate & ST_RDWAITDATA) - { - sc->devstate &= ~ST_RDWAITDATA; - wakeup((void *) &sc->result); - } - selnotify(&sc->selp, 0, 0); - - if (sc->devstate & ST_TONE) { - sc->devstate &= ~ST_TONE; - wakeup((void *) &sc->tones); - } - } -} - -/*---------------------------------------------------------------------------* - * feedback from daemon in case of dial problems - *---------------------------------------------------------------------------*/ -static void -tel_dialresponse(void *softc, int status, cause_t cause) -{ - tel_sc_t *sc = ((struct tel_softc*)softc)->dialer; - - NDBGL4(L4_TELDBG, "status=%d, cause=0x%4x", status, cause); - - if((sc->devstate == ST_ISOPEN) && status) - { - sc->result = RSP_NOA; - - if(sc->devstate & ST_RDWAITDATA) - { - sc->devstate &= ~ST_RDWAITDATA; - wakeup((void *) &sc->result); - } - selnotify(&sc->selp, 0, 0); - } -} - -/*---------------------------------------------------------------------------* - * interface up/down - *---------------------------------------------------------------------------*/ -static void -tel_updown(void *softc, int updown) -{ -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * when a new frame (mbuf) has been received and was put on - * the rx queue. - *---------------------------------------------------------------------------*/ -static void -tel_rx_data_rdy(void *softc) -{ - tel_sc_t *sc = softc; - - if(sc->devstate & ST_RDWAITDATA) - { - sc->devstate &= ~ST_RDWAITDATA; - wakeup((void *) &sc->isdn_linktab->rx_queue); - } - selnotify(&sc->selp, 0, 0); -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * when the last frame has been sent out and there is no - * further frame (mbuf) in the tx queue. - *---------------------------------------------------------------------------*/ -static void -tel_tx_queue_empty(void *softc) -{ - tel_sc_t *sc = softc; - - if(sc->devstate & ST_WRWAITEMPTY) - { - sc->devstate &= ~ST_WRWAITEMPTY; - wakeup((void *) &sc->isdn_linktab->tx_queue); - } - if(sc->devstate & ST_TONE) { - tel_tone(sc); - } else { - selnotify(&sc->selp, 0, 0); - } -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * each time a packet is received or transmitted. - *---------------------------------------------------------------------------*/ -static void -tel_activity(void *softc, int rxtx) -{ - struct tel_softc *sc = softc; - - if(sc->cdp) - sc->cdp->last_active_time = SECOND; -} - -/*---------------------------------------------------------------------------* - * setup the isdn_linktab for this driver - *---------------------------------------------------------------------------*/ -static void -tel_set_linktab(void *softc, isdn_link_t *ilt) -{ - tel_sc_t *sc = softc; - sc->isdn_linktab = ilt; -} - -/*---------------------------------------------------------------------------* - * return the instance - *---------------------------------------------------------------------------*/ -static void* -tel_get_softc(int unit) -{ - return &tel_sc[unit][FUNCTEL]; -} - -/*===========================================================================* - * AUDIO FORMAT CONVERSION (produced by running g711conv) - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * A-law to mu-law conversion - *---------------------------------------------------------------------------*/ -static unsigned char a2u_tab[256] = { -/* 00 */ 0x2a, 0x2b, 0x28, 0x29, 0x2e, 0x2f, 0x2c, 0x2d, -/* 08 */ 0x22, 0x23, 0x20, 0x21, 0x26, 0x27, 0x24, 0x25, -/* 10 */ 0x39, 0x3a, 0x37, 0x38, 0x3d, 0x3e, 0x3b, 0x3c, -/* 18 */ 0x31, 0x32, 0x30, 0x30, 0x35, 0x36, 0x33, 0x34, -/* 20 */ 0x0a, 0x0b, 0x08, 0x09, 0x0e, 0x0f, 0x0c, 0x0d, -/* 28 */ 0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05, -/* 30 */ 0x1a, 0x1b, 0x18, 0x19, 0x1e, 0x1f, 0x1c, 0x1d, -/* 38 */ 0x12, 0x13, 0x10, 0x11, 0x16, 0x17, 0x14, 0x15, -/* 40 */ 0x62, 0x63, 0x60, 0x61, 0x66, 0x67, 0x64, 0x65, -/* 48 */ 0x5d, 0x5d, 0x5c, 0x5c, 0x5f, 0x5f, 0x5e, 0x5e, -/* 50 */ 0x74, 0x76, 0x70, 0x72, 0x7c, 0x7e, 0x78, 0x7a, -/* 58 */ 0x6a, 0x6b, 0x68, 0x69, 0x6e, 0x6f, 0x6c, 0x6d, -/* 60 */ 0x48, 0x49, 0x46, 0x47, 0x4c, 0x4d, 0x4a, 0x4b, -/* 68 */ 0x40, 0x41, 0x3f, 0x3f, 0x44, 0x45, 0x42, 0x43, -/* 70 */ 0x56, 0x57, 0x54, 0x55, 0x5a, 0x5b, 0x58, 0x59, -/* 78 */ 0x4f, 0x4f, 0x4e, 0x4e, 0x52, 0x53, 0x50, 0x51, -/* 80 */ 0xaa, 0xab, 0xa8, 0xa9, 0xae, 0xaf, 0xac, 0xad, -/* 88 */ 0xa2, 0xa3, 0xa0, 0xa1, 0xa6, 0xa7, 0xa4, 0xa5, -/* 90 */ 0xb9, 0xba, 0xb7, 0xb8, 0xbd, 0xbe, 0xbb, 0xbc, -/* 98 */ 0xb1, 0xb2, 0xb0, 0xb0, 0xb5, 0xb6, 0xb3, 0xb4, -/* a0 */ 0x8a, 0x8b, 0x88, 0x89, 0x8e, 0x8f, 0x8c, 0x8d, -/* a8 */ 0x82, 0x83, 0x80, 0x81, 0x86, 0x87, 0x84, 0x85, -/* b0 */ 0x9a, 0x9b, 0x98, 0x99, 0x9e, 0x9f, 0x9c, 0x9d, -/* b8 */ 0x92, 0x93, 0x90, 0x91, 0x96, 0x97, 0x94, 0x95, -/* c0 */ 0xe2, 0xe3, 0xe0, 0xe1, 0xe6, 0xe7, 0xe4, 0xe5, -/* c8 */ 0xdd, 0xdd, 0xdc, 0xdc, 0xdf, 0xdf, 0xde, 0xde, -/* d0 */ 0xf4, 0xf6, 0xf0, 0xf2, 0xfc, 0xfe, 0xf8, 0xfa, -/* d8 */ 0xea, 0xeb, 0xe8, 0xe9, 0xee, 0xef, 0xec, 0xed, -/* e0 */ 0xc8, 0xc9, 0xc6, 0xc7, 0xcc, 0xcd, 0xca, 0xcb, -/* e8 */ 0xc0, 0xc1, 0xbf, 0xbf, 0xc4, 0xc5, 0xc2, 0xc3, -/* f0 */ 0xd6, 0xd7, 0xd4, 0xd5, 0xda, 0xdb, 0xd8, 0xd9, -/* f8 */ 0xcf, 0xcf, 0xce, 0xce, 0xd2, 0xd3, 0xd0, 0xd1 -}; - -/*---------------------------------------------------------------------------* - * mu-law to A-law conversion - *---------------------------------------------------------------------------*/ -static unsigned char u2a_tab[256] = { -/* 00 */ 0x2a, 0x2b, 0x28, 0x29, 0x2e, 0x2f, 0x2c, 0x2d, -/* 08 */ 0x22, 0x23, 0x20, 0x21, 0x26, 0x27, 0x24, 0x25, -/* 10 */ 0x3a, 0x3b, 0x38, 0x39, 0x3e, 0x3f, 0x3c, 0x3d, -/* 18 */ 0x32, 0x33, 0x30, 0x31, 0x36, 0x37, 0x34, 0x35, -/* 20 */ 0x0a, 0x0b, 0x08, 0x09, 0x0e, 0x0f, 0x0c, 0x0d, -/* 28 */ 0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05, -/* 30 */ 0x1b, 0x18, 0x19, 0x1e, 0x1f, 0x1c, 0x1d, 0x12, -/* 38 */ 0x13, 0x10, 0x11, 0x16, 0x17, 0x14, 0x15, 0x6a, -/* 40 */ 0x68, 0x69, 0x6e, 0x6f, 0x6c, 0x6d, 0x62, 0x63, -/* 48 */ 0x60, 0x61, 0x66, 0x67, 0x64, 0x65, 0x7a, 0x78, -/* 50 */ 0x7e, 0x7f, 0x7c, 0x7d, 0x72, 0x73, 0x70, 0x71, -/* 58 */ 0x76, 0x77, 0x74, 0x75, 0x4b, 0x49, 0x4f, 0x4d, -/* 60 */ 0x42, 0x43, 0x40, 0x41, 0x46, 0x47, 0x44, 0x45, -/* 68 */ 0x5a, 0x5b, 0x58, 0x59, 0x5e, 0x5f, 0x5c, 0x5d, -/* 70 */ 0x52, 0x52, 0x53, 0x53, 0x50, 0x50, 0x51, 0x51, -/* 78 */ 0x56, 0x56, 0x57, 0x57, 0x54, 0x54, 0x55, 0x55, -/* 80 */ 0xaa, 0xab, 0xa8, 0xa9, 0xae, 0xaf, 0xac, 0xad, -/* 88 */ 0xa2, 0xa3, 0xa0, 0xa1, 0xa6, 0xa7, 0xa4, 0xa5, -/* 90 */ 0xba, 0xbb, 0xb8, 0xb9, 0xbe, 0xbf, 0xbc, 0xbd, -/* 98 */ 0xb2, 0xb3, 0xb0, 0xb1, 0xb6, 0xb7, 0xb4, 0xb5, -/* a0 */ 0x8a, 0x8b, 0x88, 0x89, 0x8e, 0x8f, 0x8c, 0x8d, -/* a8 */ 0x82, 0x83, 0x80, 0x81, 0x86, 0x87, 0x84, 0x85, -/* b0 */ 0x9b, 0x98, 0x99, 0x9e, 0x9f, 0x9c, 0x9d, 0x92, -/* b8 */ 0x93, 0x90, 0x91, 0x96, 0x97, 0x94, 0x95, 0xea, -/* c0 */ 0xe8, 0xe9, 0xee, 0xef, 0xec, 0xed, 0xe2, 0xe3, -/* c8 */ 0xe0, 0xe1, 0xe6, 0xe7, 0xe4, 0xe5, 0xfa, 0xf8, -/* d0 */ 0xfe, 0xff, 0xfc, 0xfd, 0xf2, 0xf3, 0xf0, 0xf1, -/* d8 */ 0xf6, 0xf7, 0xf4, 0xf5, 0xcb, 0xc9, 0xcf, 0xcd, -/* e0 */ 0xc2, 0xc3, 0xc0, 0xc1, 0xc6, 0xc7, 0xc4, 0xc5, -/* e8 */ 0xda, 0xdb, 0xd8, 0xd9, 0xde, 0xdf, 0xdc, 0xdd, -/* f0 */ 0xd2, 0xd2, 0xd3, 0xd3, 0xd0, 0xd0, 0xd1, 0xd1, -/* f8 */ 0xd6, 0xd6, 0xd7, 0xd7, 0xd4, 0xd4, 0xd5, 0xd5 -}; - -/*---------------------------------------------------------------------------* - * reverse bits in a byte - *---------------------------------------------------------------------------*/ -static unsigned char bitreverse[256] = { -/* 00 */ 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, -/* 08 */ 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, -/* 10 */ 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, -/* 18 */ 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, -/* 20 */ 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, -/* 28 */ 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, -/* 30 */ 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, -/* 38 */ 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, -/* 40 */ 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, -/* 48 */ 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, -/* 50 */ 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, -/* 58 */ 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, -/* 60 */ 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, -/* 68 */ 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, -/* 70 */ 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, -/* 78 */ 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, -/* 80 */ 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, -/* 88 */ 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, -/* 90 */ 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, -/* 98 */ 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, -/* a0 */ 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, -/* a8 */ 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, -/* b0 */ 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, -/* b8 */ 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, -/* c0 */ 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, -/* c8 */ 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, -/* d0 */ 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, -/* d8 */ 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, -/* e0 */ 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, -/* e8 */ 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, -/* f0 */ 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, -/* f8 */ 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff -}; - -static u_char sinetab[8000] = { 213, 213, 213, 213, 213, 213, 213, 212, -212, 212, 212, 212, 212, 215, 215, 215, 215, 215, 215, 214, 214, -214, 214, 214, 214, 209, 209, 209, 209, 209, 209, 209, 208, 208, -208, 208, 208, 208, 211, 211, 211, 211, 211, 211, 210, 210, 210, -210, 210, 210, 221, 221, 221, 221, 221, 221, 220, 220, 220, 220, -220, 220, 220, 223, 223, 223, 223, 223, 223, 222, 222, 222, 222, -222, 222, 217, 217, 217, 217, 217, 217, 216, 216, 216, 216, 216, -216, 216, 219, 219, 219, 219, 219, 219, 218, 218, 218, 218, 218, -218, 197, 197, 197, 197, 197, 197, 196, 196, 196, 196, 196, 196, -196, 199, 199, 199, 199, 199, 199, 198, 198, 198, 198, 198, 198, -193, 193, 193, 193, 193, 193, 192, 192, 192, 192, 192, 192, 192, -195, 195, 195, 195, 195, 195, 194, 194, 194, 194, 194, 194, 205, -205, 205, 205, 205, 205, 204, 204, 204, 204, 204, 204, 204, 207, -207, 207, 207, 207, 207, 206, 206, 206, 206, 206, 206, 201, 201, -201, 201, 201, 201, 200, 200, 200, 200, 200, 200, 200, 203, 203, -203, 203, 203, 203, 202, 202, 202, 202, 202, 202, 245, 245, 245, -245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 244, 244, 244, -244, 244, 244, 244, 244, 244, 244, 244, 244, 247, 247, 247, 247, -247, 247, 247, 247, 247, 247, 247, 247, 247, 246, 246, 246, 246, -246, 246, 246, 246, 246, 246, 246, 246, 246, 241, 241, 241, 241, -241, 241, 241, 241, 241, 241, 241, 241, 240, 240, 240, 240, 240, -240, 240, 240, 240, 240, 240, 240, 240, 243, 243, 243, 243, 243, -243, 243, 243, 243, 243, 243, 243, 243, 242, 242, 242, 242, 242, -242, 242, 242, 242, 242, 242, 242, 242, 253, 253, 253, 253, 253, -253, 253, 253, 253, 253, 253, 253, 253, 252, 252, 252, 252, 252, -252, 252, 252, 252, 252, 252, 252, 255, 255, 255, 255, 255, 255, -255, 255, 255, 255, 255, 255, 255, 254, 254, 254, 254, 254, 254, -254, 254, 254, 254, 254, 254, 254, 249, 249, 249, 249, 249, 249, -249, 249, 249, 249, 249, 249, 249, 248, 248, 248, 248, 248, 248, -248, 248, 248, 248, 248, 248, 248, 251, 251, 251, 251, 251, 251, -251, 251, 251, 251, 251, 251, 251, 250, 250, 250, 250, 250, 250, -250, 250, 250, 250, 250, 250, 250, 229, 229, 229, 229, 229, 229, -229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, -229, 229, 229, 229, 229, 229, 229, 228, 228, 228, 228, 228, 228, -228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, -228, 228, 228, 228, 228, 228, 228, 228, 231, 231, 231, 231, 231, -231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, -231, 231, 231, 231, 231, 231, 231, 231, 231, 230, 230, 230, 230, -230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, -230, 230, 230, 230, 230, 230, 230, 230, 230, 225, 225, 225, 225, -225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, -225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 224, 224, -224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, -224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 227, -227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, -227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, -227, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, -226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, -226, 226, 226, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, -237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, -237, 237, 237, 237, 237, 236, 236, 236, 236, 236, 236, 236, 236, -236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, -236, 236, 236, 236, 236, 236, 236, 236, 239, 239, 239, 239, 239, -239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, -239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 238, 238, -238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, -238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, -238, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, -233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, -233, 233, 233, 233, 233, 232, 232, 232, 232, 232, 232, 232, 232, -232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, -232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 235, 235, 235, -235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, -235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, -235, 235, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, -234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, -234, 234, 234, 234, 234, 234, 234, 149, 149, 149, 149, 149, 149, -149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, -149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, -149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, -149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, -149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, -149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, -149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, -149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, -149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, -234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, -234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, -234, 234, 234, 234, 234, 235, 235, 235, 235, 235, 235, 235, 235, -235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, -235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 232, 232, 232, -232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, -232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, -232, 232, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, -233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, -233, 233, 233, 233, 233, 233, 238, 238, 238, 238, 238, 238, 238, -238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, -238, 238, 238, 238, 238, 238, 238, 238, 238, 239, 239, 239, 239, -239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, -239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 236, -236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, -236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, -236, 236, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, -237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, -237, 237, 237, 237, 226, 226, 226, 226, 226, 226, 226, 226, 226, -226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, -226, 226, 226, 226, 226, 226, 227, 227, 227, 227, 227, 227, 227, -227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, -227, 227, 227, 227, 227, 227, 227, 227, 224, 224, 224, 224, 224, -224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, -224, 224, 224, 224, 224, 224, 224, 224, 224, 225, 225, 225, 225, -225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, -225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 230, 230, -230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, -230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 231, 231, -231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, -231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 228, -228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, -228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, -229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, -229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, -250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, -251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, -248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, -249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, -254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, -255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 253, -253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 242, -242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 243, -243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 240, -240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 241, -241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 246, 246, -246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 247, 247, -247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 244, 244, -244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 245, 245, 245, -245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 202, 202, 202, -202, 202, 202, 203, 203, 203, 203, 203, 203, 200, 200, 200, 200, -200, 200, 200, 201, 201, 201, 201, 201, 201, 206, 206, 206, 206, -206, 206, 207, 207, 207, 207, 207, 207, 204, 204, 204, 204, 204, -204, 204, 205, 205, 205, 205, 205, 205, 194, 194, 194, 194, 194, -194, 195, 195, 195, 195, 195, 195, 192, 192, 192, 192, 192, 192, -192, 193, 193, 193, 193, 193, 193, 198, 198, 198, 198, 198, 198, -199, 199, 199, 199, 199, 199, 196, 196, 196, 196, 196, 196, 196, -197, 197, 197, 197, 197, 197, 218, 218, 218, 218, 218, 218, 219, -219, 219, 219, 219, 219, 216, 216, 216, 216, 216, 216, 216, 217, -217, 217, 217, 217, 217, 222, 222, 222, 222, 222, 222, 223, 223, -223, 223, 223, 223, 220, 220, 220, 220, 220, 220, 220, 221, 221, -221, 221, 221, 221, 210, 210, 210, 210, 210, 210, 211, 211, 211, -211, 211, 211, 208, 208, 208, 208, 208, 208, 209, 209, 209, 209, -209, 209, 209, 214, 214, 214, 214, 214, 214, 215, 215, 215, 215, -215, 215, 212, 212, 212, 212, 212, 212, 213, 213, 213, 213, 213, -213, 213, 90, 90, 90, 85, 85, 85, 85, 85, 85, 84, 84, 84, 84, 84, -84, 87, 87, 87, 87, 87, 87, 86, 86, 86, 86, 86, 86, 81, 81, 81, -81, 81, 81, 81, 80, 80, 80, 80, 80, 80, 83, 83, 83, 83, 83, 83, -82, 82, 82, 82, 82, 82, 93, 93, 93, 93, 93, 93, 93, 92, 92, 92, -92, 92, 92, 95, 95, 95, 95, 95, 95, 94, 94, 94, 94, 94, 94, 89, -89, 89, 89, 89, 89, 88, 88, 88, 88, 88, 88, 88, 91, 91, 91, 91, -91, 91, 90, 90, 90, 90, 90, 90, 69, 69, 69, 69, 69, 69, 68, 68, -68, 68, 68, 68, 68, 71, 71, 71, 71, 71, 71, 70, 70, 70, 70, 70, -70, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 67, 67, -67, 67, 67, 67, 66, 66, 66, 66, 66, 66, 77, 77, 77, 77, 77, 77, -76, 76, 76, 76, 76, 76, 76, 79, 79, 79, 79, 79, 79, 78, 78, 78, -78, 78, 78, 73, 73, 73, 73, 73, 73, 73, 72, 72, 72, 72, 72, 72, -75, 75, 75, 75, 75, 75, 74, 74, 74, 74, 74, 74, 117, 117, 117, 117, -117, 117, 117, 117, 117, 117, 117, 117, 117, 116, 116, 116, 116, -116, 116, 116, 116, 116, 116, 116, 116, 116, 119, 119, 119, 119, -119, 119, 119, 119, 119, 119, 119, 119, 118, 118, 118, 118, 118, -118, 118, 118, 118, 118, 118, 118, 118, 113, 113, 113, 113, 113, -113, 113, 113, 113, 113, 113, 113, 113, 112, 112, 112, 112, 112, -112, 112, 112, 112, 112, 112, 112, 115, 115, 115, 115, 115, 115, -115, 115, 115, 115, 115, 115, 115, 114, 114, 114, 114, 114, 114, -114, 114, 114, 114, 114, 114, 114, 125, 125, 125, 125, 125, 125, -125, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 124, -124, 124, 124, 124, 124, 124, 124, 127, 127, 127, 127, 127, 127, -127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, -126, 126, 126, 126, 126, 126, 121, 121, 121, 121, 121, 121, 121, -121, 121, 121, 121, 121, 121, 120, 120, 120, 120, 120, 120, 120, -120, 120, 120, 120, 120, 120, 123, 123, 123, 123, 123, 123, 123, -123, 123, 123, 123, 123, 123, 122, 122, 122, 122, 122, 122, 122, -122, 122, 122, 122, 122, 122, 101, 101, 101, 101, 101, 101, 101, -101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, -101, 101, 101, 101, 101, 101, 101, 100, 100, 100, 100, 100, 100, -100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, -100, 100, 100, 100, 100, 100, 100, 103, 103, 103, 103, 103, 103, -103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, -103, 103, 103, 103, 103, 103, 103, 103, 102, 102, 102, 102, 102, -102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, -102, 102, 102, 102, 102, 102, 102, 102, 102, 97, 97, 97, 97, 97, -97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, -97, 97, 97, 97, 97, 97, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, -96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, -96, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, -99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 98, 98, 98, -98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, -98, 98, 98, 98, 98, 98, 98, 98, 98, 109, 109, 109, 109, 109, 109, -109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, -109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 108, 108, 108, -108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, -108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 111, -111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, -111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, -111, 111, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, -110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, -110, 110, 110, 110, 110, 110, 105, 105, 105, 105, 105, 105, 105, -105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, -105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 104, 104, 104, -104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, -104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, -104, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, -107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, -107, 107, 107, 107, 107, 107, 106, 106, 106, 106, 106, 106, 106, -106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, -106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 21, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -20, 20, 20, 20, 20, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, -22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 20, 20, 20, 20, 20, 20, -20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, -106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, -106, 106, 106, 106, 106, 106, 107, 107, 107, 107, 107, 107, 107, -107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, -107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 104, 104, -104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, -104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, -104, 104, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, -105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, -105, 105, 105, 105, 105, 105, 110, 110, 110, 110, 110, 110, 110, -110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, -110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 111, 111, 111, -111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, -111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, -108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, -108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, -108, 108, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, -109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, -109, 109, 109, 109, 109, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, -98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, -98, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, -99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 96, 96, -96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, -96, 96, 96, 96, 96, 96, 96, 96, 96, 97, 97, 97, 97, 97, 97, 97, -97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, -97, 97, 97, 97, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, -102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, -102, 102, 102, 102, 103, 103, 103, 103, 103, 103, 103, 103, 103, -103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, -103, 103, 103, 103, 103, 100, 100, 100, 100, 100, 100, 100, 100, -100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, -100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 101, 101, -101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, -101, 101, 101, 101, 101, 101, 122, 122, 122, 122, 122, 122, 122, -122, 122, 122, 122, 122, 122, 123, 123, 123, 123, 123, 123, 123, -123, 123, 123, 123, 123, 123, 120, 120, 120, 120, 120, 120, 120, -120, 120, 120, 120, 120, 120, 121, 121, 121, 121, 121, 121, 121, -121, 121, 121, 121, 121, 121, 126, 126, 126, 126, 126, 126, 126, -126, 126, 126, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, -127, 127, 127, 127, 127, 124, 124, 124, 124, 124, 124, 124, 124, -124, 124, 124, 124, 124, 125, 125, 125, 125, 125, 125, 125, 125, -125, 125, 125, 125, 125, 114, 114, 114, 114, 114, 114, 114, 114, -114, 114, 114, 114, 114, 115, 115, 115, 115, 115, 115, 115, 115, -115, 115, 115, 115, 115, 112, 112, 112, 112, 112, 112, 112, 112, -112, 112, 112, 112, 113, 113, 113, 113, 113, 113, 113, 113, 113, -113, 113, 113, 113, 118, 118, 118, 118, 118, 118, 118, 118, 118, -118, 118, 118, 118, 119, 119, 119, 119, 119, 119, 119, 119, 119, -119, 119, 119, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, -116, 116, 116, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, -117, 117, 117, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 72, -72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73, 78, 78, 78, 78, -78, 78, 79, 79, 79, 79, 79, 79, 76, 76, 76, 76, 76, 76, 76, 77, -77, 77, 77, 77, 77, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, -67, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 70, 70, -70, 70, 70, 70, 71, 71, 71, 71, 71, 71, 68, 68, 68, 68, 68, 68, -68, 69, 69, 69, 69, 69, 69, 90, 90, 90, 90, 90, 90, 91, 91, 91, -91, 91, 91, 88, 88, 88, 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, -94, 94, 94, 94, 94, 94, 95, 95, 95, 95, 95, 95, 92, 92, 92, 92, -92, 92, 93, 93, 93, 93, 93, 93, 93, 82, 82, 82, 82, 82, 82, 83, -83, 83, 83, 83, 83, 80, 80, 80, 80, 80, 80, 81, 81, 81, 81, 81, -81, 81, 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, 84, 84, -84, 84, 84, 84, 85, 85, 85, 85, 85, 85, 90, 90, 90 }; - -/*===========================================================================*/ - -#endif /* NISDNTEL > 0 */ diff --git a/sys/netisdn/i4b_tel_ioctl.h b/sys/netisdn/i4b_tel_ioctl.h deleted file mode 100644 index 7dfd0192334d..000000000000 --- a/sys/netisdn/i4b_tel_ioctl.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_tel_ioctl.h telephony interface ioctls - * ------------------------------------------ - * - * $Id: i4b_tel_ioctl.h,v 1.5 2015/09/06 06:01:01 dholland Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Wed Jan 12 15:47:11 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _NETISDN_I4B_TEL_IOCTL_H_ -#define _NETISDN_I4B_TEL_IOCTL_H_ - -#include - -/*===========================================================================* - * /dev/i4btel devices (audio data) - *===========================================================================*/ - -/* supported audio format conversions */ - -#define CVT_NONE 0 /* no A-law/mu-law conversion */ -#define CVT_ALAW2ULAW 1 /* ISDN line: A-law, user: mu-law */ -#define CVT_ULAW2ALAW 2 /* ISDN line: mu-law, user: A-law */ - -/*---------------------------------------------------------------------------* - * get / set audio format - *---------------------------------------------------------------------------*/ - -#define I4B_TEL_GETAUDIOFMT _IOR('A', 0, int) -#define I4B_TEL_SETAUDIOFMT _IOW('A', 1, int) -#define I4B_TEL_EMPTYINPUTQUEUE _IOW('A', 2, int) - -/*---------------------------------------------------------------------------* - * request version and release info from kernel part - *---------------------------------------------------------------------------*/ - -#define I4B_TEL_VR_REQ _IOR('A', 3, msg_vr_req_t) - -/*---------------------------------------------------------------------------* - * send tones out of the tel interface - *---------------------------------------------------------------------------*/ - -#define I4B_TEL_MAXTONES 32 - -struct i4b_tel_tones { - int frequency[I4B_TEL_MAXTONES]; - int duration[I4B_TEL_MAXTONES]; -}; - -#define I4B_TEL_TONES _IOR('A', 4, struct i4b_tel_tones) - -/*===========================================================================* - * /dev/i4bteld devices (dialer interface) - *===========================================================================*/ - -/* dialer commands */ - -#define CMD_DIAL 'D' /* dial the following number string */ -#define CMD_HUP 'H' /* hangup */ - -/* dialer responses */ - -#define RSP_CONN '0' /* connect */ -#define RSP_BUSY '1' /* busy */ -#define RSP_HUP '2' /* hangup */ -#define RSP_NOA '3' /* no answer */ - -#endif /* !_NETISDN_I4B_TEL_IOCTL_H_ */ diff --git a/sys/netisdn/i4b_trace.c b/sys/netisdn/i4b_trace.c deleted file mode 100644 index 00d1026f3087..000000000000 --- a/sys/netisdn/i4b_trace.c +++ /dev/null @@ -1,442 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4btrc - device driver for trace data read device - * --------------------------------------------------- - * - * $Id: i4b_trace.c,v 1.22 2014/07/25 08:10:40 dholland Exp $ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_trace.c,v 1.22 2014/07/25 08:10:40 dholland Exp $"); - -#include "isdntrc.h" - -#if NISDNTRC > 0 - -#include -#include - -#if defined(__FreeBSD__) && __FreeBSD__ >= 3 -#include -#else -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -static struct ifqueue trace_queue[NISDNTRC]; -static int device_state[NISDNTRC]; -#define ST_IDLE 0x00 -#define ST_ISOPEN 0x01 -#define ST_WAITDATA 0x02 - -static int analyzemode = 0; /* we are in anlyzer mode */ -static int rxunit = -1; /* l2 isdnif of receiving driver */ -static int txunit = -1; /* l2 isdnif of transmitting driver */ -static int outunit = -1; /* output device for trace data */ - -#define PDEVSTATIC /* - not static - */ -void isdntrcattach(void); -int isdntrcopen(dev_t dev, int flag, int fmt, struct lwp *l); -int isdntrcclose(dev_t dev, int flag, int fmt, struct lwp *l); -int isdntrcread(dev_t dev, struct uio * uio, int ioflag); -int isdntrcioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l); - -#ifdef __NetBSD__ -const struct cdevsw isdntrc_cdevsw = { - .d_open = isdntrcopen, - .d_close = isdntrcclose, - .d_read = isdntrcread, - .d_write = nowrite, - .d_ioctl = isdntrcioctl, - .d_stop = nostop, - .d_tty = notty, - .d_poll = nopoll, - .d_mmap = nommap, - .d_kqfilter = nokqfilter, - .d_discard = nodiscard, - .d_flag = D_OTHER -}; -#endif /* __NetBSD__ */ - -/*---------------------------------------------------------------------------* - * interface attach routine - *---------------------------------------------------------------------------*/ -PDEVSTATIC void -#ifdef __FreeBSD__ -isdntrcattach(void *dummy) -#else -isdntrcattach(void) -#endif -{ - int i; - - for(i=0; i < NISDNTRC; i++) - { - -#if defined(__FreeBSD__) -#if __FreeBSD__ < 4 - -#ifdef DEVFS - devfs_token[i] - = devfs_add_devswf(&i4btrc_cdevsw, i, DV_CHR, - UID_ROOT, GID_WHEEL, 0600, - "isdntrc%d", i); -#endif - -#else - make_dev(&i4btrc_cdevsw, i, - UID_ROOT, GID_WHEEL, 0600, "isdntrc%d", i); -#endif -#endif - trace_queue[i].ifq_maxlen = IFQ_MAXLEN; - device_state[i] = ST_IDLE; - } -} - -/*---------------------------------------------------------------------------* - * isdn_layer2_trace_ind - * --------------------- - * is called from layer 1, adds timestamp to trace data and puts - * it into a queue, from which it can be read from the i4btrc - * device. The unit number in the trace header selects the minor - * device's queue the data is put into. - *---------------------------------------------------------------------------*/ -int -isdn_layer2_trace_ind(struct l2_softc *sc, struct isdn_l3_driver *drv, i4b_trace_hdr *hdr, size_t len, unsigned char *buf) -{ - struct mbuf *m; - int isdnif, x; - int trunc = 0; - int totlen = len + sizeof(i4b_trace_hdr); - - MICROTIME(hdr->time); - hdr->isdnif = sc->drv->isdnif; - - /* - * for telephony (or better non-HDLC HSCX mode) we get - * (MCLBYTE + sizeof(i4b_trace_hdr_t)) length packets - * to put into the queue to userland. because of this - * we detect this situation, strip the length to MCLBYTES - * max size, and infor the userland program of this fact - * by putting the no of truncated bytes into hdr->trunc. - */ - - if(totlen > MCLBYTES) - { - trunc = 1; - hdr->trunc = totlen - MCLBYTES; - totlen = MCLBYTES; - } - else - { - hdr->trunc = 0; - } - - /* set length of trace record */ - - hdr->length = totlen; - - /* check valid interface */ - - if((isdnif = hdr->isdnif) > NISDNTRC) - { - printf("i4b_trace: get_trace_data_from_l1 - isdnif > NISDNTRC!\n"); - return(0); - } - - /* get mbuf */ - - if(!(m = i4b_Bgetmbuf(totlen))) - { - printf("i4b_trace: get_trace_data_from_l1 - i4b_getmbuf() failed!\n"); - return(0); - } - - /* check if we are in analyzemode */ - - if(analyzemode && (isdnif == rxunit || isdnif == txunit)) - { - if(isdnif == rxunit) - hdr->dir = FROM_NT; - else - hdr->dir = FROM_TE; - isdnif = outunit; - } - - if(IF_QFULL(&trace_queue[isdnif])) - { - struct mbuf *m1; - - x = splnet(); - IF_DEQUEUE(&trace_queue[isdnif], m1); - splx(x); - - i4b_Bfreembuf(m1); - } - - /* copy trace header */ - memcpy(m->m_data, hdr, sizeof(i4b_trace_hdr)); - - /* copy trace data */ - if(trunc) - memcpy(&m->m_data[sizeof(i4b_trace_hdr)], buf, totlen-sizeof(i4b_trace_hdr)); - else - memcpy(&m->m_data[sizeof(i4b_trace_hdr)], buf, len); - - x = splnet(); - - IF_ENQUEUE(&trace_queue[isdnif], m); - - if(device_state[isdnif] & ST_WAITDATA) - { - device_state[isdnif] &= ~ST_WAITDATA; - wakeup((void *) &trace_queue[isdnif]); - } - - splx(x); - - return(1); -} - -/*---------------------------------------------------------------------------* - * open trace device - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdntrcopen(dev_t dev, int flag, int fmt, - struct lwp *l) -{ - int x; - int unit = minor(dev); - - if(unit >= NISDNTRC) - return(ENXIO); - - if(device_state[unit] & ST_ISOPEN) - return(EBUSY); - - if(analyzemode && (unit == outunit || unit == rxunit || unit == txunit)) - return(EBUSY); - - - x = splnet(); - - device_state[unit] = ST_ISOPEN; - - splx(x); - - return(0); -} - -/*---------------------------------------------------------------------------* - * close trace device - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdntrcclose(dev_t dev, int flag, int fmt, - struct lwp *l) -{ - int isdnif = minor(dev); - int x; - - if (analyzemode && (isdnif == outunit)) { - l2_softc_t * rx_l2sc, * tx_l2sc; - analyzemode = 0; - outunit = -1; - - rx_l2sc = (l2_softc_t*)isdn_find_softc_by_isdnif(rxunit); - tx_l2sc = (l2_softc_t*)isdn_find_softc_by_isdnif(txunit); - - if (rx_l2sc != NULL) - rx_l2sc->driver->mph_command_req(rx_l2sc->l1_token, CMR_SETTRACE, TRACE_OFF); - if (tx_l2sc != NULL) - tx_l2sc->driver->mph_command_req(tx_l2sc->l1_token, CMR_SETTRACE, TRACE_OFF); - - x = splnet(); - device_state[rxunit] = ST_IDLE; - device_state[txunit] = ST_IDLE; - splx(x); - rxunit = -1; - txunit = -1; - } else { - l2_softc_t * l2sc = (l2_softc_t*)isdn_find_softc_by_isdnif(isdnif); - if (l2sc != NULL) { - l2sc->driver->mph_command_req(l2sc->l1_token, CMR_SETTRACE, TRACE_OFF); - x = splnet(); - device_state[isdnif] = ST_IDLE; - splx(x); - } - } - return(0); -} - -/*---------------------------------------------------------------------------* - * read from trace device - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdntrcread(dev_t dev, struct uio * uio, int ioflag) -{ - struct mbuf *m; - int x; - int error = 0; - int unit = minor(dev); - - if(!(device_state[unit] & ST_ISOPEN)) - return(EIO); - - x = splnet(); - - while(IF_QEMPTY(&trace_queue[unit]) && (device_state[unit] & ST_ISOPEN)) - { - device_state[unit] |= ST_WAITDATA; - - if((error = tsleep((void *) &trace_queue[unit], - TTIPRI | PCATCH, - "bitrc", 0 )) != 0) - { - device_state[unit] &= ~ST_WAITDATA; - splx(x); - return(error); - } - } - - IF_DEQUEUE(&trace_queue[unit], m); - - if(m && m->m_len) - error = uiomove(m->m_data, m->m_len, uio); - else - error = EIO; - - if(m) - i4b_Bfreembuf(m); - - splx(x); - - return(error); -} - -#if defined(__FreeBSD__) && defined(OS_USES_POLL) -/*---------------------------------------------------------------------------* - * poll device - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -i4btrcpoll(dev_t dev, int events, struct proc *p) -{ - return(ENODEV); -} -#endif - -/*---------------------------------------------------------------------------* - * device driver ioctl routine - *---------------------------------------------------------------------------*/ -PDEVSTATIC int -isdntrcioctl(dev_t dev, u_long cmd, void *data, int flag, - struct lwp *l) -{ - int error = 0; - int isdnif = minor(dev); - i4b_trace_setupa_t *tsa; - l2_softc_t * l2sc = (l2_softc_t*)isdn_find_softc_by_isdnif(isdnif); - - switch(cmd) - { - case I4B_TRC_SET: - if (l2sc == NULL) - return ENOTTY; - l2sc->driver->mph_command_req(l2sc->l1_token, CMR_SETTRACE, (void *)*(unsigned long *)data); - break; - - case I4B_TRC_SETA: - tsa = (i4b_trace_setupa_t *)data; - - if(tsa->rxunit >= 0 && tsa->rxunit < NISDNTRC) - rxunit = tsa->rxunit; - else - error = EINVAL; - - if(tsa->txunit >= 0 && tsa->txunit < NISDNTRC) - txunit = tsa->txunit; - else - error = EINVAL; - - if(error) - { - outunit = -1; - rxunit = -1; - txunit = -1; - } - else - { - l2_softc_t * rx_l2sc, * tx_l2sc; - rx_l2sc = (l2_softc_t*)(l2_softc_t*)isdn_find_softc_by_isdnif(rxunit); - tx_l2sc = (l2_softc_t*)(l2_softc_t*)isdn_find_softc_by_isdnif(txunit); - - if (l2sc == NULL || rx_l2sc == NULL || tx_l2sc == NULL) - return ENOTTY; - - outunit = isdnif; - analyzemode = 1; - rx_l2sc->driver->mph_command_req(rx_l2sc->l1_token, CMR_SETTRACE, (void *)(unsigned long)(tsa->rxflags & (TRACE_I | TRACE_D_RX | TRACE_B_RX))); - tx_l2sc->driver->mph_command_req(tx_l2sc->l1_token, CMR_SETTRACE, (void *)(unsigned long)(tsa->txflags & (TRACE_I | TRACE_D_RX | TRACE_B_RX))); - } - break; - - case I4B_TRC_RESETA: - analyzemode = 0; - outunit = -1; - rxunit = -1; - txunit = -1; - break; - - default: - error = ENOTTY; - break; - } - return(error); -} - -#endif /* NISDNTRC > 0 */ diff --git a/sys/netisdn/i4b_trace.h b/sys/netisdn/i4b_trace.h deleted file mode 100644 index 43e786c984be..000000000000 --- a/sys/netisdn/i4b_trace.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_trace.h - header file for trace data read device - * ---------------------------------------------------- - * - * $Id: i4b_trace.h,v 1.6 2015/09/06 06:01:01 dholland Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Wed Mar 8 16:41:43 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _NETISDN_I4B_TRACE_H_ -#define _NETISDN_I4B_TRACE_H_ - -#include - -/*---------------------------------------------------------------------------* - * structure of the header at the beginning of every trace mbuf - *---------------------------------------------------------------------------*/ -typedef struct i4b_trace_hdr { - int length; /* length of the following mbuf */ - int isdnif; /* controllers current isdnif number */ - int type; /* type of channel */ -#define TRC_CH_I 0 /* Layer 1 INFO's */ -#define TRC_CH_D 1 /* D channel */ -#define TRC_CH_B1 2 /* B1 channel */ -#define TRC_CH_B2 3 /* B2 channel */ - int dir; /* direction */ -#define FROM_TE 0 /* user -> network */ -#define FROM_NT 1 /* network -> user */ - int trunc; /* # of truncated bytes (frame > MCLBYTES) */ - unsigned int count; /* frame count for this unit/type */ - struct timeval time; /* timestamp for this frame */ -} i4b_trace_hdr; - -#define INFO0 0 /* layer 1 */ -#define INFO1_8 1 -#define INFO1_10 2 -#define INFO2 3 -#define INFO3 4 -#define INFO4_8 5 -#define INFO4_10 6 - -/*---------------------------------------------------------------------------* - * ioctl via /dev/i4btrc device(s): - * get/set current trace flag settings - *---------------------------------------------------------------------------*/ - -#define I4B_TRC_SET _IOW('T', 0, int) /* set trace settings */ - -#define TRACE_OFF 0x00 /* tracing off */ -#define TRACE_I 0x01 /* trace L1 INFO's on */ -#define TRACE_D_TX 0x02 /* trace D channel on */ -#define TRACE_D_RX 0x04 /* trace D channel on */ -#define TRACE_B_TX 0x08 /* trace B channel on */ -#define TRACE_B_RX 0x10 /* trace B channel on */ - -typedef struct { - int rxunit; /* unit # for rx frames */ - int rxflags; /* d and/or b channel */ - int txunit; /* unit # for tx frames */ - int txflags; /* d and/or b channel */ -} i4b_trace_setupa_t; - -#define I4B_TRC_SETA _IOW('T', 1, i4b_trace_setupa_t) /* set analyze mode */ -#define I4B_TRC_RESETA _IOW('T', 2, int) /* reset analyze mode */ - -#endif /* !_NETISDN_I4B_TRACE_H_ */ diff --git a/sys/netisdn/i4b_uframe.c b/sys/netisdn/i4b_uframe.c deleted file mode 100644 index e8f0694b2609..000000000000 --- a/sys/netisdn/i4b_uframe.c +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_uframe.c - routines for handling U-frames - * ----------------------------------------------- - * - * $Id: i4b_uframe.c,v 1.8 2007/01/24 13:08:15 hubertf Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_uframe.c,v 1.8 2007/01/24 13:08:15 hubertf Exp $"); - -#ifdef __FreeBSD__ -#include "i4bq921.h" -#else -#define NI4BQ921 1 -#endif -#if NI4BQ921 > 0 - -#include -#include -#include -#include -#include -#include - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#else -#include -#include -#endif - -#include -#include -#include -#include - -#include - -/*---------------------------------------------------------------------------* - * process a received U-frame - *---------------------------------------------------------------------------*/ -void -i4b_rxd_u_frame(l2_softc_t *l2sc, struct isdn_l3_driver *drv, struct mbuf *m) -{ - u_char *ptr = m->m_data; - - int sapi = GETSAPI(*(ptr + OFF_SAPI)); - int tei = GETTEI(*(ptr + OFF_TEI)); - int pfbit = GETUPF(*(ptr + OFF_CNTL)); - - switch(*(ptr + OFF_CNTL) & ~UPFBIT) - { - /* commands */ - - case SABME: - if((l2sc->tei_valid == TEI_VALID) && - (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) - { - l2sc->stat.rx_sabme++; - NDBGL2(L2_U_MSG, "SABME, sapi = %d, tei = %d", sapi, tei); - l2sc->rxd_PF = pfbit; - i4b_next_l2state(l2sc, drv, EV_RXSABME); - } - i4b_Dfreembuf(m); - break; - - case UI: - if(sapi == SAPI_L2M && - tei == GROUP_TEI && - *(ptr + OFF_MEI) == MEI) - { - /* layer 2 management (SAPI = 63) */ - l2sc->stat.rx_tei++; - i4b_tei_rxframe(l2sc, drv, m); - } - else if(sapi == SAPI_CCP && tei == GROUP_TEI) - { - /* call control (SAPI = 0) */ - l2sc->stat.rx_ui++; - /* strip ui header */ - m_adj(m, UI_HDR_LEN); - /* to upper layer */ - i4b_dl_unit_data_ind(l2sc->drv, m); - } - else - { - l2sc->stat.err_rx_badui++; - NDBGL2(L2_U_ERR, "unknown UI frame!"); - i4b_Dfreembuf(m); - } - break; - - case DISC: - if((l2sc->tei_valid == TEI_VALID) && - (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) - { - l2sc->stat.rx_disc++; - NDBGL2(L2_U_MSG, "DISC, sapi = %d, tei = %d", sapi, tei); - l2sc->rxd_PF = pfbit; - i4b_next_l2state(l2sc, drv, EV_RXDISC); - } - i4b_Dfreembuf(m); - break; - - case XID: - if((l2sc->tei_valid == TEI_VALID) && - (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) - { - l2sc->stat.rx_xid++; - NDBGL2(L2_U_MSG, "XID, sapi = %d, tei = %d", sapi, tei); - } - i4b_Dfreembuf(m); - break; - - /* responses */ - - case DM: - if((l2sc->tei_valid == TEI_VALID) && - (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) - { - l2sc->stat.rx_dm++; - NDBGL2(L2_U_MSG, "DM, sapi = %d, tei = %d", sapi, tei); - i4b_print_frame(m->m_len, m->m_data); - l2sc->rxd_PF = pfbit; - i4b_next_l2state(l2sc, drv, EV_RXDM); - } - i4b_Dfreembuf(m); - break; - - case UA: - if((l2sc->tei_valid == TEI_VALID) && - (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) - { - l2sc->stat.rx_ua++; - NDBGL2(L2_U_MSG, "UA, sapi = %d, tei = %d", sapi, tei); - l2sc->rxd_PF = pfbit; - i4b_next_l2state(l2sc, drv, EV_RXUA); - } - i4b_Dfreembuf(m); - break; - - case FRMR: - if((l2sc->tei_valid == TEI_VALID) && - (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) - { - l2sc->stat.rx_frmr++; - NDBGL2(L2_U_MSG, "FRMR, sapi = %d, tei = %d", sapi, tei); - l2sc->rxd_PF = pfbit; - i4b_next_l2state(l2sc, drv, EV_RXFRMR); - } - i4b_Dfreembuf(m); - break; - - default: - if((l2sc->tei_valid == TEI_VALID) && - (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) - { - NDBGL2(L2_U_ERR, "UNKNOWN TYPE ERROR, sapi = %d, tei = %d, frame = ", sapi, tei); - i4b_print_frame(m->m_len, m->m_data); - } - else - { - NDBGL2(L2_U_ERR, "not mine - UNKNOWN TYPE ERROR, sapi = %d, tei = %d, frame = ", sapi, tei); - i4b_print_frame(m->m_len, m->m_data); - } - l2sc->stat.err_rx_badui++; - i4b_Dfreembuf(m); - break; - } -} - -/*---------------------------------------------------------------------------* - * build U-frame for sending - *---------------------------------------------------------------------------*/ -struct mbuf * -i4b_build_u_frame(l2_softc_t *l2sc, crbit_to_nt_t crbit, pbit_t pbit, u_char type) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(U_FRAME_LEN)) == NULL) - return(NULL); - - PUTSAPI(SAPI_CCP, crbit, m->m_data[OFF_SAPI]); - - PUTTEI(l2sc->tei, m->m_data[OFF_TEI]); - - if(pbit) - m->m_data[OFF_CNTL] = type | UPBITSET; - else - m->m_data[OFF_CNTL] = type & ~UPBITSET; - - return(m); -} - -/*---------------------------------------------------------------------------* - * transmit SABME command - *---------------------------------------------------------------------------*/ -void -i4b_tx_sabme(l2_softc_t *l2sc, pbit_t pbit) -{ - struct mbuf *m; - - l2sc->stat.tx_sabme++; - NDBGL2(L2_U_MSG, "tx SABME, tei = %d", l2sc->tei); - m = i4b_build_u_frame(l2sc, CR_CMD_TO_NT, pbit, SABME); - l2sc->driver->ph_data_req(l2sc->l1_token, m, MBUF_FREE); -} - -/*---------------------------------------------------------------------------* - * transmit DM response - *---------------------------------------------------------------------------*/ -void -i4b_tx_dm(l2_softc_t *l2sc, fbit_t fbit) -{ - struct mbuf *m; - - l2sc->stat.tx_dm++; - NDBGL2(L2_U_MSG, "tx DM, tei = %d", l2sc->tei); - m = i4b_build_u_frame(l2sc, CR_RSP_TO_NT, fbit, DM); - l2sc->driver->ph_data_req(l2sc->l1_token, m, MBUF_FREE); -} - -/*---------------------------------------------------------------------------* - * transmit DISC command - *---------------------------------------------------------------------------*/ -void -i4b_tx_disc(l2_softc_t *l2sc, pbit_t pbit) -{ - struct mbuf *m; - - l2sc->stat.tx_disc++; - NDBGL2(L2_U_MSG, "tx DISC, tei = %d", l2sc->tei); - m = i4b_build_u_frame(l2sc, CR_CMD_TO_NT, pbit, DISC); - l2sc->driver->ph_data_req(l2sc->l1_token, m, MBUF_FREE); -} - -/*---------------------------------------------------------------------------* - * transmit UA response - *---------------------------------------------------------------------------*/ -void -i4b_tx_ua(l2_softc_t *l2sc, fbit_t fbit) -{ - struct mbuf *m; - - l2sc->stat.tx_ua++; - NDBGL2(L2_U_MSG, "tx UA, tei = %d", l2sc->tei); - m = i4b_build_u_frame(l2sc, CR_RSP_TO_NT, fbit, UA); - l2sc->driver->ph_data_req(l2sc->l1_token, m, MBUF_FREE); -} - -/*---------------------------------------------------------------------------* - * transmit FRMR response - *---------------------------------------------------------------------------*/ -void -i4b_tx_frmr(l2_softc_t *l2sc, fbit_t fbit) -{ - struct mbuf *m; - - l2sc->stat.tx_frmr++; - NDBGL2(L2_U_MSG, "tx FRMR, tei = %d", l2sc->tei); - m = i4b_build_u_frame(l2sc, CR_RSP_TO_NT, fbit, FRMR); - l2sc->driver->ph_data_req(l2sc->l1_token, m, MBUF_FREE); -} - -#endif /* NI4BQ921 > 0 */ diff --git a/sys/netisdn/i4b_util.c b/sys/netisdn/i4b_util.c deleted file mode 100644 index 02ef8d4bc0c0..000000000000 --- a/sys/netisdn/i4b_util.c +++ /dev/null @@ -1,332 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_util.c - layer 2 utility routines - * ------------------------------------- - * - * $Id: i4b_util.c,v 1.11 2006/11/16 01:33:49 christos Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 5 11:33:47 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__KERNEL_RCSID(0, "$NetBSD: i4b_util.c,v 1.11 2006/11/16 01:33:49 christos Exp $"); - -#ifdef __FreeBSD__ -#include "i4bq921.h" -#else -#define NI4BQ921 1 -#endif -#if NI4BQ921 > 0 - -#include -#include -#include -#include -#include -#include - -#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 -#include -#endif - -#ifdef __FreeBSD__ -#include -#include -#else -#include -#include -#endif - -#include -#include -#include -#include -#include -#include -#include - -/*---------------------------------------------------------------------------* - * routine ESTABLISH DATA LINK (Q.921 03/93 page 83) - *---------------------------------------------------------------------------*/ -void -i4b_establish_data_link(l2_softc_t *l2sc) -{ - i4b_l1_activate(l2sc); - - i4b_clear_exception_conditions(l2sc); - - l2sc->RC = 0; - - i4b_tx_sabme(l2sc, P1); - - i4b_T200_restart(l2sc); - - i4b_T203_stop(l2sc); -} - -/*---------------------------------------------------------------------------* - * routine CLEAR EXCEPTION CONDITIONS (Q.921 03/93 page 83) - *---------------------------------------------------------------------------*/ -void -i4b_clear_exception_conditions(l2_softc_t *l2sc) -{ - int s; - - s = splnet(); - -/*XXX -------------------------------------------------------------- */ -/*XXX is this really appropriate here or should it moved elsewhere ? */ - - i4b_Dcleanifq(&l2sc->i_queue); - - if(l2sc->ua_num != UA_EMPTY) - { - i4b_Dfreembuf(l2sc->ua_frame); - l2sc->ua_num = UA_EMPTY; - } -/*XXX -------------------------------------------------------------- */ - - l2sc->peer_busy = 0; - - l2sc->rej_excpt = 0; - - l2sc->own_busy = 0; - - l2sc->ack_pend = 0; - - splx(s); -} - -/*---------------------------------------------------------------------------* - * routine TRANSMIT ENQUIRE (Q.921 03/93 page 83) - *---------------------------------------------------------------------------*/ -void -i4b_transmit_enquire(l2_softc_t *l2sc) -{ - if(l2sc->own_busy) - i4b_tx_rnr_command(l2sc, P1); - else - i4b_tx_rr_command(l2sc, P1); - - l2sc->ack_pend = 0; - - i4b_T200_start(l2sc); -} - -/*---------------------------------------------------------------------------* - * routine NR ERROR RECOVERY (Q.921 03/93 page 83) - *---------------------------------------------------------------------------*/ -void -i4b_nr_error_recovery(l2_softc_t *l2sc) -{ - i4b_mdl_error_ind(l2sc, "i4b_nr_error_recovery", MDL_ERR_J); - - i4b_establish_data_link(l2sc); - - l2sc->l3initiated = 0; -} - -/*---------------------------------------------------------------------------* - * routine ENQUIRY RESPONSE (Q.921 03/93 page 84) - *---------------------------------------------------------------------------*/ -void -i4b_enquiry_response(l2_softc_t *l2sc) -{ - if(l2sc->own_busy) - i4b_tx_rnr_response(l2sc, F1); - else - i4b_tx_rr_response(l2sc, F1); - - l2sc->ack_pend = 0; -} - -/*---------------------------------------------------------------------------* - * routine INVOKE RETRANSMISSION (Q.921 03/93 page 84) - *---------------------------------------------------------------------------*/ -void -i4b_invoke_retransmission(l2_softc_t *l2sc, int nr) -{ - int s; - - s = splnet(); - - NDBGL2(L2_ERROR, "nr = %d", nr ); - - while(l2sc->vs != nr) - { - NDBGL2(L2_ERROR, "nr(%d) != vs(%d)", nr, l2sc->vs); - - M128DEC(l2sc->vs); - -/* XXXXXXXXXXXXXXXXX */ - - if((l2sc->ua_num != UA_EMPTY) && (l2sc->vs == l2sc->ua_num)) - { - if(IF_QFULL(&l2sc->i_queue)) - { - NDBGL2(L2_ERROR, "ERROR, I-queue full!"); - } - else - { - IF_ENQUEUE(&l2sc->i_queue, l2sc->ua_frame); - l2sc->ua_num = UA_EMPTY; - } - } - else - { - NDBGL2(L2_ERROR, "ERROR, l2sc->vs = %d, l2sc->ua_num = %d ",l2sc->vs, l2sc->ua_num); - } - -/* XXXXXXXXXXXXXXXXX */ - - i4b_i_frame_queued_up(l2sc); - } - - splx(s); -} - -/*---------------------------------------------------------------------------* - * routine ACKNOWLEDGE PENDING (Q.921 03/93 p 70) - *---------------------------------------------------------------------------*/ -void -i4b_acknowledge_pending(l2_softc_t *l2sc) -{ - if(l2sc->ack_pend) - { - l2sc->ack_pend = 0; - i4b_tx_rr_response(l2sc, F0); - } -} - -/*---------------------------------------------------------------------------* - * i4b_print_frame - just print the hex contents of a frame - *---------------------------------------------------------------------------*/ -void -i4b_print_frame(int len, u_char *buf) -{ -#if DO_I4B_DEBUG - int i; - - if (!(i4b_l2_debug & L2_ERROR)) /* XXXXXXXXXXXXXXXXXXXXX */ - return; - - for(i = 0; i < len; i++) - printf(" 0x%x", buf[i]); - printf("\n"); -#endif -} - -/*---------------------------------------------------------------------------* - * i4b_print_l2var - print some l2softc vars - *---------------------------------------------------------------------------*/ -void -i4b_print_l2var(l2_softc_t *l2sc) -{ - NDBGL2(L2_ERROR, "isdnif %d V(R)=%d, V(S)=%d, V(A)=%d,ACKP=%d,PBSY=%d,OBSY=%d", - l2sc->drv->isdnif, - l2sc->vr, - l2sc->vs, - l2sc->va, - l2sc->ack_pend, - l2sc->peer_busy, - l2sc->own_busy); -} - -/*---------------------------------------------------------------------------* - * got s or i frame, check if valid ack for last sent frame - *---------------------------------------------------------------------------*/ -void -i4b_rxd_ack(l2_softc_t *l2sc, struct isdn_l3_driver *drv, int nr) -{ - -#ifdef NOTDEF - NDBGL2(L2_ERROR, "N(R)=%d, UA=%d, V(R)=%d, V(S)=%d, V(A)=%d", - nr, - l2sc->ua_num, - l2sc->vr, - l2sc->vs, - l2sc->va); -#endif - - if(l2sc->ua_num != UA_EMPTY) - { - int s; - - s = splnet(); - - M128DEC(nr); - - if(l2sc->ua_num != nr) - NDBGL2(L2_ERROR, "((N(R)-1)=%d) != (UA=%d) !!!", nr, l2sc->ua_num); - - i4b_Dfreembuf(l2sc->ua_frame); - l2sc->ua_num = UA_EMPTY; - - splx(s); - } -} - -/*---------------------------------------------------------------------------* - * if not already active, activate layer 1 - *---------------------------------------------------------------------------*/ -void -i4b_l1_activate(l2_softc_t *l2sc) -{ - if(l2sc->ph_active == PH_INACTIVE) - { - l2sc->ph_active = PH_ACTIVEPEND; - l2sc->driver->ph_activate_req(l2sc->l1_token); - } -}; - -/*---------------------------------------------------------------------------* - * check for v(a) <= n(r) <= v(s) - * nr = receive sequence frame counter, va = acknowledge sequence frame - * counter and vs = transmit sequence frame counter - *---------------------------------------------------------------------------*/ -int -i4b_l2_nr_ok(int nr, int va, int vs) -{ - if((va > nr) && ((nr != 0) || (va != 127))) - { - NDBGL2(L2_ERROR, "ERROR, va = %d, nr = %d, vs = %d [1]", va, nr, vs); - return 0; /* fail */ - } - - if((nr > vs) && ((vs != 0) || (nr != 127))) - { - NDBGL2(L2_ERROR, "ERROR, va = %d, nr = %d, vs = %d [2]", va, nr, vs); - return 0; /* fail */ - } - return 1; /* good */ -} - -#endif /* NI4BQ921 > 0 */ -