Subject: ISDN subsystem
To: None <tech-kern@netbsd.org>
From: Martin Husemann <martin@duskware.de>
List: tech-kern
Date: 12/30/2000 13:55:29
As some of you might still remember, my primary task has been to bring 
ISDN4BSD into NetBSD. This has been delayed due to various things. One
of the major concerns has been the (then) still ongoing development of I4B
with no easy means of synchronization. This is resolved now, as there isn't
an external I4B distribution any more (changes are now only done inside the
FreeBSD tree).

I've taken the latest available I4B distribution, moved some things around
to better fit into our view of the world, renamed some files and options
and put this into a current source tree. I didn't change the userland/kernel
communication (and will try to keep that compatible to the FreeBSD one
as long as possible). I didn't do any of the massive cleanups necessary,
as I prefer to have cvs traces of this (to make it transparent). The
cleanup done so far is only to prevent importing some files and moving
them around in the tree right afterwards.

Have a look yourself:
For review, I've put up a snapshot on ftp.netbsd.org:~martin/isdn.  It
consists of a cvs diff and newfiles.tar.gz with all files added to the
tree. This is only the kernel part, the userland utilities (test and
debug tools, configuration and the isdn daemon) are (besides different
include paths) identical to the last I4B distribution. This is (for
the moment ignoring the userland stuff missing in the snapshot) a
working solution for i386, amiga, atari and alpha (untested). Adding
support for other platforms is easier when this is in-tree. It consist
mainly in adding cdev entries to the conf.c array and the makedev
scripts.

Brief historic excurse:
ISDN4BSD is the predecessor of the BISDN project and started somewhere back
in 1996. Its design has been discussed on private mailing lists, which
unfortunately have no archive. Involved have been people from several BSDs,
interestingly most of the time excluding OpenBSD. A version of ISDN4BSD has
been integrated into FreeBSD for the 4.0 release, IIRC. A few months ago
the last release of ISDN4BSD has been published. It works out of the box
on NetBSD-1.5 for i386, amiga and hopefully atari (but not on -current).

What it is:
From the users POV I4B consists of a phone device (used to for example create
an answering machine), a raw B-channel device (to transparently transfer data
over ISDN, used for example with Brian Sommers userland PPP), an IP-over-ISDN
device (raw IPv4 packets over ISDN, for compatibility with other ISDN 
subsystems, now rarely used), and the PPP-over-ISDN device most people use
to connect their ISDN router to their ISP. Plus there are some control, trace
and debug devices. All decisions are made in userland by "isdnd", which i.e.
decides if an incoming call has to be accepted or rejected, and if accepted
which device it will be connected to.

At the low level there is currently support for various cards based on the
Siemens ISAC/HSCX chipset and lookalikes, as well as (unfinished) support
for Diehl/EICON active cards from the old SX series. Someone is working on
support for USB devices and other low-level drivers will be added as soon
as the cleanup (see below) is done and I can get hold of test hardware.

In between there is a straight forward Q.921/Q.931 implementation with
state machines labeled exactly as the standard and function calls as only
communication (no queues in the lower levels beyond the device queue used
to transfer date to/from the userland daemon). The only protocol implemented
now is the european variant of DSS-1 (ETSI).

Directory layout:
When moving from the last I4B release to the stuff I'd like to import now,
I chose the following directory layout:

 - all userland tools will go into /usr/sbin. Source will have it's own 
   directory "isdn" under src/usr.sbin (like ntp has).
 - include files visible from userland are in /usr/include/isdn
 - the device independend part (ISDN layers 2 and 3, the userland devices)
   are in sys/isdn. Common hardware support files are in sys/dev/ic
   and all card specific files are in sys/dev/isa, sys/dev/isapnp,
   sys/dev/pci or sys/dev/pcmcia.

Cleanup still to do:
This stuff has collected quite a bit of various stupid things during its
development. For example someone rewrote the header file declaring the
register offsets for the ISAC chip to use pointer arithmetic on a struct.
Easy to fix, but annoying. There are several reminiscent of the (old) FreeBSD
autoconfiguration mechanisms (i.e. fixed arrays of pointers somewhere and
indexes into this [called "int unit"] passed around as function arguments,
where it would be far easier to pass the pointer directly). Then the code
attaching layer2 at layer1 is completely broken, same for layer4 to layer3.
Both are easy to fix (interestingly FreeBSD replaced the layer2<->layer1
code with the last released but got it completely wrong again). And there
are tons of (now) useless #ifdefs for various OSs, which I plan to simply
remove (we agreed to diverge, no "common" I4B distribution anymore).

As stated above, I will fix all these soon, but prefer to do that after import,
as this will make the changes transparent and documented. Furthermore the
thing I'm proposing to import now is easily recognizable as the latest
I4B release - which will not be true anymore after the cleanup.


Any comments appreciated


Martin