diff options
author | phk <phk@FreeBSD.org> | 1996-10-20 18:24:17 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1996-10-20 18:24:17 +0000 |
commit | ea3476f34db58155dd54a57b1f484cda34b4799d (patch) | |
tree | 490c229a5f1fd7bb348bdb449d91368c3020b03c | |
parent | 64291ea9abdfb9c1ed60f0a3ef2e8ff6893a6545 (diff) | |
download | FreeBSD-src-ea3476f34db58155dd54a57b1f484cda34b4799d.zip FreeBSD-src-ea3476f34db58155dd54a57b1f484cda34b4799d.tar.gz |
Removing old isdn stuff.
66 files changed, 0 insertions, 8187 deletions
diff --git a/gnu/usr.sbin/isdn/COPYRIGHT b/gnu/usr.sbin/isdn/COPYRIGHT deleted file mode 100644 index 8bbadfb..0000000 --- a/gnu/usr.sbin/isdn/COPYRIGHT +++ /dev/null @@ -1,21 +0,0 @@ -The II-sources are written by Dietmar Friede and Juergen Krause. -For all these sources: - - Copyright, (c) 1995 Dietmar Friede and Juergen Krause - - These programs are free software; you can redistribute them and/or modify - them under the terms of the GNU General Public License as published by - the Free Software Foundation, version 1. - - These programs are distributed in the hope that they might be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - in the file docs/copying.doc - along with these programs; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -Acknowledgement: -alaw/ulaw from isdndrv-0.1.1 (Henrik (marsu@palumbia.IN-Berlin.de)) diff --git a/gnu/usr.sbin/isdn/Makefile b/gnu/usr.sbin/isdn/Makefile deleted file mode 100644 index 1c8e268..0000000 --- a/gnu/usr.sbin/isdn/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -SUBDIR= answ dbg iid ispy itel ittd load nsplit play rst rstcode \ - spy ulaw2alaw alaw2ulaw - -.include <bsd.subdir.mk> diff --git a/gnu/usr.sbin/isdn/Makefile.inc b/gnu/usr.sbin/isdn/Makefile.inc deleted file mode 100644 index 75ee577..0000000 --- a/gnu/usr.sbin/isdn/Makefile.inc +++ /dev/null @@ -1,2 +0,0 @@ -BINDIR?= /usr/sbin -LIBDIR?= /usr/share/isdn diff --git a/gnu/usr.sbin/isdn/alaw2ulaw/Makefile b/gnu/usr.sbin/isdn/alaw2ulaw/Makefile deleted file mode 100644 index 7962912..0000000 --- a/gnu/usr.sbin/isdn/alaw2ulaw/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -PROG= alaw2ulaw -CFLAGS+= -DBSD -O -NOMAN= yes - -.include <bsd.prog.mk> diff --git a/gnu/usr.sbin/isdn/alaw2ulaw/README b/gnu/usr.sbin/isdn/alaw2ulaw/README deleted file mode 100644 index 771e87f..0000000 --- a/gnu/usr.sbin/isdn/alaw2ulaw/README +++ /dev/null @@ -1 +0,0 @@ -stolen from isdndrv-0.1.1 diff --git a/gnu/usr.sbin/isdn/alaw2ulaw/alaw2ulaw.c b/gnu/usr.sbin/isdn/alaw2ulaw/alaw2ulaw.c deleted file mode 100644 index a422988..0000000 --- a/gnu/usr.sbin/isdn/alaw2ulaw/alaw2ulaw.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <fcntl.h> -#include "con.h" - -main(int argc, char *argv[]) -{ - int counter; - unsigned char buffer[1024]; - - - while ((counter = read(0, buffer, sizeof(buffer))) > 0) { - translate_bytes(alaw_linear, buffer, counter); /* now linear */ - translate_bytes(linear_ulaw, buffer, counter); /* now ulaw */ - counter != write(1, buffer, counter); - } -} diff --git a/gnu/usr.sbin/isdn/alaw2ulaw/con.h b/gnu/usr.sbin/isdn/alaw2ulaw/con.h deleted file mode 100644 index 9f359c8..0000000 --- a/gnu/usr.sbin/isdn/alaw2ulaw/con.h +++ /dev/null @@ -1,162 +0,0 @@ - -static unsigned char ulaw_linear[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 2, - 5, 9, 13, 17, 21, 25, 29, 33, - 37, 41, 45, 49, 53, 57, 61, 65, - 68, 70, 72, 74, 76, 78, 80, 82, - 84, 86, 88, 90, 92, 94, 96, 98, - 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, - 115, 116, 116, 117, 117, 118, 118, 119, - 119, 120, 120, 121, 121, 122, 122, 123, - 123, 123, 124, 124, 124, 124, 125, 125, - 125, 125, 126, 126, 126, 126, 127, 127, - 127, 127, 127, 127, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 252, 248, 244, 240, 236, 232, 228, 224, - 220, 216, 212, 208, 204, 200, 196, 192, - 189, 187, 185, 183, 181, 179, 177, 175, - 173, 171, 169, 167, 165, 163, 161, 159, - 157, 156, 155, 154, 153, 152, 151, 150, - 149, 148, 147, 146, 145, 144, 143, 142, - 142, 141, 141, 140, 140, 139, 139, 138, - 138, 137, 137, 136, 136, 135, 135, 134, - 134, 134, 133, 133, 133, 133, 132, 132, - 132, 132, 131, 131, 131, 131, 130, 130, - 130, 130, 130, 130, 129, 129, 129, 129, - 129, 129, 129, 129, 128, 128, 128, 128, -}; - -static unsigned char linear_ulaw[] = { - 31, 31, 31, 32, 32, 32, 32, 33, - 33, 33, 33, 34, 34, 34, 34, 35, - 35, 35, 35, 36, 36, 36, 36, 37, - 37, 37, 37, 38, 38, 38, 38, 39, - 39, 39, 39, 40, 40, 40, 40, 41, - 41, 41, 41, 42, 42, 42, 42, 43, - 43, 43, 43, 44, 44, 44, 44, 45, - 45, 45, 45, 46, 46, 46, 46, 47, - 47, 47, 47, 48, 48, 49, 49, 50, - 50, 51, 51, 52, 52, 53, 53, 54, - 54, 55, 55, 56, 56, 57, 57, 58, - 58, 59, 59, 60, 60, 61, 61, 62, - 62, 63, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 81, 83, 85, 87, 89, - 91, 93, 95, 99, 103, 107, 111, 119, - 255, 247, 239, 235, 231, 227, 223, 221, - 219, 217, 215, 213, 211, 209, 207, 206, - 205, 204, 203, 202, 201, 200, 199, 198, - 197, 196, 195, 194, 193, 192, 191, 191, - 190, 190, 189, 189, 188, 188, 187, 187, - 186, 186, 185, 185, 184, 184, 183, 183, - 182, 182, 181, 181, 180, 180, 179, 179, - 178, 178, 177, 177, 176, 176, 175, 175, - 175, 175, 174, 174, 174, 174, 173, 173, - 173, 173, 172, 172, 172, 172, 171, 171, - 171, 171, 170, 170, 170, 170, 169, 169, - 169, 169, 168, 168, 168, 168, 167, 167, - 167, 167, 166, 166, 166, 166, 165, 165, - 165, 165, 164, 164, 164, 164, 163, 163, - 163, 163, 162, 162, 162, 162, 161, 161, - 161, 161, 160, 160, 160, 160, 159, 159, -}; - -static unsigned char alaw_linear[] = { - 45, 214, 122, 133, 0, 255, 107, 149, - 86, 171, 126, 129, 0, 255, 117, 138, - 13, 246, 120, 135, 0, 255, 99, 157, - 70, 187, 124, 131, 0, 255, 113, 142, - 61, 198, 123, 132, 0, 255, 111, 145, - 94, 163, 127, 128, 0, 255, 119, 136, - 29, 230, 121, 134, 0, 255, 103, 153, - 78, 179, 125, 130, 0, 255, 115, 140, - 37, 222, 122, 133, 0, 255, 105, 151, - 82, 175, 126, 129, 0, 255, 116, 139, - 5, 254, 120, 135, 0, 255, 97, 159, - 66, 191, 124, 131, 0, 255, 112, 143, - 53, 206, 123, 132, 0, 255, 109, 147, - 90, 167, 127, 128, 0, 255, 118, 137, - 21, 238, 121, 134, 0, 255, 101, 155, - 74, 183, 125, 130, 0, 255, 114, 141, - 49, 210, 123, 133, 0, 255, 108, 148, - 88, 169, 127, 129, 0, 255, 118, 138, - 17, 242, 121, 135, 0, 255, 100, 156, - 72, 185, 125, 131, 0, 255, 114, 142, - 64, 194, 124, 132, 0, 255, 112, 144, - 96, 161, 128, 128, 1, 255, 120, 136, - 33, 226, 122, 134, 0, 255, 104, 152, - 80, 177, 126, 130, 0, 255, 116, 140, - 41, 218, 122, 133, 0, 255, 106, 150, - 84, 173, 126, 129, 0, 255, 117, 139, - 9, 250, 120, 135, 0, 255, 98, 158, - 68, 189, 124, 131, 0, 255, 113, 143, - 57, 202, 123, 132, 0, 255, 110, 146, - 92, 165, 127, 128, 0, 255, 119, 137, - 25, 234, 121, 134, 0, 255, 102, 154, - 76, 181, 125, 130, 0, 255, 115, 141, - -}; - - -static unsigned char linear_alaw[] = { - - 252, 172, 172, 172, 172, 80, 80, 80, - 80, 208, 208, 208, 208, 16, 16, 16, - 16, 144, 144, 144, 144, 112, 112, 112, - 112, 240, 240, 240, 240, 48, 48, 48, - 48, 176, 176, 176, 176, 64, 64, 64, - 64, 192, 192, 192, 192, 0, 0, 0, - 0, 128, 128, 128, 128, 96, 96, 96, - 96, 224, 224, 224, 224, 32, 32, 32, - 160, 160, 88, 88, 216, 216, 24, 24, - 152, 152, 120, 120, 248, 248, 56, 56, - 184, 184, 72, 72, 200, 200, 8, 8, - 136, 136, 104, 104, 232, 232, 40, 40, - 168, 86, 214, 22, 150, 118, 246, 54, - 182, 70, 198, 6, 134, 102, 230, 38, - 166, 222, 158, 254, 190, 206, 142, 238, - 210, 242, 194, 226, 218, 250, 202, 234, - 235, 203, 251, 219, 227, 195, 243, 211, - 175, 239, 143, 207, 191, 255, 159, 223, - 167, 39, 231, 103, 135, 7, 199, 71, - 183, 55, 247, 119, 151, 23, 215, 87, - 87, 169, 169, 41, 41, 233, 233, 105, - 105, 137, 137, 9, 9, 201, 201, 73, - 73, 185, 185, 57, 57, 249, 249, 121, - 121, 153, 153, 25, 25, 217, 217, 89, - 89, 89, 161, 161, 161, 161, 33, 33, - 33, 33, 225, 225, 225, 225, 97, 97, - 97, 97, 129, 129, 129, 129, 1, 1, - 1, 1, 193, 193, 193, 193, 65, 65, - 65, 65, 177, 177, 177, 177, 49, 49, - 49, 49, 241, 241, 241, 241, 113, 113, - 113, 113, 145, 145, 145, 145, 17, 17, - 17, 17, 209, 209, 209, 209, 81, 253, -}; - -inline void translate_bytes(const void *table, void *buff, unsigned long n) -{ - __asm__("cld\n" - "1:\tlodsb\n\t" - "xlatb\n\t" - "stosb\n\t" - "loop 1b\n\t" - ::"b" ((long)table), "c" (n), "D" ((long)buff), "S" ((long)buff) - :"bx","cx","di","si","ax"); -} - -void translate_ansi(unsigned char table[], unsigned char buff[], unsigned long n) -{ -register counter; - -for(counter=0; counter< n; counter++) - buff[counter] = table[buff[counter]]; -} diff --git a/gnu/usr.sbin/isdn/answ/Makefile b/gnu/usr.sbin/isdn/answ/Makefile deleted file mode 100644 index 62b2229..0000000 --- a/gnu/usr.sbin/isdn/answ/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -NOMAN= noman - -beforeinstall: - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ - ${.CURDIR}/answ.sh ${DESTDIR}/${BINDIR}/answ - -.include <bsd.prog.mk> diff --git a/gnu/usr.sbin/isdn/answ/answ.sh b/gnu/usr.sbin/isdn/answ/answ.sh deleted file mode 100644 index ea33866..0000000 --- a/gnu/usr.sbin/isdn/answ/answ.sh +++ /dev/null @@ -1,14 +0,0 @@ -# play.sh -if [ -f /isdn/msg/.num ] -then - N=`cat /isdn/msg/.num` -else - N=0 -fi -N=`printf "%.4d" $N` -D=`date +%d%H` -date >> /isdn/msg/I.$N.$D -dd of=/dev/itel00 if=/isdn/msg/msg.answ bs=1k -dd of=/dev/itel00 if=/isdn/msg/beep bs=1k -dd if=/dev/itel00 of=/isdn/msg/R.$N.$D bs=1k -echo `expr $N + 1` >/isdn/msg/.num diff --git a/gnu/usr.sbin/isdn/dbg/Makefile b/gnu/usr.sbin/isdn/dbg/Makefile deleted file mode 100644 index 7b1e33d..0000000 --- a/gnu/usr.sbin/isdn/dbg/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -CFLAGS+= -DBSD -O -PROG= dbg -SRCS= dbg.c dbg_3009.c dbg_3008.c dbg_5000.c - -.include <bsd.prog.mk> diff --git a/gnu/usr.sbin/isdn/dbg/dbg.1 b/gnu/usr.sbin/isdn/dbg/dbg.1 deleted file mode 100644 index b40548e..0000000 --- a/gnu/usr.sbin/isdn/dbg/dbg.1 +++ /dev/null @@ -1,19 +0,0 @@ -.\" Copyright (c) 1994 Dietmar Friede -.Dd September 15, 1994 -.Os BSD -.Dt "ISDN dbg" 1 -.Sh NAME -.Nm dbg -.Nd NICCY-3008, NICCY-3009, NICCY-5000 debug programm -.Sh SYNOPSIS -.Nm dbg -.Op file -.Sh DESCRIPTION -.Nm -reads the shared memory of the NICCY-3008 and the NICCY-3009 or the status -bytes of the NICCY-5000 and displays them. The output is send to stderr. -If you give a filename the bytes are dumped to this file. -.Sh BUGS -.Nm -is only working correctly for the 3008. Some of the output for the 3009 -and 5000 are interpreted wrong. diff --git a/gnu/usr.sbin/isdn/dbg/dbg.c b/gnu/usr.sbin/isdn/dbg/dbg.c deleted file mode 100644 index b57b5c7..0000000 --- a/gnu/usr.sbin/isdn/dbg/dbg.c +++ /dev/null @@ -1,63 +0,0 @@ -static char rcsid[] = "@(#)$Id: dbg.c,v 1.1 1995/01/25 14:06:18 jkr Exp jkr $"; -/******************************************************************************* - * II - Version 0.1 $Revision: 1.1 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: dbg.c,v $ - * - ******************************************************************************/ - -#include <stdio.h> -#include <sys/types.h> -#include <sys/ioctl.h> -#include <sys/file.h> -#include "../../../../sys/gnu/i386/isa/niccyreg.h" - -u_char data[10000]; -int f; -FILE *Fout; - -main(int argc, char **argv) -{ - int size = 0; - - if ((f = open("/dev/nic0", O_RDWR)) < 0) - { - perror("open"); - exit(1); - } - if (ioctl(f, NICCY_DEBUG, data) < 0) - { - perror("ioctl"); - } - switch (data[0]) - { - case 0x38: - printf("Niccy 3008\n"); - analyse_3008(data + 1); - size = 1024; - break; - case 0x39: - printf("Niccy 3009\n"); - analyse_3009(data + 1); - size = 2044; - break; - case 0x50: - printf("Niccy 5000\n"); - analyse_5000(data + 1); - size = 8; - break; - default: - printf("unknown\n"); - } - - argv++; - if (*argv && (Fout = fopen(*argv, "w")) != NULL && size) - fwrite(data + 1, size, 1, Fout); -} diff --git a/gnu/usr.sbin/isdn/dbg/dbg_3008.c b/gnu/usr.sbin/isdn/dbg/dbg_3008.c deleted file mode 100644 index 9452572..0000000 --- a/gnu/usr.sbin/isdn/dbg/dbg_3008.c +++ /dev/null @@ -1,150 +0,0 @@ -static char rcsid[] = "@(#)$Id: dbg_3008.c,v 1.1 1995/01/25 14:06:18 jkr Exp jkr $"; -/******************************************************************************* - * II - Version 0.1 $Revision: 1.1 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: dbg_3008.c,v $ - * - ******************************************************************************/ - -#include <stdio.h> -#include <sys/types.h> -#include <sys/ioctl.h> -#include <sys/file.h> -#include "../../../../sys/gnu/i386/isa/nic3008.h" - -static int -print_stat(status) -{ - if (status & 0x8A) - { - if (status & 0x80) - fprintf(stderr, "Software-Fehler\n"); - if (status & 8) - fprintf(stderr, "Hardware-Fehler\n"); - if (status & 2) - fprintf(stderr, "Fehler beim Selbsttest\n"); - } -} - -static int -self_test(dpr_type * dpr) -{ - int abort; - -} - -static int -prtint(i) -{ - switch (i) - { - case 0:fprintf(stderr, "5"); - break; - case 1: - fprintf(stderr, "4"); - break; - case 2: - fprintf(stderr, "3"); - break; - case 3: - fprintf(stderr, "2/9"); - break; - case 4: - fprintf(stderr, "7"); - break; - default: - fprintf(stderr, "??????????\n"); - } - fprintf(stderr, "\n"); -} - -analyse_3008(dpr_type * dpr) -{ - - print_stat(dpr->card_state); - if (dpr->card_state & 1) - { - fprintf(stderr, "Selbsttest lae„uf\n"); - exit(1); - } - self_test(dpr); - fprintf(stderr, "%s : %x %x %x %x\n", dpr->niccy_ver, dpr->card_state - ,dpr->hw_config, dpr->jmp_config, dpr->ram_config); - if (dpr->card_state & 4) - fprintf(stderr, "Layer 1 not active\n"); - if (dpr->card_state & 0x10) - fprintf(stderr, "Date/Time not set\n"); - if (dpr->card_state & 0x20) - fprintf(stderr, "ENTITY not loaded\n"); - if (dpr->card_state & 0x40) - fprintf(stderr, "out of sync.\n"); - fprintf(stderr, "Hardware Configuration:\n"); - if (dpr->hw_config & 0x80) - fprintf(stderr, "No "); - fprintf(stderr, "DRAM-Module\n"); - if (dpr->ram_config & 1) - fprintf(stderr, "256 KB SRAM\n"); - switch (dpr->ram_config) - { - case 4: - case 5: - fprintf(stderr, "1 MB DRAM\n"); - break; - case 16: - case 17: - fprintf(stderr, "1 MB DRAM\n"); - } - switch ((dpr->hw_config >> 5) & 3) - { - case 3: - fprintf(stderr, "Modem Module\n"); - break; - case 0: - break; - default: - fprintf(stderr, "??????????\n"); - } - switch ((dpr->hw_config >> 3) & 3) - { - case 3: - fprintf(stderr, "Telefon Module\n"); - break; - case 2: - fprintf(stderr, "X Interface\n"); - break; - case 0: - break; - default: - fprintf(stderr, "??????????\n"); - } - switch (dpr->hw_config & 7) - { - case 7: - fprintf(stderr, "S0 Module\n"); - break; - case 6: - fprintf(stderr, "Uk0 Module\n"); - break; - case 5: - fprintf(stderr, "Up0 Module\n"); - break; - case 0: - break; - default: - fprintf(stderr, "??????????\n"); - } - - fprintf(stderr, "Jumper:\n"); - fprintf(stderr, "COM%d\n", ((dpr->jmp_config >> 6) & 3) + 1); - fprintf(stderr, "DPRAM-IRQ"); - prtint((dpr->jmp_config >> 3) & 7); - fprintf(stderr, "COM-IRQ"); - prtint(dpr->jmp_config & 7); -} diff --git a/gnu/usr.sbin/isdn/dbg/dbg_3009.c b/gnu/usr.sbin/isdn/dbg/dbg_3009.c deleted file mode 100644 index eee5932..0000000 --- a/gnu/usr.sbin/isdn/dbg/dbg_3009.c +++ /dev/null @@ -1,151 +0,0 @@ -static char rcsid[] = "@(#)$Id: dbg_3009.c,v 1.1 1995/01/25 14:06:18 jkr Exp jkr $"; -/******************************************************************************* - * II - Version 0.1 $Revision: 1.1 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: dbg_3009.c,v $ - * - ******************************************************************************/ - -#include <stdio.h> -#include <sys/types.h> -#include <sys/ioctl.h> -#include <sys/file.h> -#include "../../../../sys/gnu/i386/isa/nic3009.h" - -static int -print_stat(status) -{ - if (status & 0x8A) - { - if (status & 0x80) - fprintf(stderr, "Software-Fehler\n"); - if (status & 8) - fprintf(stderr, "Hardware-Fehler\n"); - if (status & 2) - fprintf(stderr, "Fehler beim Selbsttest\n"); - } -} - -static int -prtint(i) -{ - switch (i) - { - case 0:fprintf(stderr, "5"); - break; - case 1: - fprintf(stderr, "4"); - break; - case 2: - fprintf(stderr, "3"); - break; - case 3: - fprintf(stderr, "2/9"); - break; - case 4: - fprintf(stderr, "7"); - break; - default: - fprintf(stderr, "??????????\n"); - } - fprintf(stderr, "\n"); -} - -static -mbx_analyse(mbx_type * mbx) -{ - printf("Type %x SubType %x no %x", mbx->type, mbx->subtype, mbx->number); - if (mbx->more_data) - printf(" more"); - printf(" len %d plci %x\n", mbx->data_len, mbx->plci); -} - -analyse_3009(dpr_type * dpr) -{ - fprintf(stderr, "card state %x hw conf %x ram conf %x\n", dpr->card_state - ,dpr->hw_config, dpr->ram_config); - print_stat(dpr->card_state); - if (dpr->card_state & 4) - fprintf(stderr, "Layer 1 not active\n"); - if (dpr->card_state & 0x10) - fprintf(stderr, "Date/Time not set\n"); - if (dpr->card_state & 0x20) - fprintf(stderr, "ENTITY not loaded\n"); - if (dpr->card_state & 0x40) - fprintf(stderr, "out of sync.\n"); - fprintf(stderr, "Hardware Configuration:\n"); - if (dpr->hw_config & 0x80) - fprintf(stderr, "No "); - /* - * fprintf(stderr,"DRAM-Module\n"); if(dpr->ram_config&1) - * fprintf(stderr,"256 KB SRAM\n"); switch(dpr->ram_config) { case 4: - * case 5: fprintf(stderr,"1 MB DRAM\n"); break; case 16: case 17: - * fprintf(stderr,"1 MB DRAM\n"); } - */ - switch ((dpr->hw_config >> 5) & 3) - { - case 3: - fprintf(stderr, "Modem Module\n"); - break; - case 0: - break; - default: - fprintf(stderr, "??????????\n"); - } - switch ((dpr->hw_config >> 3) & 3) - { - case 3: - fprintf(stderr, "Telefon Module\n"); - break; - case 2: - fprintf(stderr, "X Interface\n"); - break; - case 0: - break; - default: - fprintf(stderr, "??????????\n"); - } - switch (dpr->hw_config & 7) - { - case 7: - fprintf(stderr, "S0 Module\n"); - break; - case 6: - fprintf(stderr, "Uk0 Module\n"); - break; - case 5: - fprintf(stderr, "Up0 Module\n"); - break; - case 0: - break; - default: - fprintf(stderr, "??????????\n"); - } - if (dpr->up_mbx.msg_flag) - { - printf("Up Mailbox activ:\n"); - mbx_analyse(&dpr->up_mbx); - } - if (dpr->dn_mbx.msg_flag) - { - printf("Down Mailbox activ:\n"); - mbx_analyse(&dpr->dn_mbx); - } - if (dpr->up_mbx.msg_flag == 0) - { - printf("Up Mailbox not activ:\n"); - mbx_analyse(&dpr->up_mbx); - } - if (dpr->dn_mbx.msg_flag == 0) - { - printf("Down Mailbox not activ:\n"); - mbx_analyse(&dpr->dn_mbx); - } -} diff --git a/gnu/usr.sbin/isdn/dbg/dbg_5000.c b/gnu/usr.sbin/isdn/dbg/dbg_5000.c deleted file mode 100644 index 8711232..0000000 --- a/gnu/usr.sbin/isdn/dbg/dbg_5000.c +++ /dev/null @@ -1,136 +0,0 @@ -static char rcsid[] = "@(#)$Id: dbg_5000.c,v 1.1 1995/01/25 14:06:18 jkr Exp jkr $"; -/******************************************************************************* - * II - Version 0.1 $Revision: 1.1 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: dbg_5000.c,v $ - * - ******************************************************************************/ - -#include <stdio.h> -#include <sys/types.h> -#include <sys/ioctl.h> -#include <sys/file.h> - -static int -prtint(i) -{ - switch (i) - { - case 0:fprintf(stderr, "5"); - break; - case 1: - fprintf(stderr, "4"); - break; - case 2: - fprintf(stderr, "3"); - break; - case 3: - fprintf(stderr, "2/9"); - break; - case 4: - fprintf(stderr, "7"); - break; - default: - fprintf(stderr, "??????????\n"); - } - fprintf(stderr, "\n"); -} - -static int -print_stat(status) -{ - if (status & 0x8A) - { - if (status & 0x80) - fprintf(stderr, "Software-Fehler\n"); - if (status & 8) - fprintf(stderr, "Hardware-Fehler\n"); - if (status & 2) - fprintf(stderr, "Fehler beim Selbsttest\n"); - } -} - -analyse_5000(unsigned char *data) -{ - print_stat(data[1]); - - fprintf(stderr, "%x %x %x %x\n", data[1] - ,data[5], data[6], data[7]); - if (data[1] & 4) - fprintf(stderr, "Layer 1 not active\n"); - if (data[1] & 0x10) - fprintf(stderr, "Date/Time not set\n"); - if (data[1] & 0x20) - fprintf(stderr, "ENTITY not loaded\n"); - if (data[1] & 0x40) - fprintf(stderr, "out of sync.\n"); - fprintf(stderr, "Hardware Configuration:\n"); - if (data[5] & 0x80) - fprintf(stderr, "No "); - fprintf(stderr, "DRAM-Module\n"); - if (data[7] & 1) - fprintf(stderr, "256 KB SRAM\n"); - switch (data[7]) - { - case 4: - case 5: - fprintf(stderr, "1 MB DRAM\n"); - break; - case 16: - case 17: - fprintf(stderr, "1 MB DRAM\n"); - } - switch ((data[5] >> 5) & 3) - { - case 3: - fprintf(stderr, "Modem Module\n"); - break; - case 0: - break; - default: - fprintf(stderr, "??????????\n"); - } - switch ((data[5] >> 3) & 3) - { - case 3: - fprintf(stderr, "Telefon Module\n"); - break; - case 2: - fprintf(stderr, "X Interface\n"); - break; - case 0: - break; - default: - fprintf(stderr, "??????????\n"); - } - switch (data[5] & 7) - { - case 7: - fprintf(stderr, "S0 Module\n"); - break; - case 6: - fprintf(stderr, "Uk0 Module\n"); - break; - case 5: - fprintf(stderr, "Up0 Module\n"); - break; - case 0: - break; - default: - fprintf(stderr, "??????????\n"); - } - - fprintf(stderr, "Jumper:\n"); - fprintf(stderr, "COM%d\n", ((data[6] >> 6) & 3) + 1); - fprintf(stderr, "DPRAM-IRQ"); - prtint((data[6] >> 3) & 7); - fprintf(stderr, "COM-IRQ"); - prtint(data[6] & 7); -} diff --git a/gnu/usr.sbin/isdn/docs/INSTALL b/gnu/usr.sbin/isdn/docs/INSTALL deleted file mode 100644 index 9271e15..0000000 --- a/gnu/usr.sbin/isdn/docs/INSTALL +++ /dev/null @@ -1,50 +0,0 @@ -Installation notes for the ii ISDN Interface - for FreeBSD Release 1.0 - 08.Oct.1994 - -1. Login as root - -2. Use vipw to create a login isdn. It has to be an alias to root. - the login directory has to be /isdn: - isdn:*:0:0:Bourne-again Superuser:/isdn: - -3. The ISDN Interface supports the NICCY 3008 , NICCY 3009 and the - NICCY 5000. Please see /sys/i386/conf/LINT for more details on - how to enable a given ISDN adapter for your system. - -4. You have to edit some files for your local installation: -6.1 /usr/sbin/sisdn -6.2 /usr/share/isdn/isdn.ip -6.3 /etc/remote -6.4 /etc/ttys - -5. Install the new kernel and reboot your system. - -6. Login as isdn and start - sisdn - - -Configuration of NICCY 3008. - -The 3008 is an 8bit card. It uses shared memory and does not support or -is not supported by a 16bit card in the same 8 ( or 16K ) area of shared memory. - -As configured it is running using the I/O adress of COM3, Interupt 5 and -the shared memory at 0xde000. -But Interupt 5 is occupied by ne1000, ne2000 and WDxxxx ethernet cards. The -WDxxxx cards use shared memory in the 0xdxxxx region. - -That is why I configured the kernel for the 3008 to use COM3, interupt 2/9 -and shared memory at 0xe0000. You have to jumper: - -B7 B4a B4b B1a B1b B1c B1d - - -Problems with the NICCY 5000. - -The 5000 was constructed for the MAC. So it has this strange MAC-SCSI connector. -When connecting to an Adaptec you have to buy a cable which connects to MAC-SCSI -and a terminator for the MAC-SCSI. Be shure to terminate the SCSI-Bus -correctly !!!!!!!!!!!!!!!!!!!!!!!!!!! Older Versions of the NICCY will not run -on Adaptec with enabled boot rom. Disable boot rom or/and get a new set of -rom for the 5000. diff --git a/gnu/usr.sbin/isdn/docs/README b/gnu/usr.sbin/isdn/docs/README deleted file mode 100644 index 318df7e..0000000 --- a/gnu/usr.sbin/isdn/docs/README +++ /dev/null @@ -1,85 +0,0 @@ - II ISDN Interface - -The ii packet is an ISDN interface for FreeBSD 1.x and FreeBSD 2.0. -This is a first release. It is an idea. It will - hopefully - change a lot. -It supports the EDSS1 and the 1TR6 ISDN interfaces. -EDSS1 is the "Euro-ISDN", 1TR6 is the soon obsolete german ISDN Interface. - -Copyright: Its GNU Copyright see the File COPYRIGHT. - -It contains a set of driver's: - -Low level Drivers for Dr. Neuhaus NICCY 3008, 3009 and 5000 Cards. -An intermediate level isdn driver. -Some high level drivers for ip, tty, and telephone answering. - -The ip driver is rather stable. It is used to connect to the Internet. -The tty driver is completely experimental. There are a few of them, as -with every version of *BSD there is a new tty interface. -The telephone answering is quite stable. - -Some support programs: -Daemons to handle dialing and answering. -Programs to load the intelligent cards. -Debugging help. -Programs to listen to your answering machine with soundblaster. - -What can you do with it: -You may connect to the Internet through TCP/IP and a service provider -supporting PPP or SLIP through ISDN. - -You may build up your proper ISDN TCP/IP network. - -You may use the tty interface to dial in or out. - -You may have the Unix System answering your telephone. - -The packet here includes only sources. It will compile with FreeBSD 1.x, -FreeBSD 2.1. and an old version of NetBSD 0.9, - -Restrictions: -Only one interface card ( with 2 B-channels ) is supported. - -In work: -Low level driver for teles S0/NICCY 1000. A prototype is expected to be -distributed around easter 95. Will not include X75 B-Channel support -nor any Level-3 Protocols for the B-Channels. -A complete Implementation of ip (PPP, VJ). (Might come with teles stuff) -Better error handling specially for the tty driver. -A real telephone answering machine and more telephone support. -FAX support. - -Porting the system to Unix System V and SCO. -These versions will be commercial products. - -Todo: -Documentation and a lot other stuff. - -Rules: -We want the help of as many people as possible to develop the packet. -But if you develop something inside the packet or on top of the packet -you have to put the sources to the public domain or to GNU copyright. If -you distribute a binary packet on base of these sources you have to give -complete sources to your customer, the Internet community and us. - -We charge for support. We want to be payed if you need support. We earn our -living as consultants. We want to develop the packet. - -If you are a company or a service provider and want to use or distribute -the packet please contact one of us. We want and need your support. - -Binaries and Support: -This distribution includes sources only. You will get no free support. -If you want binaries and support contact: -jkr@saarlink.de -Juergen Krause, Buchenstr. 8, D-66497 Contwig/Stambach, Germany -+49 6336 993002 -+49 6336 993003 (fax) - -Acknowledgment: -Many thanks to the people at Dr. Neuhaus, Hamburg for their support. -Specially Klaus Muehle, Stefan Nerke and Daniel Piper. - -Dietmar Friede, Las Hayas, E-38870 Valle Gran Rey, Spain -dfriede@drnhh.neuhaus.de -+34 22 804181 (Tel./Fax) (9 to 16 WET at working days) diff --git a/gnu/usr.sbin/isdn/docs/copying.doc b/gnu/usr.sbin/isdn/docs/copying.doc deleted file mode 100644 index 3c68f02..0000000 --- a/gnu/usr.sbin/isdn/docs/copying.doc +++ /dev/null @@ -1,248 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 1, February 1989 - - Copyright (C) 1989 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The license agreements of most software companies try to keep users -at the mercy of those companies. By contrast, our General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. The -General Public License applies to the Free Software Foundation's -software and to any other program whose authors commit to using it. -You can use it for your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Specifically, the General Public License is designed to make -sure that you have the freedom to give away or sell copies of free -software, that you receive source code or can get it if you want it, -that you can change the software or use pieces of it in new free -programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of a such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must tell them their rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any program or other work which -contains a notice placed by the copyright holder saying it may be -distributed under the terms of this General Public License. The -"Program", below, refers to any such program or work, and a "work based -on the Program" means either the Program or any work containing the -Program or a portion of it, either verbatim or with modifications. Each -licensee is addressed as "you". - - 1. You may copy and distribute verbatim copies of the Program's source -code as you receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice and -disclaimer of warranty; keep intact all the notices that refer to this -General Public License and to the absence of any warranty; and give any -other recipients of the Program a copy of this General Public License -along with the Program. You may charge a fee for the physical act of -transferring a copy. - - 2. You may modify your copy or copies of the Program or any portion of -it, and copy and distribute such modifications under the terms of Paragraph -1 above, provided that you also do the following: - - a) cause the modified files to carry prominent notices stating that - you changed the files and the date of any change; and - - b) cause the whole of any work that you distribute or publish, that - in whole or in part contains the Program or any part thereof, either - with or without modifications, to be licensed at no charge to all - third parties under the terms of this General Public License (except - that you may choose to grant warranty protection to some or all - third parties, at your option). - - c) If the modified program normally reads commands interactively when - run, you must cause it, when started running for such interactive use - in the simplest and most usual way, to print or display an - announcement including an appropriate copyright notice and a notice - that there is no warranty (or else, saying that you provide a - warranty) and that users may redistribute the program under these - conditions, and telling the user how to view a copy of this General - Public License. - - d) You may charge a fee for the physical act of transferring a - copy, and you may at your option offer warranty protection in - exchange for a fee. - -Mere aggregation of another independent work with the Program (or its -derivative) on a volume of a storage or distribution medium does not bring -the other work under the scope of these terms. - - 3. You may copy and distribute the Program (or a portion or derivative of -it, under Paragraph 2) in object code or executable form under the terms of -Paragraphs 1 and 2 above provided that you also do one of the following: - - a) accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of - Paragraphs 1 and 2 above; or, - - b) accompany it with a written offer, valid for at least three - years, to give any third party free (except for a nominal charge - for the cost of distribution) a complete machine-readable copy of the - corresponding source code, to be distributed under the terms of - Paragraphs 1 and 2 above; or, - - c) accompany it with the information you received as to where the - corresponding source code may be obtained. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form alone.) - -Source code for a work means the preferred form of the work for making -modifications to it. For an executable file, complete source code means -all the source code for all modules it contains; but, as a special -exception, it need not include source code for modules which are standard -libraries that accompany the operating system on which the executable -file runs, or for standard header files or definitions files that -accompany that operating system. - - 4. You may not copy, modify, sublicense, distribute or transfer the -Program except as expressly provided under this General Public License. -Any attempt otherwise to copy, modify, sublicense, distribute or transfer -the Program is void, and will automatically terminate your rights to use -the Program under this License. However, parties who have received -copies, or rights to use copies, from you under this General Public -License will not have their licenses terminated so long as such parties -remain in full compliance. - - 5. By copying, distributing or modifying the Program (or any work based -on the Program) you indicate your acceptance of this license to do so, -and all its terms and conditions. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the original -licensor to copy, distribute or modify the Program subject to these -terms and conditions. You may not impose any further restrictions on the -recipients' exercise of the rights granted herein. - - 7. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of the license which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -the license, you may choose any version ever published by the Free Software -Foundation. - - 8. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to humanity, the best way to achieve this is to make it -free software which everyone can redistribute and change under these -terms. - - To do so, attach the following notices to the program. It is safest to -attach them to the start of each source file to most effectively convey -the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) 19yy <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19xx name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the -appropriate parts of the General Public License. Of course, the -commands you use may be called something other than `show w' and `show -c'; they could even be mouse-clicks or menu items--whatever suits your -program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - program `Gnomovision' (a program to direct compilers to make passes - at assemblers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/gnu/usr.sbin/isdn/docs/prot.1 b/gnu/usr.sbin/isdn/docs/prot.1 deleted file mode 100644 index c003b43..0000000 --- a/gnu/usr.sbin/isdn/docs/prot.1 +++ /dev/null @@ -1,11 +0,0 @@ -Supported protocolls are: -X X75 -u ui hdlc with UI frames -r raw hdlc without anything -C BTX-X75 german CEPT X75 stuff -t tel ISDN and a/b telefon -I ISDN telefon -a a/b a/b telefon - -No tricks and thrills. I do not need T70 or other level 3 protocols. -I use IP. diff --git a/gnu/usr.sbin/isdn/iid/Changes b/gnu/usr.sbin/isdn/iid/Changes deleted file mode 100644 index 49b1bbb..0000000 --- a/gnu/usr.sbin/isdn/iid/Changes +++ /dev/null @@ -1,27 +0,0 @@ -1c1 -< static char rcsid[] = "@(#)$Id: iid.c,v 1.1 1994/12/19 07:25:48 jkr Exp $"; ---- -> static char rcsid[] = "@(#)$Id: iid.c,v 1.2 1994/12/22 16:53:13 jkr Exp $"; -3c3 -< * ISDN System - $Revision: 1.1 $ $State: Exp $ ---- -> * ISDN System - $Revision: 1.2 $ $State: Exp $ -13a14,17 -> * Revision 1.2 1994/12/22 16:53:13 jkr -> * changes for rescan/signal -> * next_lno = next_dno = 0 -> * -17,19d20 -< * Revision 1.1 1994/12/16 19:39:44 jkr -< * Initial revision first check in -< * -96a98 -> next_lno = next_dno = 0; /* jkr*/ -186a189,191 -> #ifdef TEST -> fprintf(stderr,"DIAL-NR:%s\n",p+1); -> #endif -203a209,211 -> #ifdef TEST -> fprintf(stderr,"LIST-NR:%s\n",p+1); -> #endif diff --git a/gnu/usr.sbin/isdn/iid/Makefile b/gnu/usr.sbin/isdn/iid/Makefile deleted file mode 100644 index 243bf21..0000000 --- a/gnu/usr.sbin/isdn/iid/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -PROG= iid -CFLAGS+= -DBSD -O - -.include <bsd.prog.mk> diff --git a/gnu/usr.sbin/isdn/iid/iid.1 b/gnu/usr.sbin/isdn/iid/iid.1 deleted file mode 100644 index ab2112f..0000000 --- a/gnu/usr.sbin/isdn/iid/iid.1 +++ /dev/null @@ -1,62 +0,0 @@ -.\" Copyright (c) 1994 Dietmar Friede -.Dd September 15, 1994 -.Os BSD -.Dt "ISDN iid" 1 -.Sh NAME -.Nm iid -.Nd ISDN ip daemon -.Sh SYNOPSIS -.Nm iid -[ -F ] [ -c file ] [ -l file ] - --F do not fork - --c file use file as source of the configuration (default /etc/isdn.ip) - --l file use file as logfile (default /var/log/isdn.ip) - -.Sh DESCRIPTION -Die Form der Konfigurationdatei /etc/isdn.ip wird, -bis ich das mit dem Euro ISDN verstanden hab: - -1. Zeile beschreibt auf welcher Nummer (Subadresse, "EAZ") der Treiber hoert: - -An: - -Bedeutet Adresse n ("EAZ" n). - -Die folgenden Zeilen beschreiben jeweils ein Interface (ii0 - iin) - -0:d102:l102:pu:m1500:s1502:w10: -1:d133:d132:l133:pr:m500:s500:w0: -2:d134:l134:l123:pX:a3:m2048:s2048:w600: -3:d334:d335:l334:l323:pC:m1000:s1000:w30: - -Wobei die erste Spalte die Nummer des Interfaces ist. - -dn dial n waehle die Nummer n - -an adress a benutz beim Waehlen 'n' als Suffix der eigenen Adresse - -ln listen n hoere auf der Nummer n - -px protocoll x siehe oben. - -wn wait n Haeng auf wenn n Sekunden nichts uebertragen wurde, n = 0 haeng nicht auf. - -mn mtu n die maximale IP Uebertagungslaenge wird n - -sm size m Pufferlaenge der ISDN-Karte sm >= mn bei UI sm >= mn+2 - -Wobei das Maximum 2048 ist. - -Das direkte IP ISDN Interface funktioniert nur wenn, die anrufende -Gegenstelle sich mit ihrer Nummer identifiziert. Mit Hilfe dieser Nummer -wird dann das Interface iin ausgewaehlt. - -Als Protokoll wird HDLC mit UI-frames (u), HDLC roh (r), X75 (X) und BTX-X75 (C) -unterstuetzt. - -Falls irgendein Hacker gerne irgend eine andere Methode moechte sei sie -auf das tty Interface verwiesen. Nach normalen login kann dort -slip benutzt werden. Es ist keine weitere Idendifikation noetig. diff --git a/gnu/usr.sbin/isdn/iid/iid.c b/gnu/usr.sbin/isdn/iid/iid.c deleted file mode 100644 index 11b8c36..0000000 --- a/gnu/usr.sbin/isdn/iid/iid.c +++ /dev/null @@ -1,464 +0,0 @@ -static char rcsid[] = "@(#)$Id: iid.c,v 1.4 1995/01/25 13:42:33 jkr Exp jkr $"; -/******************************************************************************* - * II - Version 0.1 $Revision: 1.4 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: iid.c,v $ - * - ******************************************************************************/ - -/* ISDN IP Daemon */ -/* It handles dial and accept requests for ISDN-IP Connections */ - -#include <sys/types.h> -#include <stdio.h> -#include <signal.h> -#include <errno.h> -#include <setjmp.h> -#include <string.h> -#include <stdlib.h> -#include <ctype.h> -#include <sys/ioctl.h> -#include <sys/file.h> -#include "../../../../sys/gnu/isdn/isdn_ioctl.h" -#define min(a,b) ((a)<(b)?(a):(b)) - -#define NII 4 -#define N_NO (4*NII) - -telno_t dial_no[N_NO]; - -struct no -{ - u_char from, n; -} no[NII]; - -struct listen_no -{ - u_short ap; - telno_t t; -} listen_no[N_NO]; - -listen_t listen; -dial_t dial[NII]; -isdn_param ip[NII]; - -int next_lno, next_dno; - -int dofork = 1; -int quit = 0, rescan = 0; -jmp_buf context; -char *logfile = "/var/log/isdn.ip"; -char *configfile = "/etc/isdn.ip"; - -int subadr, prot, timeout, bsize, spv, ui, serv; -int def_subadr = 1; -int ind, rind; -char rbuf[2048]; -unsigned short si_mask; - -void -catchsig() -{ - quit++; - longjmp(context, 1); -} - -void -catchsighup() -{ - rescan++; - (void) signal(SIGHUP, catchsighup); - longjmp(context, 1); -} - -setdefault() -{ - subadr = -1; - prot = 2; - ui = 1; - serv = 7; - timeout = 600; - bsize = 2048; - spv = 0; - next_lno = next_dno = 0;/* jkr */ -} - -char * -gettoc() -{ - if (rind == -1) - { - rind = 0; - return (rbuf); - } - while (rbuf[++rind]); - rind++; - - if (rind >= ind) - return (NULL); - - return (&rbuf[rind]); -} - -filline(FILE * f) -{ - int c; - - ind = 1; - rbuf[0] = 'H'; - - while ((c = fgetc(f)) != EOF) - { - if (isalnum(c)) - { - rbuf[ind++] = c; - } else - switch (c) - { - case '#': - fgets(rbuf + ind, 2048 - ind, f); - if (ind == 1) - break; - /* Fall through */ - case '\n': - rbuf[ind] = 0; - rind = -1; - return (0); - case ':': - rbuf[ind++] = 0; - break; - } - } - if (ind > 1) - return (0); - return (EOF); -} - -process(FILE * f, int n) -{ - char *p; - int ap = 0; - telno_t *t; - - setdefault(); - - no[ap].from = no[ap].n = 0; - while (filline(f) != EOF) - { - while ((p = gettoc()) != NULL) - switch (p[0]) - { - case 'A': - def_subadr = p[1] - '0'; - listen.subadr_mask |= 1 << def_subadr; - break; - case 'a': - subadr = p[1] - '0'; - break; - case 'd': - if (next_dno >= N_NO) - { - fprintf(stderr, "Too many numbers to dial\n"); - exit(1); - } - t = &dial_no[next_dno++]; - no[ap].n++; - t->length = strlen(p + 1) + 1; - if (t->length > 123) - { - fprintf(stderr, "ISDN number too long\n"); - exit(1); - } - t->no[0] = 0x81; - strncpy(&t->no[1], p + 1, t->length); - break; - case 'l': - if (next_lno >= N_NO) - { - fprintf(stderr, "Too many numbers to listen\n"); - exit(1); - } - listen_no[next_lno].ap = ap; - t = &listen_no[next_lno++].t; - t->length = strlen(p + 1) + 1; - if (t->length > 123) - { - fprintf(stderr, "ISDN number too long\n"); - exit(1); - } - t->no[0] = 0x81; - strncpy(&t->no[1], p + 1, t->length); - break; - case 'p': - switch (p[1]) - { - case 'r': - serv = 7; - prot = 2; - ui = 0; - break; - case 'u': - serv = 7; - prot = 2; - ui = 1; - break; - case 'X': - serv = 7; - prot = 1; - ui = 0; - break; - case 'C': - serv = 15; - prot = 5; - ui = 0; - break; - default: - fprintf(stderr, "Protocoll not supported\n"); - exit(1); - } - break; - case 'w': - timeout = atoi(p + 1); - break; - case 's': - bsize = atoi(p + 1); - break; - case 'S': - spv++; - break; - default: - } - fillparam(ap, &ip[ap], &dial[ap]); - if (ioctl(n, ISDN_SET_PARAM, &ip[ap]) < 0) - { - perror("ioctl: Set Param"); - exit(3); - } - setdefault(); - ap++; - no[ap].from = next_dno; - no[ap].n = 0; - } - listen.si_mask = si_mask; - if (listen.subadr_mask == 0) - listen.subadr_mask |= 1 << def_subadr; - listen.inf_mask = 3; - listen.ctrl = 0; - if (ioctl(n, ISDN_LISTEN, &listen) < 0) - { - perror("ioctl: Listen"); - exit(4); - } -} - -fillparam(int ap, isdn_param * ip, dial_t * d) -{ - if (subadr == -1) - subadr = def_subadr; - si_mask |= (u_short) (1 << serv); - /* - * spv = 0; - */ - bzero(ip, sizeof(isdn_param)); - bzero(d, sizeof(dial_t)); - d->appl = ip->appl = ap; - d->b_channel = 0x83; - d->inf_mask = 3; - d->out_serv = serv; - d->src_subadr = '0' + subadr; - ip->dlpd.protokoll = prot; - ip->dlpd.length = 7; - ip->dlpd.data_length = bsize; - ip->timeout = timeout; - ip->prot = ui; - ip->ncpd.protokoll = 4; -} - -void -main(int argc, char **argv) -{ - FILE *f; - int a, n, i; - u_char buf[4]; - - dofork = 1; - - while ((i = getopt(argc, argv, "c:l:F")) != EOF) - switch (i) - { - default: - fprintf(stderr, "Usage: iid [ -F ] [ -c configfile ] [ -l logfile ]\n"); - exit(1); - case 'c': - configfile = optarg; - break; - case 'l': - logfile = optarg; - break; - case 'F': - dofork = 0; - break; - } - - if (dofork) - { - if ((i = fork()) < 0) - { - fprintf(stderr, "Can't fork, %m"); - exit(1); - } - if (i > 0) - exit(0); - } /* running as daemon now */ - if (freopen(logfile, "a", stderr) == NULL) - { - perror(logfile); - exit(1); - } - if ((n = open("/dev/isdn", O_RDWR)) < 0) - { - perror("open: /dev/isdn"); - exit(1); - } - if ((f = fopen(configfile, "r")) == NULL) - { - perror(configfile); - exit(1); - } - process(f, n); - fclose(f); - - (void) signal(SIGHUP, catchsighup); - - (void) signal(SIGTERM, catchsig); - (void) signal(SIGKILL, catchsig); - (void) signal(SIGINT, catchsig); - (void) signal(SIGQUIT, catchsig); - - rescan = quit = 0; - fprintf(stderr, "s:iid started\n"); - fflush(stderr); - while (1) - { - int l; - int an, cn, serv, serv_add, subadr; - int typ, nl, dl; - char *tn; - - (void) setjmp(context); - if ((l = read(n, rbuf, 1024)) > 0) - { - switch (rbuf[0]) - { - case 'a': - sscanf(rbuf + 2, "%d %d %d %d %d %d %d %n", - &an, &cn, &serv, &serv_add, &subadr, &typ, &nl, &l); - l += 2; - buf[0] = cn; - buf[1] = find_appl(an, rbuf + l); - buf[2] = buf[3] = 0; - if (buf[1] == 0xff) - { - buf[2] = 0x3e; /* call reject */ - } - if (ioctl(n, ISDN_ACCEPT, &buf) < 0) - { - perror("ioctl: Accept"); - } - if (buf[1] == 0xff) - fprintf(stderr, "r:%d:%s\n", an, rbuf + l); - else - fprintf(stderr, "a:%d:%s\n", an, rbuf + l); - break; - case 'd': - sscanf(rbuf + 2, "%d", &an); - dial[an].ctrl = 0; - dial[an].appl = an; - if (no[an].n) - dial[an].telno = dial_no[no[an].from]; - else - { - fprintf(stderr, "cannot dial %d\n", an); - break; - } - if (ioctl(n, ISDN_DIAL, &dial[an]) < 0) - { - perror("ioctl: Dial"); - } - fprintf(stderr, "d:%d:%s\n", an, &dial[an].telno.no[1]); - break; - case 'i': - sscanf(rbuf + 2, "%d %d %d %n", &an, &typ, &nl, &l); - fprintf(stderr, "i:%d:%x:%s\n", an, typ, rbuf + l + 2); - switch (typ) - { - case 2: - break; - } - break; - case 'C': - sscanf(rbuf + 2, "%d %d %d", &an, &cn, &dl); - if (dl) - { - buf[0] = cn; - buf[1] = an; - buf[2] = 0; - if (ioctl(n, ISDN_ACCEPT, buf) < 0) - { - perror("ioctl: Accept"); - } - } - fprintf(stderr, "C:%d:%d\n", an, cn); - break; - case 'D': - sscanf(rbuf + 2, "%d %d", &an, &cn); - fprintf(stderr, "D:%d:%d\n", an, cn); - break; - default: - break; - } - } - if (quit) - { - fprintf(stderr, "s:Quit\n"); - exit(0); - } - if (rescan) - { - fprintf(stderr, "s:rescan\n"); - rescan = 0; - if ((f = fopen(configfile, "r")) == NULL) - perror(configfile); - else - { - process(f, n); - fclose(f); - } - } - fflush(stderr); - } -} - -int -find_appl(int an, u_char * b) -{ - int i; - char *tn; - - for (i = 0; i < next_lno; i++) - { - if (((tn = strstr(b, &listen_no[i].t.no[1])) != NULL) - && (strcmp(&listen_no[i].t.no[1], tn) == 0)) - return (listen_no[i].ap); - } - - fprintf(stderr, "I?:%d:%s\n", an, b); - return (-1); -} diff --git a/gnu/usr.sbin/isdn/ispy/Makefile b/gnu/usr.sbin/isdn/ispy/Makefile deleted file mode 100644 index 7ac4a9a..0000000 --- a/gnu/usr.sbin/isdn/ispy/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -PROG= ispy -NOMAN= yes -CFLAGS+= -DBSD -O - -.include <bsd.prog.mk> diff --git a/gnu/usr.sbin/isdn/ispy/ispy.c b/gnu/usr.sbin/isdn/ispy/ispy.c deleted file mode 100644 index 5c2ac5a..0000000 --- a/gnu/usr.sbin/isdn/ispy/ispy.c +++ /dev/null @@ -1,43 +0,0 @@ -static char rcsid[] = "@(#)$Id: ispy.c,v 1.2 1995/01/25 13:41:55 jkr Exp jkr $"; -/******************************************************************************* - * II - Version 0.1 $Revision: 1.2 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: ispy.c,v $ - * - ******************************************************************************/ - -#include <sys/types.h> -#include <stdio.h> -#include <stdlib.h> -#include <time.h> -#include <sys/ioctl.h> -#include <sys/file.h> -#include "../../../../sys/gnu/i386/isa/niccyreg.h" - -void -main(int argc, char **argv) -{ - int f; - int v; - - if ((f = open("/dev/nic0", O_RDWR)) < 0) - { - perror("open"); - exit(1); - } - v = 0; - if (argc > 1) - v = atoi(argv[1]); - - if (ioctl(f, NICCY_SPY, &v) < 0) - { - perror("ioctl"); - } -} diff --git a/gnu/usr.sbin/isdn/itel/Makefile b/gnu/usr.sbin/isdn/itel/Makefile deleted file mode 100644 index f7da3f3..0000000 --- a/gnu/usr.sbin/isdn/itel/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -PROG= iteld -CFLAGS+= -DBSD -O -NOMAN= yes - -.include <bsd.prog.mk> diff --git a/gnu/usr.sbin/isdn/itel/iteld.c b/gnu/usr.sbin/isdn/itel/iteld.c deleted file mode 100644 index 8df099c..0000000 --- a/gnu/usr.sbin/isdn/itel/iteld.c +++ /dev/null @@ -1,234 +0,0 @@ -static char rcsid[] = "@(#)$Id: iteld.c,v 1.2 1995/01/25 13:58:28 jkr Exp jkr $"; -/******************************************************************************* - * II - Version 0.1 $Revision: 1.2 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: iteld.c,v $ - * - ******************************************************************************/ - -/* This is a ISDN-Daemon */ -/* It accepts ISDN-Telefon calls */ - -#include <sys/types.h> -#include <stdio.h> -#include <signal.h> -#include <errno.h> -#include <setjmp.h> -#include <string.h> -#include <stdlib.h> -#include <ctype.h> -#include <sys/ioctl.h> -#include <sys/file.h> -#include "../../../../sys/gnu/isdn/isdn_ioctl.h" -#define min(a,b) ((a)<(b)?(a):(b)) - -#define NITEL 1 -#define NR_RINGS 10 -#define ANSWER_NUM 2 /* which number we use */ -#define TEL_LOG_FILE "/var/log/isdn.tel" - -listen_t listen; -isdn_param ip; - -int dofork = 1; -int quit = 0; -int def_subadr = 2; -jmp_buf context; -char *logfile = TEL_LOG_FILE; - -struct answ -{ - char occupied; - u_char an, cn; - char no[15]; -} answ[NITEL]; - -int ind, rind; -char rbuf[2048]; - -void -catchsig() -{ - quit++; - longjmp(context, 1); -} - -process(int n) -{ - fillparam(0, &ip, &listen); - if (ioctl(n, ISDN_SET_PARAM, &ip) < 0) - { - perror("ioctl: Set Param"); - exit(3); - } - if (ioctl(n, ISDN_LISTEN, &listen) < 0) - { - perror("ioctl: Listen"); - exit(4); - } -} - -fillparam(int ap, isdn_param * ip, listen_t * t) -{ - - bzero(ip, sizeof(isdn_param)); - bzero(t, sizeof(listen_t)); - t->appl = ip->appl = ap; - t->ctrl = 0; - t->inf_mask = 3; - t->subadr_mask = (u_short) 0x3ff; - t->si_mask = (u_short) 6; - ip->dlpd.protokoll = 3; - ip->dlpd.length = 7; - ip->dlpd.data_length = 1024; - ip->timeout = 60; - ip->prot = 0; - ip->ncpd.protokoll = 4; -} - -void -main(int argc, char **argv) -{ - FILE *f; - int a, n, i; - - dofork = 1; - - while ((i = getopt(argc, argv, "c:l:F")) != EOF) - switch (i) - { - default: - fprintf(stderr, "Usage: itel [ -F ] [ -l logfile ]\n"); - exit(1); - case 'l': - logfile = optarg; - break; - case 'F': - dofork = 0; - break; - } - - if (dofork) - { - if ((i = fork()) < 0) - { - fprintf(stderr, "Can't fork, %m"); - exit(1); - } - if (i > 0) - exit(0); - } /* running as daemon now */ - if (freopen(logfile, "a", stderr) == NULL) - { - perror(logfile); - exit(1); - } - if ((n = open("/dev/isdn2", O_RDWR)) < 0) - { - perror("open: /dev/isdn2"); - exit(1); - } - process(n); - - (void) signal(SIGHUP, catchsig); - (void) signal(SIGTERM, catchsig); - (void) signal(SIGKILL, catchsig); - (void) signal(SIGINT, catchsig); - (void) signal(SIGQUIT, catchsig); - - quit = 0; - fprintf(stderr, "s:iteld started\n"); - fflush(stderr); - while (1) - { - int l; - int an, cn, serv, serv_add, subadr; - int typ, nl, dl; - char *tn; - u_char buf[4]; - u_char telnum[128]; - - (void) setjmp(context); - if ((l = read(n, rbuf, 1024)) > 0) - { - switch (rbuf[0]) - { - case 'a': - sscanf(rbuf + 2, "%d %d %d %d %d %d %d %n", - &an, &cn, &serv, &serv_add, &subadr, &typ, &nl, &l); - l += 2; - buf[0] = cn; - buf[1] = find_appl(); - buf[2] = buf[3] = 0; - if (buf[1] == 0xff) - { - buf[2] = 0x3e; /* call reject */ - fprintf(stderr, "iteld: No Application\n"); - } - if (ioctl(n, ISDN_ACCEPT, &buf) < 0) - { - perror("ioctl: Accept"); - } - if (buf[1] == 0xff) - fprintf(stderr, "r:%d:%s\n", an, rbuf + l); - else - fprintf(stderr, "a:%d:%s\n", an, rbuf + l); - break; - case 'd': - fprintf(stderr, " s:dialing?i\n"); - break; - case 'i': - sscanf(rbuf + 2, "%d %d %d %n", &an, &typ, &nl, &l); - fprintf(stderr, "i:%d:%x:%s\n", an, typ, rbuf + l + 2); - break; - case 'C': - sscanf(rbuf + 2, "%d %d %d", &an, &cn, &dl); - if (dl) - break; - fprintf(stderr, "C:%d:%d\n", an, cn); - if (subadr == def_subadr) - /* jkr */ - system("/isdn/lib/answ >/dev/null 2>&1 &"); - break; - case 'D': - sscanf(rbuf + 2, "%d %d", &an, &cn); - answ[0].occupied = 0; - fprintf(stderr, "D:%d:%d\n", an, cn); - break; - default: - break; - } - } - if (quit) - { - fprintf(stderr, "s:Quit\n"); - exit(0); - } - fflush(stderr); - } -} - -int -find_appl() -{ - int i; - struct answ *a; - - for (i = 0; i < NITEL; i++) - { - a = &answ[i]; - if (a->occupied == 0) - { - a->occupied = 1; - return (i); - } - } - return (-1); -} diff --git a/gnu/usr.sbin/isdn/ittd/Makefile b/gnu/usr.sbin/isdn/ittd/Makefile deleted file mode 100644 index ef31c48..0000000 --- a/gnu/usr.sbin/isdn/ittd/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -PROG= ittd -CFLAGS+= -DBSD -O -NOMAN= yes - -.include <bsd.prog.mk> diff --git a/gnu/usr.sbin/isdn/ittd/ittd.1 b/gnu/usr.sbin/isdn/ittd/ittd.1 deleted file mode 100644 index 431808e..0000000 --- a/gnu/usr.sbin/isdn/ittd/ittd.1 +++ /dev/null @@ -1,39 +0,0 @@ -.\" Copyright (c) 1994 Dietmar Friede -.Dd September 15, 1994 -.Os BSD -.Dt "ISDN ittd" 1 -.Sh NAME -.Nm ittd -.Nd ISDN tty daemon -.Sh SYNOPSIS -.Nm ittd -[ -F ] [ -c file ] [ -l file ] - --F do not fork - --c file use file as source of the configuration (default /etc/isdn.itt) - --l file use file as logfile (default /var/log/isdn.itt) - -.Sh DESCRIPTION -Die Form der Konfigurationdatei /etc/isdn.itt wird, -bis ich das mit dem Euro ISDN verstanden hab: - -Der File besteht aus einer Zeile: - -A1:pr:w100: - -An Bedeutet Subadresse n ("EAZ" n). - -px protocoll x siehe oben. - -wn wait n Haeng auf wenn n Sekunden nichts uebertragen wurde, n = 0 haeng nicht auf. - -mn mtu n die maximale IP Uebertagungslaenge wird n - -sm size m Pufferlaenge der ISDN-Karte sm >= mn bei UI sm >= mn+2 - -Wobei das Maximum 2048 ist. - -Als Protokoll wird HDLC mit UI-frames (u), HDLC roh (r), X75 (X) und BTX-X75 (C) -unterstuetzt. diff --git a/gnu/usr.sbin/isdn/ittd/ittd.c b/gnu/usr.sbin/isdn/ittd/ittd.c deleted file mode 100644 index efb152a7..0000000 --- a/gnu/usr.sbin/isdn/ittd/ittd.c +++ /dev/null @@ -1,526 +0,0 @@ -static char rcsid[] = "@(#)$Id: ittd.c,v 1.2 1995/01/25 14:01:28 jkr Exp jkr $"; -/******************************************************************************* - * II Version 0.1 - $Revision: 1.2 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: ittd.c,v $ - * - ******************************************************************************/ - -/* This is a ISDN-Daemon for tty dialin */ - -#include <sys/types.h> -#include <stdio.h> -#include <signal.h> -#include <errno.h> -#include <setjmp.h> -#include <string.h> -#include <stdlib.h> -#include <ctype.h> -#include <unistd.h> -#include <sys/ioctl.h> -#include <sys/file.h> -#include "../../../../sys/gnu/isdn/isdn_ioctl.h" -#define min(a,b) ((a)<(b)?(a):(b)) - -#define NITTY 2 -#define NOTTY 2 -#define NTTY (NITTY + NOTTY) - -listen_t listen; -isdn_param ip[NTTY]; -dial_t dial[NOTTY]; - -struct iline -{ - char occupied; - u_char an, cn; - char no[15]; -} iline[NTTY]; - -int dofork = 1; -int quit = 0, rescan = 0; -jmp_buf context; -char *logfile = "/var/log/isdn.itt"; -char *configfile = "/etc/isdn.itt"; - -int subadr, prot, bsize, timeout, spv, ui, serv; -int def_subadr = 3; -int ind, rind; -char rbuf[2048]; -unsigned short si_mask; - -void -catchsig() -{ - quit++; - longjmp(context, 1); -} - -void -catchsighup() -{ - rescan++; - (void) signal(SIGHUP, catchsighup); - longjmp(context, 1); -} - -setdefault() -{ - subadr = -1; - prot = 2; - ui = 1; - serv = 7; - timeout = 0; - bsize = 2048; - spv = 0; -} - -char * -gettoc() -{ - if (rind == -1) - { - rind = 0; - return (rbuf); - } - while (rbuf[++rind]); - rind++; - - if (rind >= ind) - return (NULL); - - return (&rbuf[rind]); -} - -filline(FILE * f) -{ - int c; - - ind = 1; - rbuf[0] = 'H'; - - while ((c = fgetc(f)) != EOF) - { - if (isalnum(c)) - { - rbuf[ind++] = c; - } else - switch (c) - { - case '#': - fgets(rbuf + ind, 2048 - ind, f); - if (ind == 1) - break; - /* Fall through */ - case '\n': - rbuf[ind] = 0; - rind = -1; - return (0); - case ':': - rbuf[ind++] = 0; - break; - } - } - if (ind > 1) - return (0); - return (EOF); -} - -process(FILE * f, int n) -{ - char *p; - int ap = 0; - - setdefault(); - - if (filline(f) != EOF) - { - while ((p = gettoc()) != NULL) - switch (p[0]) - { - case 'A': - def_subadr = p[1] - '0'; - listen.subadr_mask |= 1 << def_subadr; - break; - case 'p': - switch (p[1]) - { - case 'r': - serv = 7; - prot = 2; - ui = 0; - break; - case 'u': - serv = 7; - prot = 2; - ui = 1; - break; - case 'X': - serv = 7; - prot = 1; - ui = 0; - break; - case 'C': - serv = 15; - prot = 5; - ui = 0; - break; - default: - fprintf(stderr, "Protocoll not supported\n"); - exit(1); - } - break; - case 'w': - timeout = atoi(p + 1); - break; - case 's': - bsize = atoi(p + 1); - break; - case 'S': - spv++; - break; - default: - } - } - for (ap = 0; ap < NTTY; ap++) - { - fillparam(ap, &ip[ap]); - if (ioctl(n, ISDN_SET_PARAM, &ip[ap]) < 0) - { - perror("ioctl: Set Param"); - exit(3); - } - } - - listen.si_mask = si_mask; - if (listen.subadr_mask == 0) - listen.subadr_mask |= 1 << def_subadr; - listen.inf_mask = 3; - listen.ctrl = 0; - - if (ioctl(n, ISDN_LISTEN, &listen) < 0) - { - perror("ioctl: Listen"); - exit(4); - } -} - -fillparam(int ap, isdn_param * ip) -{ - if (subadr == -1) - subadr = def_subadr; - si_mask |= (u_short) (1 << serv); - /* - * spv = 0; - */ - bzero(ip, sizeof(isdn_param)); - ip->appl = ap; - ip->dlpd.protokoll = prot; - ip->dlpd.length = 7; - ip->dlpd.data_length = bsize; - ip->timeout = timeout; - ip->prot = ui; - ip->ncpd.protokoll = 4; -} - -realine(char *b) -{ - int c; - - ind = 0; - - while (c = *b & 0x7f) - { - b++; - if (isalnum(c)) - { - rbuf[ind++] = c; - } else if (c == '.') - rbuf[ind++] = 0; - } - if (ind > 1) - return (0); - return (EOF); -} - -process_dial(int n, int ap, char *b) -{ - char *p; - telno_t *t; - - setdefault(); - - if (realine(b) == EOF) - return; - - rind = -1; - - while ((p = gettoc()) != NULL) - { - switch (p[0]) - { - case 'a': - subadr = p[1] - '0'; - break; - case 'd': - t = &dial[ap - NITTY].telno; - t->length = strlen(p + 1) + 1; - if (t->length > 123) - { - fprintf(stderr, "ISDN number too long\n"); - exit(1); - } - t->no[0] = 0x81; - strncpy(&t->no[1], p + 1, t->length); - break; - case 'p': - switch (p[1]) - { - case 'r': - serv = 7; - prot = 2; - ui = 0; - break; - case 'u': - serv = 7; - prot = 2; - ui = 1; - break; - case 'X': - serv = 7; - prot = 1; - ui = 0; - break; - case 'C': - serv = 15; - prot = 5; - ui = 0; - break; - default: - fprintf(stderr, "Protocoll not supported\n"); - exit(1); - } - break; - case 'w': - timeout = atoi(p + 1); - break; - case 's': - bsize = atoi(p + 1); - break; - case 'S': - spv++; - break; - default: - } - } - filldial(ap, &ip[ap], &dial[ap - NITTY]); - if (ioctl(n, ISDN_SET_PARAM, &ip[ap]) < 0) - { - perror("ioctl: Set Param"); - exit(3); - } -} - -filldial(int ap, isdn_param * ip, dial_t * d) -{ - if (subadr == -1) - subadr = def_subadr; - /* - * spv = 0; - */ - bzero(ip, sizeof(isdn_param)); - d->appl = ip->appl = ap; - d->b_channel = 0x83; - d->inf_mask = 3; - d->out_serv = serv; - d->src_subadr = '0' + subadr; - ip->dlpd.protokoll = prot; - ip->dlpd.length = 7; - ip->dlpd.data_length = bsize; - ip->timeout = timeout; - ip->prot = ui; - ip->ncpd.protokoll = 4; -} - -void -main(int argc, char **argv) -{ - FILE *f; - int a, n, i; - u_char buf[4]; - - dofork = 1; - - while ((i = getopt(argc, argv, "c:l:F")) != EOF) - switch (i) - { - default: - fprintf(stderr, "Usage: ittd [ -F ] [ -c configfile ] [ -l logfile ]\n"); - exit(1); - case 'c': - configfile = optarg; - break; - case 'l': - logfile = optarg; - break; - case 'F': - dofork = 0; - break; - } - - if (dofork) - { - if ((i = fork()) < 0) - { - fprintf(stderr, "Can't fork, %m"); - exit(1); - } - if (i > 0) - exit(0); - } /* running as daemon now */ - if (freopen(logfile, "a", stderr) == NULL) - { - perror(logfile); - exit(1); - } - if ((n = open("/dev/isdn1", O_RDWR)) < 0) - { - perror("open: /dev/isdn1"); - exit(1); - } - if ((f = fopen(configfile, "r")) == NULL) - { - perror(configfile); - exit(1); - } - process(f, n); - fclose(f); - - (void) signal(SIGHUP, catchsighup); - - (void) signal(SIGTERM, catchsig); - (void) signal(SIGKILL, catchsig); - (void) signal(SIGINT, catchsig); - (void) signal(SIGQUIT, catchsig); - - rescan = quit = 0; - fprintf(stderr, "s:ittd started\n"); - fflush(stderr); - while (1) - { - int l; - int an, cn, serv, serv_add, subadr; - int typ, nl, dl; - char *tn; - - (void) setjmp(context); - if ((l = read(n, rbuf, 1024)) > 0) - { - switch (rbuf[0]) - { - case 'a': - sscanf(rbuf + 2, "%d %d %d %d %d %d %d %n", - &an, &cn, &serv, &serv_add, &subadr, &typ, &nl, &l); - l += 2; - buf[0] = cn; - buf[1] = find_appl(); - buf[2] = buf[3] = 0; - if (buf[1] == 0xff) - { - buf[2] = 0x3e; /* call reject */ - } - if (ioctl(n, ISDN_ACCEPT, &buf) < 0) - { - perror("ioctl: Accept"); - } - if (buf[1] == 0xff) - fprintf(stderr, "r:%d:%s\n", an, rbuf + l); - else - fprintf(stderr, "a:%d:%s\n", an, rbuf + l); - break; - case 'i': - sscanf(rbuf + 2, "%d %d %d %n", &an, &typ, &nl, &l); - fprintf(stderr, "i:%d:%x:%s\n", an, typ, rbuf + l + 2); - switch (typ) - { - case 2: - break; - } - break; - case 'C': - sscanf(rbuf + 2, "%d %d %d", &an, &cn, &dl); - if (dl) - { - buf[0] = cn; - buf[1] = an; - buf[2] = 0; - if (ioctl(n, ISDN_ACCEPT, buf) < 0) - { - perror("ioctl: Accept"); - } - } - fprintf(stderr, "C:%d:%d\n", an, cn); - break; - case 'D': - sscanf(rbuf + 2, "%d %d", &an, &cn); - iline[an].occupied = 0; - fprintf(stderr, "D:%d:%d\n", an, cn); - break; - case 'M': - sscanf(rbuf + 2, "%d %n", &an, &l); - process_dial(n, an, rbuf + l + 2); - if (ioctl(n, ISDN_DIAL, &dial[an - NITTY]) < 0) - { - perror("ioctl: Dial"); - } - fprintf(stderr, "d:%d:%s\n", an, &dial[an - NITTY].telno.no[1]); - break; - default: - break; - } - } - if (quit) - { - fprintf(stderr, "s:Quit\n"); - exit(0); - } - if (rescan) - { - fprintf(stderr, "s:rescan\n"); - rescan = 0; - if ((f = fopen(configfile, "r")) == NULL) - perror(configfile); - else - { - process(f, n); - fclose(f); - } - } - fflush(stderr); - } -} - -int -find_appl() -{ - int i; - struct iline *a; - - for (i = 0; i < NITTY; i++) - { - a = &iline[i]; - if (a->occupied == 0) - { - a->occupied = 1; - return (i); - } - } - return (-1); -} diff --git a/gnu/usr.sbin/isdn/load/Makefile b/gnu/usr.sbin/isdn/load/Makefile deleted file mode 100644 index 31bc381..0000000 --- a/gnu/usr.sbin/isdn/load/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -PROG= load -CFLAGS+= -DBSD -O -NOMAN= yes - -.include <bsd.prog.mk> diff --git a/gnu/usr.sbin/isdn/load/load.c b/gnu/usr.sbin/isdn/load/load.c deleted file mode 100644 index fa9e600..0000000 --- a/gnu/usr.sbin/isdn/load/load.c +++ /dev/null @@ -1,117 +0,0 @@ -static char rcsid[] = "@(#)$Id: load.c,v 1.1 1995/01/25 14:06:18 jkr Exp jkr $"; -/******************************************************************************* - * II - Version 0.1 $Revision: 1.1 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: load.c,v $ - * - ******************************************************************************/ - -#include <sys/types.h> -#undef BSD -#include <sys/param.h> -#include <machine/endian.h> -#include <stdio.h> -#include <string.h> -#include <sys/ioctl.h> -#include <sys/file.h> -#include <time.h> -#include "../../../../sys/gnu/i386/isa/niccyreg.h" - -struct head head; -char buf[64 * 1024]; - -void -main(int argc, char **argv) -{ - FILE *f; - int n; - argv++; - - if ((n = open("/dev/nic0", O_RDWR)) < 0) - { - perror("open"); - exit(1); - } - if (!*argv) - { - process(stdin, n); - } else - while (*argv) - { - if ((f = fopen(*argv, "r")) == NULL) - { - perror(*argv); - exit(1); - } else - { - process(f, n); - fclose(f); - } - argv++; - } - exit(0); -} - -stime(int f) -{ - struct tm *t; - time_t tt; - char buf[16]; - - tt = time(NULL); - t = localtime(&tt); - sprintf(buf, "%.2d%.2d%.2d%.2d%.2d19%.2d", t->tm_hour, - t->tm_min, t->tm_sec, t->tm_mday, t->tm_mon + 1, t->tm_year); - - if (ioctl(f, NICCY_SET_CLOCK, buf) < 0) - { - perror("ioctl"); - } -} - - -process(FILE * f, int n) -{ - long size; - int len; - int no = 0; - - while ((len = fread(buf, 1, 0x16, f)) == 0x16) - { - bcopy(buf, (char *) &head, 0x16); - head.data = buf; - size = ntohl(head.len); - if ((len = fread(&buf[0x16], 1, size - 0x16, f)) != (size - 0x16)) - { - fprintf(stderr, "Cannot read modul %.8s of length %d\n", - head.nam, size); - exit(1); - } - printf("%d\t %x %.8s %.5s %x\n", - size, head.sig, head.nam, head.ver, head.typ); - - head.d_len = size; - head.status = no++; - - if (ioctl(n, NICCY_LOAD, &head) < 0) - { - perror("load"); - exit(1); - } - if (head.status) - { - fprintf(stderr, "Error loading %d\n", head.status); - exit(1); - } - } - printf("done\n"); - - stime(n); -} diff --git a/gnu/usr.sbin/isdn/misc/Makefile b/gnu/usr.sbin/isdn/misc/Makefile deleted file mode 100644 index 16b1e95..0000000 --- a/gnu/usr.sbin/isdn/misc/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -CFLAGS+= -DBSD -O - -ETCFILES = isdn.ip remote isdn.itt ttys -CLEANFILES+= tst stime *.o - -all: tst stime - -tst: tst.c - ${CC} $(CFLAGS) -o tst tst.c - -stime: stime.c - ${CC} $(CFLAGS) -o stime stime.c - -install: all - ${INSTALL} ${COPY} tst ${BINDIR}/isdn_test - ${INSTALL} ${COPY} stime ${BINDIR}/isdn_stime - ${INSTALL} -c -m 755 setnic.sh ${LIBDIR}/setnic - ${INSTALL} -c -m 755 sisdn.sh ${LIBDIR}/sisdn.example - ${INSTALL} -c ${ETCFILES} ${LIBDIR} - -.include <bsd.prog.mk> diff --git a/gnu/usr.sbin/isdn/misc/isdn.ip b/gnu/usr.sbin/isdn/misc/isdn.ip deleted file mode 100644 index 89b7376..0000000 --- a/gnu/usr.sbin/isdn/misc/isdn.ip +++ /dev/null @@ -1,3 +0,0 @@ -# This is nothing but a first try. Syntax might be completly different soon. -0:d102:l102:e2:pu:s1502:w10: -1:d113:l113:e3:pu:s1502:w10: diff --git a/gnu/usr.sbin/isdn/misc/isdn.itt b/gnu/usr.sbin/isdn/misc/isdn.itt deleted file mode 100644 index 74a58fa..0000000 --- a/gnu/usr.sbin/isdn/misc/isdn.itt +++ /dev/null @@ -1 +0,0 @@ -0:A8:pr.:w100: diff --git a/gnu/usr.sbin/isdn/misc/remote b/gnu/usr.sbin/isdn/misc/remote deleted file mode 100644 index cda70ac..0000000 --- a/gnu/usr.sbin/isdn/misc/remote +++ /dev/null @@ -1,2 +0,0 @@ -isdn:dv=/dev/ityo0:cm=d123.:pa=none: -re:dv=/dev/ityo0:cm=d133.:pa=none: diff --git a/gnu/usr.sbin/isdn/misc/setnic.sh b/gnu/usr.sbin/isdn/misc/setnic.sh deleted file mode 100644 index 9d2e099..0000000 --- a/gnu/usr.sbin/isdn/misc/setnic.sh +++ /dev/null @@ -1,84 +0,0 @@ -# First Parameter one out of the following: -# 5000 Niccy 5000 -# 3008 Niccy 3008 -# 3009 Niccy 3009 -# 1000 Niccy 1000 -# tel* , TEL* TELES S0 -# -# Second Parameter is optional: -# E* e* Euro ISDN EDSS1 -# 1T* 1t* t* T* 1TR6 (old german protocol) (default for the moment) - -PATH=/sbin:/bin/:/usr/bin:/usr/sbin -SYSTEM=`uname` -VER=`uname -a | cut -d' ' -f3` -case $SYSTEM in -NetBSD) - SN=netbsd - ;; -FreeBSD) - case $VER in - 1.0*|1.1*) - SN=386bsd - ;; - 2.0*) - SN=kernel - ;; - *) - echo System $SYSTEM Version $VER not supported - exit - esac - ;; -*) - echo System $SYSTEM not supported - exit -esac - -if [ "$2" = "" ] -then - LIB=tr6 -else - case $2 in - E*|e*) - LIB=eds - ;; - 1t*|1T*|t*|T*) - LIB=tr6 - ;; - *) - echo library $2 not supported - exit - esac -fi - - -case $1 in - -5000) - rm -f /$SN /isdn/lib/all.nic - ln /$SN.5000 /$SN - ln /isdn/lib/all.$LIB.5000 /isdn/lib/all.nic - /isdn/bin/mkdev 5000 - ;; -3008) - rm -f /$SN /isdn/lib/all.nic - ln /$SN.3008 /$SN - ln /isdn/lib/all.$LIB.3008 /isdn/lib/all.nic - /isdn/bin/mkdev 3008 - ;; -3009) - rm -f /$SN /isdn/lib/all.nic - ln /$SN.3009 /$SN - ln /isdn/lib/all.$LIB.3009 /isdn/lib/all.nic - /isdn/bin/mkdev 3009 - ;; -1000|tel*|TEL*) - rm -f /$SN /isdn/lib/all.nic - ln /$SN.1000 /$SN - /isdn/bin/mkdev 1000 - ;; -esac - -ls -l /$SN* - -echo please reboot the system by typing: fastboot diff --git a/gnu/usr.sbin/isdn/misc/sisdn.sh b/gnu/usr.sbin/isdn/misc/sisdn.sh deleted file mode 100644 index aca1bc7..0000000 --- a/gnu/usr.sbin/isdn/misc/sisdn.sh +++ /dev/null @@ -1,8 +0,0 @@ -load /isdn/lib/all.nic -iid -ittd -iteld -ifconfig ii0 inet 192.192.192.2 192.192.192.1 -ifconfig ii1 inet 192.192.193.2 192.192.193.1 -route add ver 192.192.192.2 -route add ver1 192.192.193.2 diff --git a/gnu/usr.sbin/isdn/misc/stime.c b/gnu/usr.sbin/isdn/misc/stime.c deleted file mode 100644 index 5eb21d4..0000000 --- a/gnu/usr.sbin/isdn/misc/stime.c +++ /dev/null @@ -1,44 +0,0 @@ -static char rcsid[] = "@(#)$Id: stime.c,v 1.1 1995/01/25 14:14:58 jkr Exp jkr $"; -/******************************************************************************* - * II - Version 0.1 $Revision: 1.1 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: stime.c,v $ - * - ******************************************************************************/ - -#include <sys/types.h> -#include <stdio.h> -#include <time.h> -#include <sys/ioctl.h> -#include <sys/file.h> -#include "../../../../sys/gnu/i386/isa/niccyreg.h" - -main() -{ - struct tm *t; - time_t tt; - int f; - char buf[16]; - - if ((f = open("/dev/nic0", O_RDWR)) < 0) - { - perror("open"); - exit(1); - } - tt = time(NULL); - t = localtime(&tt); - sprintf(buf, "%.2d%.2d%.2d%.2d%.2d19%.2d", t->tm_hour, - t->tm_min, t->tm_sec, t->tm_mday, t->tm_mon + 1, t->tm_year); - - if (ioctl(f, NICCY_SET_CLOCK, buf) < 0) - { - perror("ioctl"); - } -} diff --git a/gnu/usr.sbin/isdn/misc/tst.c b/gnu/usr.sbin/isdn/misc/tst.c deleted file mode 100644 index 535de1e..0000000 --- a/gnu/usr.sbin/isdn/misc/tst.c +++ /dev/null @@ -1,74 +0,0 @@ -static char rcsid[] = "@(#)$Id: tst.c,v 1.1 1995/01/25 14:14:58 jkr Exp jkr $"; -/******************************************************************************* - * II - Version 0.1 $Revision: 1.1 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: tst.c,v $ - * - ******************************************************************************/ - -/* - * This program reads a 3008 or 5000 or ... download file and shows Headers - * and statistics - */ - -#include <sys/types.h> -#include <machine/endian.h> -#include <stdio.h> - -struct head -{ - u_long len; - u_long sig; - char nam[8]; - char ver[5]; - u_char typ; -} head; - -void -main(int argc, char **argv) -{ - FILE *f; - argv++; - - if (!*argv) - { - process(stdin); - } else - while (*argv) - { - if ((f = fopen(*argv, "r")) == NULL) - { - perror(*argv); - exit(1); - } else - { - process(f); - fclose(f); - } - argv++; - } - exit(0); -} - -process(FILE * f) -{ - long off; - - off = 0; - - while (fread(&head, 1, 0x16, f) == 0x16) - { - printf("%d\t %x %.8s %.5s %x\n", - ntohl(head.len), head.sig, head.nam, head.ver, head.typ); - off += ntohl(head.len); - fseek(f, off, SEEK_SET); - } - printf("%d\n", off); -} diff --git a/gnu/usr.sbin/isdn/misc/ttys b/gnu/usr.sbin/isdn/misc/ttys deleted file mode 100644 index 9f135c4..0000000 --- a/gnu/usr.sbin/isdn/misc/ttys +++ /dev/null @@ -1,2 +0,0 @@ -ity00 "/usr/libexec/getty Pc" unknown on secure -ity01 "/usr/libexec/getty Pc" unknown on secure diff --git a/gnu/usr.sbin/isdn/nsplit/Makefile b/gnu/usr.sbin/isdn/nsplit/Makefile deleted file mode 100644 index d79b840..0000000 --- a/gnu/usr.sbin/isdn/nsplit/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -PROG= nsplit -CFLAGS+= -DBSD -O -NOMAN= yes - -.include <bsd.prog.mk> diff --git a/gnu/usr.sbin/isdn/nsplit/nsplit.c b/gnu/usr.sbin/isdn/nsplit/nsplit.c deleted file mode 100644 index 2502a58..0000000 --- a/gnu/usr.sbin/isdn/nsplit/nsplit.c +++ /dev/null @@ -1,102 +0,0 @@ -static char rcsid[] = "@(#)$Id: nsplit.c,v 1.1 1995/01/25 14:06:18 jkr Exp jkr $"; -/******************************************************************************* - * II - Version 0.1 $Revision: 1.1 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: nsplit.c,v $ - * - ******************************************************************************/ - -#include <sys/types.h> -#undef BSD -#include <sys/param.h> -#include <machine/endian.h> -#include <stdio.h> -#include <string.h> -#include <sys/ioctl.h> -#include <sys/file.h> -#include <time.h> -#include "../../../../sys/gnu/i386/isa/niccyreg.h" - -struct head head; - -void -main(int argc, char **argv) -{ - FILE *f; - int n; - argv++; - - if (!*argv) - { - process(stdin); - } else - while (*argv) - { - if ((f = fopen(*argv, "r")) == NULL) - { - perror(*argv); - exit(1); - } else - { - process(f); - fclose(f); - } - argv++; - } - exit(0); -} - -process(FILE * f) -{ - long off = 0; - long size, rest; - int len; - char buf[1024]; - int ex; - int no = 0; - char nbuf[16]; - FILE *fout; - - while ((len = fread(buf, 1, 1024, f)) >= 0x16) - { - head = *(struct head *) buf; - size = rest = ntohl(head.len); - ex = len == rest; - - sprintf(nbuf, "o%.2d", no); - if ((fout = fopen(nbuf, "w")) == NULL) - { - perror(nbuf); - exit(1); - } else - printf("%d\t %x %.8s %.5s %x\n", - rest, head.sig, head.nam, head.ver, head.typ); - - do - { - fwrite(buf, 1, MIN(len, rest), fout); - rest -= MIN(len, rest); - - if (rest > 0) - len = fread(buf, 1, MIN(rest, 1024), f); - } - while (rest > 0); - - if (ex) - break; - no++; - - off += size; - if ((size < 1024) && (size > 0x16)) - fseek(f, off, SEEK_SET); - } - printf("done\n"); - -} diff --git a/gnu/usr.sbin/isdn/play/Makefile b/gnu/usr.sbin/isdn/play/Makefile deleted file mode 100644 index 522673d..0000000 --- a/gnu/usr.sbin/isdn/play/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -NOMAN= noman - -beforeinstall: - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ - ${.CURDIR}/play.sh ${DESTDIR}/${BINDIR}/play - -.include <bsd.prog.mk> diff --git a/gnu/usr.sbin/isdn/play/play.sh b/gnu/usr.sbin/isdn/play/play.sh deleted file mode 100644 index 71a142d..0000000 --- a/gnu/usr.sbin/isdn/play/play.sh +++ /dev/null @@ -1,6 +0,0 @@ -# play.sh -for i in /isdn/msg/R.* -do - dd of=/dev/itel00 if=$i bs=1k - dd of=/dev/itel00 if=/isdn/msg/beep bs=1k -done >/dev/null 2>&1 diff --git a/gnu/usr.sbin/isdn/rst/Makefile b/gnu/usr.sbin/isdn/rst/Makefile deleted file mode 100644 index 203ced9..0000000 --- a/gnu/usr.sbin/isdn/rst/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -PROG= rst -CFLAGS+= -DBSD -O -NOMAN= - -.include <bsd.prog.mk> diff --git a/gnu/usr.sbin/isdn/rst/rst.c b/gnu/usr.sbin/isdn/rst/rst.c deleted file mode 100644 index 331bdba..0000000 --- a/gnu/usr.sbin/isdn/rst/rst.c +++ /dev/null @@ -1,35 +0,0 @@ -static char rcsid[] = "@(#)$Id: rst.c,v 1.1 1995/01/25 14:07:55 jkr Exp jkr $"; -/******************************************************************************* - * II - Version 0.1 $Revision: 1.1 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: rst.c,v $ - * - ******************************************************************************/ - -#include <sys/types.h> -#include <stdio.h> -#include <sys/ioctl.h> -#include <sys/file.h> -#include "../../../../sys/gnu/i386/isa/niccyreg.h" - -main() -{ - int s, f; - - if ((f = open("/dev/nic0", O_RDWR)) < 0) - { - perror("open"); - exit(1); - } - if (ioctl(f, NICCY_RESET, &s) < 0) - { - perror("ioctl"); - } -} diff --git a/gnu/usr.sbin/isdn/rstcode/Makefile b/gnu/usr.sbin/isdn/rstcode/Makefile deleted file mode 100644 index 093f191..0000000 --- a/gnu/usr.sbin/isdn/rstcode/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -PROG= rstcode -CFLAGS+= -DBSD -O -NOMAN= yes - -.include <bsd.prog.mk> diff --git a/gnu/usr.sbin/isdn/rstcode/rstcode.c b/gnu/usr.sbin/isdn/rstcode/rstcode.c deleted file mode 100644 index 5a9970b..0000000 --- a/gnu/usr.sbin/isdn/rstcode/rstcode.c +++ /dev/null @@ -1,51 +0,0 @@ -static char rcsid[] = "@(#)$Id: rstcode.c,v 1.1 1995/01/25 14:06:18 jkr Exp jkr $"; -/******************************************************************************* - * II - Version 0.1 $Revision: 1.1 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: rstcode.c,v $ - * - ******************************************************************************/ -#include <sys/types.h> -#include <machine/endian.h> -#include <stdio.h> - -struct head -{ - u_long len; - u_long sig; - char nam[8]; - char ver[5]; - u_char typ; -} head = -{ - 0, 0, "RESETCOD", "0.000", 3 -}; - - - -const char ResetCode[] = { - 0x00, 0x00, 0x00, 0x00, /* SP */ - 0x00, 0x00, 0x00, 0x08, /* PC */ - 0x20, 0x7c, 0xff, 0xff, 0xff, 0xcc, /* movea.l #0xffffffcc,a0 */ - 0x20, 0xbc, 0xff, 0xf9, 0xe6, 0xff, /* move.l #0xffff9e6ff,(a0) */ - 0x51, 0x88, /* subq.q #8,a0 */ - 0x21, 0x3c, 0x00, 0x01, 0xe6, 0xff, /* move.l #0x1e6ff,-(a0) */ - 0x20, 0x38, 0x07, 0xfc, /* move.l $7fc,d0 ; Reset PC DPRAM */ - 0x10, 0x39, 0xFF, 0xF8, 0x07, 0xff, /* move.b $fff807ff,d0 Reset - * DSP DPRAM */ - 0x42, 0xb8, 0x00, 0x04, /* clr.l $4 */ -0x4e, 0x72, 0x27, 0x00}; /* stop #$2700 */ - -main() -{ - head.len = ntohl(0x16 + sizeof(ResetCode)); - fwrite(&head, 1, 0x16, stdout); - fwrite(ResetCode, 1, sizeof(ResetCode), stdout); -} diff --git a/gnu/usr.sbin/isdn/spy/Makefile b/gnu/usr.sbin/isdn/spy/Makefile deleted file mode 100644 index cfe369c..0000000 --- a/gnu/usr.sbin/isdn/spy/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -PROG= spy -CFLAGS+= -DBSD -O -NOMAN= - -.include <bsd.prog.mk> diff --git a/gnu/usr.sbin/isdn/spy/spy.c b/gnu/usr.sbin/isdn/spy/spy.c deleted file mode 100644 index 1f730c0..0000000 --- a/gnu/usr.sbin/isdn/spy/spy.c +++ /dev/null @@ -1,108 +0,0 @@ -static char rcsid[] = "@(#)$Id: spy.c,v 1.2 1995/01/25 13:41:44 jkr Exp jkr $"; -/******************************************************************************* - * II - Version 0.1 $Revision: 1.2 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: spy.c,v $ - * - ******************************************************************************/ - -#include <stdio.h> -#include <signal.h> -#include <fcntl.h> -#include <ctype.h> -#include <sys/time.h> - -#define BSIZE 1024+sizeof(struct timeval)+sizeof(unsigned long)+1 -unsigned char buf[BSIZE]; -FILE *Fout = NULL; - -static void -catchsig() -{ - printf("EXIT\n"); - exit(1); -} - -main(argc, argv) - int argc; - char **argv; -{ - int f, n; - struct timeval *t = (struct timeval *) & buf[sizeof(unsigned long) + 1]; - char *b = &buf[sizeof(struct timeval) + sizeof(unsigned long) + 1]; - struct tm *s; - - if ((f = open("/dev/ispy", O_RDONLY)) < 0) - { - perror(argv[1]); - exit(1); - } - argv++; - if (*argv) - Fout = fopen(*argv, "w"); - - (void) signal(SIGHUP, catchsig); - (void) signal(SIGTERM, catchsig); - (void) signal(SIGKILL, catchsig); - (void) signal(SIGINT, catchsig); - (void) signal(SIGQUIT, catchsig); - - for (;;) - { - n = read(f, buf, BSIZE); - n -= sizeof(struct timeval) + sizeof(unsigned long) + 1; - s = localtime(&t->tv_sec); - if (*buf) - printf("> "); - else - printf("< "); - printf("%.4d: %.2d:%.2d:%.2d.%.2d len %d:\n", *(unsigned long *) &buf[1], - s->tm_hour, s->tm_min, s->tm_sec, t->tv_usec / 10000, n); - if (Fout != NULL) - { - if (*buf) - fprintf(Fout, "> "); - else - fprintf(Fout, "< "); - fprintf(Fout, "%.4d: %.2d:%.2d:%.2d.%.2d len %d:\n", - *(unsigned long *) &buf[1], s->tm_hour, s->tm_min, - s->tm_sec, t->tv_usec / 10000, n); - } - if (n > 0) - { - dumpbuf(stdout, n, b); - if (Fout != NULL) - dumpbuf(Fout, n, b); - } - } -} - -dumpbuf(FILE * f, int n, unsigned char *buf) -{ - int i, j; - - for (i = 0; i < n; i += 16) - { - fprintf(f, "%.3x ", i); - for (j = 0; j < 16; j++) - if (i + j < n) - fprintf(f, "%02x ", buf[i + j]); - else - fprintf(f, " "); - fprintf(f, " "); - for (j = 0; j < 16 && i + j < n; j++) - if (isprint(buf[i + j])) - fprintf(f, "%c", buf[i + j]); - else - fputc('.', f); - fputc('\n', f); - } - fflush(f); -} diff --git a/gnu/usr.sbin/isdn/ulaw2alaw/Makefile b/gnu/usr.sbin/isdn/ulaw2alaw/Makefile deleted file mode 100644 index 494c541..0000000 --- a/gnu/usr.sbin/isdn/ulaw2alaw/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -PROG= ulaw2alaw -CFLAGS+= -DBSD -O -NOMAN= yes - -.include <bsd.prog.mk> diff --git a/gnu/usr.sbin/isdn/ulaw2alaw/README b/gnu/usr.sbin/isdn/ulaw2alaw/README deleted file mode 100644 index 771e87f..0000000 --- a/gnu/usr.sbin/isdn/ulaw2alaw/README +++ /dev/null @@ -1 +0,0 @@ -stolen from isdndrv-0.1.1 diff --git a/gnu/usr.sbin/isdn/ulaw2alaw/con.h b/gnu/usr.sbin/isdn/ulaw2alaw/con.h deleted file mode 100644 index 9f359c8..0000000 --- a/gnu/usr.sbin/isdn/ulaw2alaw/con.h +++ /dev/null @@ -1,162 +0,0 @@ - -static unsigned char ulaw_linear[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 2, - 5, 9, 13, 17, 21, 25, 29, 33, - 37, 41, 45, 49, 53, 57, 61, 65, - 68, 70, 72, 74, 76, 78, 80, 82, - 84, 86, 88, 90, 92, 94, 96, 98, - 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, - 115, 116, 116, 117, 117, 118, 118, 119, - 119, 120, 120, 121, 121, 122, 122, 123, - 123, 123, 124, 124, 124, 124, 125, 125, - 125, 125, 126, 126, 126, 126, 127, 127, - 127, 127, 127, 127, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 252, 248, 244, 240, 236, 232, 228, 224, - 220, 216, 212, 208, 204, 200, 196, 192, - 189, 187, 185, 183, 181, 179, 177, 175, - 173, 171, 169, 167, 165, 163, 161, 159, - 157, 156, 155, 154, 153, 152, 151, 150, - 149, 148, 147, 146, 145, 144, 143, 142, - 142, 141, 141, 140, 140, 139, 139, 138, - 138, 137, 137, 136, 136, 135, 135, 134, - 134, 134, 133, 133, 133, 133, 132, 132, - 132, 132, 131, 131, 131, 131, 130, 130, - 130, 130, 130, 130, 129, 129, 129, 129, - 129, 129, 129, 129, 128, 128, 128, 128, -}; - -static unsigned char linear_ulaw[] = { - 31, 31, 31, 32, 32, 32, 32, 33, - 33, 33, 33, 34, 34, 34, 34, 35, - 35, 35, 35, 36, 36, 36, 36, 37, - 37, 37, 37, 38, 38, 38, 38, 39, - 39, 39, 39, 40, 40, 40, 40, 41, - 41, 41, 41, 42, 42, 42, 42, 43, - 43, 43, 43, 44, 44, 44, 44, 45, - 45, 45, 45, 46, 46, 46, 46, 47, - 47, 47, 47, 48, 48, 49, 49, 50, - 50, 51, 51, 52, 52, 53, 53, 54, - 54, 55, 55, 56, 56, 57, 57, 58, - 58, 59, 59, 60, 60, 61, 61, 62, - 62, 63, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 81, 83, 85, 87, 89, - 91, 93, 95, 99, 103, 107, 111, 119, - 255, 247, 239, 235, 231, 227, 223, 221, - 219, 217, 215, 213, 211, 209, 207, 206, - 205, 204, 203, 202, 201, 200, 199, 198, - 197, 196, 195, 194, 193, 192, 191, 191, - 190, 190, 189, 189, 188, 188, 187, 187, - 186, 186, 185, 185, 184, 184, 183, 183, - 182, 182, 181, 181, 180, 180, 179, 179, - 178, 178, 177, 177, 176, 176, 175, 175, - 175, 175, 174, 174, 174, 174, 173, 173, - 173, 173, 172, 172, 172, 172, 171, 171, - 171, 171, 170, 170, 170, 170, 169, 169, - 169, 169, 168, 168, 168, 168, 167, 167, - 167, 167, 166, 166, 166, 166, 165, 165, - 165, 165, 164, 164, 164, 164, 163, 163, - 163, 163, 162, 162, 162, 162, 161, 161, - 161, 161, 160, 160, 160, 160, 159, 159, -}; - -static unsigned char alaw_linear[] = { - 45, 214, 122, 133, 0, 255, 107, 149, - 86, 171, 126, 129, 0, 255, 117, 138, - 13, 246, 120, 135, 0, 255, 99, 157, - 70, 187, 124, 131, 0, 255, 113, 142, - 61, 198, 123, 132, 0, 255, 111, 145, - 94, 163, 127, 128, 0, 255, 119, 136, - 29, 230, 121, 134, 0, 255, 103, 153, - 78, 179, 125, 130, 0, 255, 115, 140, - 37, 222, 122, 133, 0, 255, 105, 151, - 82, 175, 126, 129, 0, 255, 116, 139, - 5, 254, 120, 135, 0, 255, 97, 159, - 66, 191, 124, 131, 0, 255, 112, 143, - 53, 206, 123, 132, 0, 255, 109, 147, - 90, 167, 127, 128, 0, 255, 118, 137, - 21, 238, 121, 134, 0, 255, 101, 155, - 74, 183, 125, 130, 0, 255, 114, 141, - 49, 210, 123, 133, 0, 255, 108, 148, - 88, 169, 127, 129, 0, 255, 118, 138, - 17, 242, 121, 135, 0, 255, 100, 156, - 72, 185, 125, 131, 0, 255, 114, 142, - 64, 194, 124, 132, 0, 255, 112, 144, - 96, 161, 128, 128, 1, 255, 120, 136, - 33, 226, 122, 134, 0, 255, 104, 152, - 80, 177, 126, 130, 0, 255, 116, 140, - 41, 218, 122, 133, 0, 255, 106, 150, - 84, 173, 126, 129, 0, 255, 117, 139, - 9, 250, 120, 135, 0, 255, 98, 158, - 68, 189, 124, 131, 0, 255, 113, 143, - 57, 202, 123, 132, 0, 255, 110, 146, - 92, 165, 127, 128, 0, 255, 119, 137, - 25, 234, 121, 134, 0, 255, 102, 154, - 76, 181, 125, 130, 0, 255, 115, 141, - -}; - - -static unsigned char linear_alaw[] = { - - 252, 172, 172, 172, 172, 80, 80, 80, - 80, 208, 208, 208, 208, 16, 16, 16, - 16, 144, 144, 144, 144, 112, 112, 112, - 112, 240, 240, 240, 240, 48, 48, 48, - 48, 176, 176, 176, 176, 64, 64, 64, - 64, 192, 192, 192, 192, 0, 0, 0, - 0, 128, 128, 128, 128, 96, 96, 96, - 96, 224, 224, 224, 224, 32, 32, 32, - 160, 160, 88, 88, 216, 216, 24, 24, - 152, 152, 120, 120, 248, 248, 56, 56, - 184, 184, 72, 72, 200, 200, 8, 8, - 136, 136, 104, 104, 232, 232, 40, 40, - 168, 86, 214, 22, 150, 118, 246, 54, - 182, 70, 198, 6, 134, 102, 230, 38, - 166, 222, 158, 254, 190, 206, 142, 238, - 210, 242, 194, 226, 218, 250, 202, 234, - 235, 203, 251, 219, 227, 195, 243, 211, - 175, 239, 143, 207, 191, 255, 159, 223, - 167, 39, 231, 103, 135, 7, 199, 71, - 183, 55, 247, 119, 151, 23, 215, 87, - 87, 169, 169, 41, 41, 233, 233, 105, - 105, 137, 137, 9, 9, 201, 201, 73, - 73, 185, 185, 57, 57, 249, 249, 121, - 121, 153, 153, 25, 25, 217, 217, 89, - 89, 89, 161, 161, 161, 161, 33, 33, - 33, 33, 225, 225, 225, 225, 97, 97, - 97, 97, 129, 129, 129, 129, 1, 1, - 1, 1, 193, 193, 193, 193, 65, 65, - 65, 65, 177, 177, 177, 177, 49, 49, - 49, 49, 241, 241, 241, 241, 113, 113, - 113, 113, 145, 145, 145, 145, 17, 17, - 17, 17, 209, 209, 209, 209, 81, 253, -}; - -inline void translate_bytes(const void *table, void *buff, unsigned long n) -{ - __asm__("cld\n" - "1:\tlodsb\n\t" - "xlatb\n\t" - "stosb\n\t" - "loop 1b\n\t" - ::"b" ((long)table), "c" (n), "D" ((long)buff), "S" ((long)buff) - :"bx","cx","di","si","ax"); -} - -void translate_ansi(unsigned char table[], unsigned char buff[], unsigned long n) -{ -register counter; - -for(counter=0; counter< n; counter++) - buff[counter] = table[buff[counter]]; -} diff --git a/gnu/usr.sbin/isdn/ulaw2alaw/ulaw2alaw.c b/gnu/usr.sbin/isdn/ulaw2alaw/ulaw2alaw.c deleted file mode 100644 index afa0f11..0000000 --- a/gnu/usr.sbin/isdn/ulaw2alaw/ulaw2alaw.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <fcntl.h> -#include "con.h" - -main(int argc, char *argv[]) -{ - int counter; - unsigned char buffer[1024]; - - - while ((counter = read(0, buffer, sizeof(buffer))) > 0) { - translate_bytes(ulaw_linear, buffer, counter); /* now linear */ - translate_bytes(linear_alaw, buffer, counter); /* now alaw */ - counter != write(1, buffer, counter); - } -} diff --git a/sys/conf/files b/sys/conf/files index c7c25f3..ee66023 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -27,11 +27,6 @@ gnu/ext2fs/ext2_lookup.c optional ext2fs gnu/ext2fs/ext2_subr.c optional ext2fs gnu/ext2fs/ext2_vfsops.c optional ext2fs gnu/ext2fs/ext2_vnops.c optional ext2fs -gnu/isdn/if_ii.c optional ii device-driver -gnu/isdn/iispy.c optional ispy device-driver -gnu/isdn/iitel.c optional itel device-driver -gnu/isdn/iitty.c optional ity device-driver -gnu/isdn/isdn.c optional isdn device-driver isofs/cd9660/cd9660_bmap.c optional cd9660 isofs/cd9660/cd9660_lookup.c optional cd9660 isofs/cd9660/cd9660_node.c optional cd9660 diff --git a/sys/gnu/i386/isa/nic3008.c b/sys/gnu/i386/isa/nic3008.c deleted file mode 100644 index 3561e6f..0000000 --- a/sys/gnu/i386/isa/nic3008.c +++ /dev/null @@ -1,1293 +0,0 @@ -/* @(#)$Id: nic3008.c,v 1.15 1996/03/28 14:27:27 scrappy Exp $ - ******************************************************************************* - * II - Version 0.1 $Revision: 1.15 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: nic3008.c,v $ - * Revision 1.15 1996/03/28 14:27:27 scrappy - * Switched from using devfs_add_sw() to using devfs_add_swf() - * - * Reviewed by: julian@freebsd.org - * - * Revision 1.14 1995/12/17 21:14:34 phk - * Staticize. - * - * Revision 1.13 1995/12/08 23:19:29 phk - * Julian forgot to make the *devsw structures static. - * - * Revision 1.12 1995/12/08 11:12:45 julian - * Pass 3 of the great devsw changes - * most devsw referenced functions are now static, as they are - * in the same file as their devsw structure. I've also added DEVFS - * support for nearly every device in the system, however - * many of the devices have 'incorrect' names under DEVFS - * because I couldn't quickly work out the correct naming conventions. - * (but devfs won't be coming on line for a month or so anyhow so that doesn't - * matter) - * - * If you "OWN" a device which would normally have an entry in /dev - * then search for the devfs_add_devsw() entries and munge to make them right.. - * check out similar devices to see what I might have done in them in you - * can't see what's going on.. - * for a laugh compare conf.c conf.h defore and after... :) - * I have not doen DEVFS entries for any DISKSLICE devices yet as that will be - * a much more complicated job.. (pass 5 :) - * - * pass 4 will be to make the devsw tables of type (cdevsw * ) - * rather than (cdevsw) - * seems to work here.. - * complaints to the usual places.. :) - * - * Revision 1.11 1995/11/29 14:39:07 julian - * If you're going to mechanically replicate something in 50 files - * it's best to not have a (compiles cleanly) typo in it! (sigh) - * - * Revision 1.10 1995/11/29 10:47:04 julian - * OK, that's it.. - * That's EVERY SINGLE driver that has an entry in conf.c.. - * my next trick will be to define cdevsw[] and bdevsw[] - * as empty arrays and remove all those DAMNED defines as well.. - * - * Revision 1.9 1995/11/21 14:56:01 bde - * Completed function declarations, added prototypes and removed redundant - * declarations. - * - * Revision 1.8 1995/11/18 04:19:44 bde - * Fixed the type of nic_listen(). A trailing arg was missing. - * - * Fixed calls to s_intr(). There was sometimes an extra trailing arg. - * - * Revision 1.7 1995/09/08 11:06:46 bde - * Fix benign type mismatches in devsw functions. 82 out of 299 devsw - * functions were wrong. - * - * Revision 1.6 1995/05/30 07:57:57 rgrimes - * Remove trailing whitespace. - * - * Revision 1.5 1995/05/11 19:25:55 rgrimes - * Fix -Wformat warnings from LINT kernel. - * - * Revision 1.4 1995/03/28 07:54:31 bde - * Add and move declarations to fix all of the warnings from `gcc -Wimplicit' - * (except in netccitt, netiso and netns) that I didn't notice when I fixed - * "all" such warnings before. - * - * Revision 1.3 1995/03/19 14:28:35 davidg - * Removed redundant newlines that were in some panic strings. - * - * Revision 1.2 1995/02/15 11:59:40 jkh - * Fix a few more nits. Should compile better now! :_) - * - * Revision 1.1 1995/02/14 15:00:10 jkh - * An ISDN driver that supports the EDSS1 and the 1TR6 ISDN interfaces. - * EDSS1 is the "Euro-ISDN", 1TR6 is the soon obsolete german ISDN Interface. - * Obtained from: Dietmar Friede <dfriede@drnhh.neuhaus.de> and - * Juergen Krause <jkr@saarlink.de> - * - * This is only one part - the rest to follow in a couple of hours. - * This part is a benign import, since it doesn't affect anything else. - * - * - ******************************************************************************/ - -/* - * Copyright (c) 1994 Dietmar Friede (dietmar@friede.de) All rights reserved. - * FSF/FSAG GNU Copyright applies - * - * A low level driver for the NICCY-3008 ISDN Card. - * - */ - -#include "nic.h" -#if NNIC > 0 - -#include <sys/param.h> -#include <sys/ioctl.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/conf.h> -#include <sys/proc.h> -#ifdef DEVFS -#include <sys/devfsext.h> -#endif /*DEVFS*/ - -#include <i386/isa/isa_device.h> -#include <gnu/i386/isa/nic3008.h> -#include <gnu/i386/isa/niccyreg.h> -#include <gnu/isdn/isdn_ioctl.h> - - -#define OPEN 1 -#define LOAD_HEAD 3 -#define LOAD_DATA 5 -#define IS_DIAL(p) (((p)&0x20)==0) -#define IS_LISTEN(p) ((p)&0x20) -#define CHAN(pl) (((pl)&7)-1) -#define C_CHAN(x) ((x)&1) -#define APPL(pl) ((((pl)>>6)&0x7f)-1) -#define CARD(pl) (((pl)>>13)&7) -#define MK_APPL(pl) (((pl)+1)<<6) - -#define con_act_resp(sc,pl) en_q_d(sc,DD_CONN_ACT_RSP, pl ,0,NULL) -#define discon_resp(sc,pl) en_q_d(sc,DD_DISC_RSP, pl ,0,NULL) -#define inf_resp(sc,pl) en_q_d(sc,DD_INFO_RSP, pl ,0,NULL) -#define listen_b3_req(sc,mb,pl) en_q_b(sc,mb,BD_LIST_B3_REQ,pl,0,NULL) -#define con_b3_req(sc,mb,pl) en_q_b(sc,mb,BD_CONN_B3_REQ,pl,0,NULL) -#define min(a,b) ((a)<(b)?(a):(b)) - -extern isdn_appl_t isdn_appl[]; -extern u_short isdn_state; -extern isdn_ctrl_t isdn_ctrl[]; -extern int ispy_applnr; -extern int Isdn_Appl, Isdn_Ctrl, Isdn_Typ; - -static old_spy= 0; - -static int nicattach __P((struct isa_device *is)); -static int nicprobe __P((struct isa_device *is)); -static int nic_accept __P((int cn, int an, int rea)); -static int nic_connect __P((int cn, int ap, int b_channel, int inf_mask, - int out_serv, int out_serv_add, - int src_subadr, unsigned ad_len, - char *dest_addr, int spv)); -static int nic_disconnect __P((int cn, int rea)); -static int nic_listen __P((int cn, int ap, int inf_mask, int subadr_mask, - int si_mask, int spv)); -static int nic_output __P((int cn)); - -static short bsintr; - -struct isa_driver nicdriver = {nicprobe, nicattach, "nic"}; - -static d_open_t nicopen; -static d_close_t nicclose; -static d_ioctl_t nicioctl; - -#define CDEV_MAJOR 54 -static struct cdevsw nic_cdevsw = - { nicopen, nicclose, noread, nowrite, /*54*/ - nicioctl, nostop, nullreset, nodevtotty,/* nic */ - seltrue, nommap, NULL, "nic", NULL, -1 }; - -typedef enum -{ - DISCON, ISDISCON, DIAL, CALLED, CONNECT, IDLE, ACTIVE -} io_state; -typedef struct -{ - char ctrl; - u_char msg_nr; - u_char morenr; - short plci; - short ncci; - short state; - short i_len; - char i_buf[2048]; - char o_buf[2048]; - u_short more; - char *more_b; -} chan_t; - -static struct nic_softc -{ - dpr_type *sc_dpr; /* card RAM virtual memory base */ - u_short sc_vector; /* interrupt vector */ - short sc_port; - u_char sc_flags; - u_char sc_unit; - u_char sc_ctrl; - short sc_stat; - chan_t sc_chan[2]; -#ifdef DEVFS - void *devfs_token; -#endif -} nic_sc[NNIC]; - -static void badstate __P((mbx_type *mbx, int n, int mb, dpr_type *dpr)); -static void b_intr __P((int mb, int c, struct nic_softc *sc)); -static void bs_intr __P((int mb, int c, struct nic_softc *sc)); -static void con_b3_resp __P((struct nic_softc *sc, int mb, u_short ncci, - u_char reject)); -static void con_resp __P((struct nic_softc *sc, int pl, int rea)); -static void d_intr __P((struct nic_softc *sc)); -static int discon_req __P((int w, struct nic_softc *sc, int pl, int rea, - int err)); -static int en_q_b __P((struct nic_softc *sc, int mb, int t, int pl, int l, - u_char *b)); -static int en_q_d __P((struct nic_softc *sc, int t, int pl, int l, - u_char *b)); -static int cstrcmp __P((char *str1, char *str2)); -static void make_intr __P((int box, struct nic_softc *sc)); -static void reset_card __P((struct nic_softc *sc)); -static int reset_plci __P((int w_is_defined_bletch, chan_t *chan, int p)); -static void reset_req __P((struct nic_softc *sc, unsigned box, int w)); -static void s_intr __P((struct nic_softc *sc)); -static int sel_b2_prot_req __P((struct nic_softc *sc, int c, int pl, - dlpd_t *dlpd)); -static void sel_b3_prot_req __P((struct nic_softc *sc, int mb, u_short pl, - ncpd_t *ncpd)); - -int -nicprobe(struct isa_device * is) -{ - register struct nic_softc *sc = &nic_sc[is->id_unit & 127]; - dpr_type *dpr; - - sc->sc_vector = is->id_irq; - sc->sc_port = is->id_iobase; - sc->sc_unit = is->id_unit; - dpr = sc->sc_dpr = (dpr_type *) is->id_maddr; - - if (cstrcmp(dpr->niccy_ver, "NICCY V ") == 0) - { - printf("NICCY NICCY-Card %d not found at %p\n" - ,is->id_unit, is->id_maddr); - return (0); - } - while (dpr->card_state & 1); /* self test running */ - - if (dpr->card_state & 0x8A) - { - printf("Check Niccy Card, error state %d \n", dpr->card_state); - return (0); - } - dpr->card_number = is->id_unit; - is->id_msize = 8192; - reset_card(sc); - return (8); -} - -/* - * nicattach() Install device - */ -int -nicattach(struct isa_device * is) -{ - struct nic_softc *sc; - dpr_type *dpr; - int cn; - isdn_ctrl_t *ctrl0, *ctrl1; - - sc = &nic_sc[is->id_unit]; - dpr = sc->sc_dpr; - sc->sc_ctrl = -1; - if ((cn = isdn_ctrl_attach(2)) == -1) - { - return (0); - } - sc->sc_ctrl = cn; - - sc->sc_chan[0].plci = sc->sc_chan[1].plci = -1; - - ctrl0 = &isdn_ctrl[cn]; - ctrl1 = &isdn_ctrl[cn + 1]; - sc->sc_chan[0].ctrl = ctrl0->ctrl = cn; - sc->sc_chan[1].ctrl = ctrl1->ctrl = cn + 1; - ctrl0->o_buf = sc->sc_chan[0].o_buf; - ctrl1->o_buf = sc->sc_chan[1].o_buf; - ctrl0->listen = ctrl1->listen = nic_listen; - ctrl0->disconnect = ctrl1->disconnect = nic_disconnect; - ctrl0->accept = ctrl1->accept = nic_accept; - ctrl0->connect = ctrl1->connect = nic_connect; - ctrl0->output = ctrl1->output = nic_output; - ctrl0->unit = ctrl1->unit = is->id_unit; - ctrl0->appl = ctrl1->appl = -1; - ctrl0->o_len = ctrl1->o_len = -1; - - while (dpr->card_state & 1); /* self test running */ - dpr->card_number = is->id_unit; - dpr->int_flg_pc = 0xff; - reset_req(sc, MBX_MU, 4); -#ifdef DEVFS - sc->devfs_token = - devfs_add_devswf(&nic_cdevsw, is->id_unit, DV_CHR, 0, 0, - 0600, "/isdn/nic%d", is->id_unit); -#endif - return (1); -} - -static int -cstrcmp(char *str1, char *str2) -{ - while (*str2 && (*str2 == *str1)) - { - str1++; - str2++; - } - if (!*str2) - return (1); - return (0); -} - -/* If the niccy card wants it: Interupt it. */ -static void -make_intr(int box, struct nic_softc * sc) -{ - dpr_type *dpr = sc->sc_dpr; - - dpr->watchdog_cnt = 0xFF; - if ((dpr->int_flg_nic & (1 << box)) == 0) - return; - if (dpr->ext_hw_config == 1) - { - u_char s; - s = inb(sc->sc_port + 4); - outb(sc->sc_port + 4, s & 0xfb); - outb(sc->sc_port + 4, s | 4); - outb(sc->sc_port + 4, s); - return; - } - outb(sc->sc_port + 2, 1); -} - -static void -reset_req(struct nic_softc * sc, unsigned box, int w) -{ - if(box >= 8) - return; - - (sc->sc_dpr)->msg_flg[box] = 0; - make_intr(box, sc); -} - -static int -en_q_d(struct nic_softc * sc, int t, int pl, int l, u_char * b) -{ - dpr_type *dpr = sc->sc_dpr; - mbx_type *mbx = &dpr->dpr_mbx[3]; - - if (dpr->card_state & ~4) - return (ENODEV); - if (dpr->msg_flg[3]) - return (EBUSY); - - bzero(mbx, 18); - mbx->type = t; - mbx->add_info = pl; - if (l) - { - mbx->data_len = l; - bcopy(b, mbx->data, l); - } - dpr->msg_flg[3] = 1; - make_intr(3, sc); - return (0); -} - -static int -en_q_b(struct nic_softc * sc, int mb, int t, int pl, int l, u_char * b) -{ - dpr_type *dpr = sc->sc_dpr; - mbx_type *mbx = &dpr->dpr_mbx[++mb]; - - if (mb == 7) - t |= 0x40; - - if (dpr->card_state) - return (ENODEV); - if (dpr->msg_flg[mb]) - return (EBUSY); - - bzero(mbx, 18); - mbx->type = t; - mbx->add_info = pl; - if (l) - { - mbx->data_len = l; - bcopy(b, mbx->data, l); - } - dpr->msg_flg[mb] = 1; - make_intr(mb, sc); - return (0); -} - -static void -badstate(mbx_type * mbx, int n, int mb, dpr_type *dpr) -{ - printf("Niccy: not implemented %x len %d at %d.", mbx->type,mbx->data_len,n); - if(mbx->data_len) - { - u_char *b = (u_char *) dpr; - int i; - - b += dpr->buf_ptr[mb]; - for(i=0; i<mbx->data_len; i++) printf(" %x",mbx->data[i]); - printf("."); - for(i=0; i<mbx->data_len; i++) printf(" %x",b[i]); - } - printf("\n"); -} - -static int -nic_connect(int cn, int ap, int b_channel, int inf_mask, int out_serv - ,int out_serv_add, int src_subadr, unsigned ad_len - ,char *dest_addr, int spv) -{ - char buf[128]; - - if (ad_len > 22) - return (-1); - - buf[0] = spv ? 0x53 : 0; - buf[1] = b_channel; - if (spv) - inf_mask |= 0x40000000; - *(u_long *) & buf[2] = inf_mask; - buf[6] = out_serv; - buf[7] = out_serv_add; - buf[8] = src_subadr; - buf[9] = ad_len; - bcopy(dest_addr, &buf[10], ad_len); - return (en_q_d(&nic_sc[isdn_ctrl[cn].unit], DD_CONN_REQ, MK_APPL(ap), ad_len + 10, buf)); -} - -static int -nic_listen(int cn, int ap, int inf_mask, int subadr_mask, int si_mask, int spv) -{ - u_short sbuf[4]; - - *(u_long *) sbuf = inf_mask; - sbuf[2] = subadr_mask; - sbuf[3] = si_mask; - return (en_q_d(&nic_sc[isdn_ctrl[cn].unit], DD_LISTEN_REQ, MK_APPL(ap), 8, (u_char *) sbuf)); -} - -static int -nic_disconnect(int cn, int rea) -{ - isdn_ctrl_t *ctrl = &isdn_ctrl[cn]; - struct nic_softc *sc = &nic_sc[ctrl->unit]; - chan_t *chan = &sc->sc_chan[C_CHAN(cn)]; - u_char buf[16]; - int l = 3; - int p; - int err; - - if(chan->ncci != -1) - { - bzero(buf,16); - *(u_short *) buf = chan->ncci; - l += sizeof(ncpi_t); - err= en_q_b(sc, C_CHAN(cn)?6:4, BD_DISC_B3_REQ, chan->plci, l, buf); - if(err==0) - { - chan->more= 0; - ctrl->o_len= -1; - } - return(err); - } - - p = chan->plci; - if((p == 0) || (p == -1)) - return (ENODEV); - - err= en_q_d(sc, DD_DISC_REQ, p, 1, (u_char *) & rea); - if(err==0) - { - chan->more= 0; - ctrl->o_len= -1; - } - return(err); -} - -static int -nic_accept(int cn, int an, int rea) -{ - isdn_ctrl_t *ctrl = &isdn_ctrl[cn]; - struct nic_softc *sc = &nic_sc[ctrl->unit]; - chan_t *chan = &sc->sc_chan[C_CHAN(cn)]; - isdn_appl_t *appl = &isdn_appl[an]; - - if (rea) - { - ctrl->appl= -1; - return(discon_req(1, sc, chan->plci, rea, 0)); - } - ctrl->appl= an; - ctrl->lastact = time.tv_sec; - appl->ctrl= cn; - appl->state= 4; - - return(sel_b2_prot_req(sc, C_CHAN(cn), chan->plci, &appl->dlpd)); -} - -static int -nic_output(int cn) -{ - isdn_ctrl_t *ctrl = &isdn_ctrl[cn]; - struct nic_softc *sc = &nic_sc[ctrl->unit]; - chan_t *chan = &sc->sc_chan[C_CHAN(cn)]; - int mb = C_CHAN(cn) ? 7 : 5; - dpr_type *dpr = sc->sc_dpr; - mbx_type *mbx = &dpr->dpr_mbx[mb]; - int l; - u_char *b = (u_char *) dpr; - int len= ctrl->o_len; - char *buf= ctrl->o_buf; - - if (dpr->card_state /* & ~4 */) - return (ENODEV); - - if ((chan->ncci == -1) || dpr->msg_flg[mb] || (chan->state != IDLE)) - return (EBUSY); - - chan->state = ACTIVE; - - bzero(mbx, 20); - mbx->type = BD_DATA_B3_REQ; - if (C_CHAN(cn)) - mbx->type |= 0x40; - *(u_short *) mbx->data = chan->ncci; - mbx->data[4] = chan->msg_nr++; - b += dpr->buf_ptr[mb]; - l = min(1024, len); - mbx->data_len = l; - bcopy(buf, b, l); - - if (l < len) - { - chan->more = min(len - l, 1024); /* This is a bug, but */ - /* max. blocks length is 2048 bytes including protokoll */ - chan->more_b = buf + l; - mbx->more_data = 1; - } else - { - chan->more = 0; - ctrl->o_len = -1; - } - - dpr->msg_flg[mb] = 3; - bsintr |= (1 << C_CHAN(cn)); - make_intr(mb, sc); - ctrl->lastact = time.tv_sec; - return (0); -} - -static void -con_resp(struct nic_softc * sc, int pl, int rea) -{ - en_q_d(sc, DD_CONN_RSP, pl, 1, (u_char *) & rea); -} - -static int -discon_req(int w, struct nic_softc * sc, int pl, int rea, int err) -{ - if ((pl == 0) || (pl == -1)) - return(0); - return(en_q_d(sc, DD_DISC_REQ, pl, 1, (u_char *) & rea)); -} - -static int -sel_b2_prot_req(struct nic_softc * sc, int c, int pl, dlpd_t * dlpd) -{ - return(en_q_b(sc, c ? 6 : 4, BD_SEL_PROT_REQ | 0x200, pl, - sizeof(dlpd_t), (u_char *) dlpd)); -} - -static void -sel_b3_prot_req(struct nic_softc * sc, int mb, u_short pl, ncpd_t * ncpd) -{ - en_q_b(sc, mb, BD_SEL_PROT_REQ | 0x300, pl, sizeof(ncpd_t), (u_char *) ncpd); -} - -static void -con_b3_resp(struct nic_softc * sc, int mb, u_short ncci, u_char reject) -{ - u_char buf[32]; - int l = 4; - - bzero(buf, 32); - *(u_short *) buf = ncci; - buf[2] = reject; - buf[3] = 0; /* ncpi ???? */ - l += 15; - en_q_b(sc, mb, BD_CONN_B3_RSP, 0, l, buf); -} - -static int -reset_plci(int w, chan_t * chan, int p) -{ - isdn_ctrl_t *ctrl; - - if (p == -1) - return (-1); - - if(chan == NULL) - return(p); - - ctrl = &isdn_ctrl[chan->ctrl]; - if (chan->plci == p) - { - if (ISBUSY(ctrl->appl)) - { - isdn_disconn_ind(ctrl->appl); - isdn_appl[ctrl->appl].ctrl = -1; - isdn_appl[ctrl->appl].state = 0; - } - ctrl->appl = -1; - ctrl->o_len = -1; - chan->plci = -1; - chan->ncci = -1; - chan->state = DISCON; - chan->i_len = 0; - chan->more = 0; - } - return (p); -} - -static void -reset_card(struct nic_softc * sc) -{ - dpr_type *dpr = sc->sc_dpr; - mbx_type *mbx = &dpr->dpr_mbx[1]; - bzero(mbx, 16); - mbx->type = MD_RESET_REQ; - dpr->msg_flg[1] = 1; - make_intr(1, sc); -} - -/* - * nicopen() New open on device. - * - * We forbid all but first open - */ -static int -nicopen(dev_t dev, int flags, int fmt, struct proc *p) -{ - struct nic_softc *sc; - u_char unit; - dpr_type *dpr; - int x; - - unit = minor(dev); - - /* minor number out of limits ? */ - if (unit >= NNIC) - return (ENXIO); - sc = &nic_sc[unit]; - - sc->sc_flags |= OPEN; - dpr = sc->sc_dpr; - dpr->card_number = sc->sc_unit; - dpr->int_flg_pc = 0xff; - if (dpr->msg_flg[0]) - { - x = splhigh(); - s_intr(sc); - splx(x); - } - return (0); -} - -/* - * nicclose() Close device - */ -static int -nicclose(dev_t dev, int flags, int fmt, struct proc *p) -{ - struct nic_softc *sc = &nic_sc[minor(dev)]; - - sc->sc_flags = 0; - return (0); -} - -static int -nicioctl(dev_t dev, int cmd, caddr_t data, int flags, struct proc *p) -{ - int error; - int x; - struct nic_softc *sc = &nic_sc[minor(dev)]; - dpr_type *dpr = sc->sc_dpr; - mbx_type *mbx; - - dpr->int_flg_pc = 0xff; - - error = 0; - switch (cmd) - { - case NICCY_DEBUG: - data[0]= 0x38; - bcopy((char *)dpr, data+1, sizeof(dpr_type)); - break; - case NICCY_LOAD: - { - struct head *head = (struct head *) data; - u_char *b = (u_char *) dpr; - int len, l, off; - - x = splhigh(); - while (dpr->msg_flg[1]) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic1head", 1); - if (error != EWOULDBLOCK) - { - splx(x); - return (error); - } - } - mbx = &dpr->dpr_mbx[1]; - bzero(mbx, 16); - mbx->type = MD_DNL_MOD_REQ | ((u_short) head->typ << 8); - mbx->data_len = 12; - bcopy(head->nam, mbx->data, 8); - *(u_long *) (mbx->data + 8) = head->len; - - sc->sc_flags = LOAD_HEAD; - sc->sc_stat = -1; - dpr->msg_flg[1] = 1; - make_intr(1, sc); - while (sc->sc_flags == LOAD_HEAD) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic2head", 1); - if (error != EWOULDBLOCK) - break; - } - - len= head->d_len; - off= 0; - b += dpr->buf_ptr[1]; - - while(len > 0) - { - while (dpr->msg_flg[1]) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic1load", 1); - if (error != EWOULDBLOCK) - { - splx(x); - return (error); - } - } - bzero(mbx, 16); - mbx->type = MD_DNL_MOD_DATA | ((u_short) head->typ << 8); - l= min(len,1024); - len-= l; - mbx->buf_valid = 1; - mbx->more_data = len > 0; - mbx->data_len = l; - bcopy(head->nam, mbx->data, 8); - - if(error= copyin(head->data+off, b, l)) - { - splx(x); - return(error); - } - off+= l; - sc->sc_flags = LOAD_DATA; - sc->sc_stat = -1; - dpr->msg_flg[1] = 3; - make_intr(1, sc); - } - - while ((sc->sc_flags == LOAD_DATA) || (dpr->card_state & 0x20)) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic2load", 1); - if (error != EWOULDBLOCK) - break; - } - if (sc->sc_flags) - sc->sc_flags = OPEN; - head->status = sc->sc_stat; - splx(x); - return (0); - } - case NICCY_SET_CLOCK: - x = splhigh(); - if (dpr->msg_flg[1]) - { - splx(x); - return (EBUSY); - } - mbx = &dpr->dpr_mbx[1]; - bzero(mbx, 16); - mbx->type = MD_SET_CLOCK_REQ; - mbx->data_len = 14; - bcopy(data, mbx->data, 14); - - dpr->msg_flg[1] = 1; - if (dpr->int_flg_nic & 2) - make_intr(1, sc); - splx(x); - return (0); - case NICCY_SPY: - x = splhigh(); - if (dpr->msg_flg[1]) - { - splx(x); - return (EBUSY); - } - mbx = &dpr->dpr_mbx[1]; - bzero(mbx, 16); - mbx->type = MD_MANUFACT_REQ | (18<<8); - mbx->data_len = 1; - mbx->add_info = MK_APPL(ispy_applnr); -/* There are ilegal states. So I use them to toggle */ - if((data[0] == 0) && (old_spy == 0)) data[0]= 255; - else if(data[0] && old_spy ) data[0]= 0; - old_spy= mbx->data[0]= data[0]; - - dpr->msg_flg[1] = 1; - if (dpr->int_flg_nic & 2) - make_intr(1, sc); - splx(x); - return (0); - case NICCY_RESET: - x = splhigh(); - - reset_card(sc); - - while (dpr->card_state & 1) /* self test running */ - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic: reset", 10); - if (error != EWOULDBLOCK) - break; - } - dpr->card_number = sc->sc_unit; - dpr->int_flg_pc = 0xff; - if (dpr->msg_flg[0]) - s_intr(sc); - splx(x); - return (0); - - default: - error = ENODEV; - } - return (error); -} - -static void -b_intr(int mb, int c, struct nic_softc * sc) -{ - dpr_type *dpr = sc->sc_dpr; - mbx_type *mbx = &dpr->dpr_mbx[mb]; - chan_t *chan = &sc->sc_chan[c]; - u_short ap, n, err = 0; - u_short pl = mbx->add_info; - isdn_ctrl_t *ctrl = &isdn_ctrl[chan->ctrl]; - - if(((unsigned)(mbx->type >> 8) > 3) || ((pl & 0xff00) == 0xff00)) - panic("3008 conflict with 16 bit card\nReconfig your system"); - - if (dpr->msg_flg[mb+1]) - return; /* can happen. Should make no problems */ - - if (ISBUSY(ap = ctrl->appl)) - switch (mbx->type & 0x1f) - { - case 0: /* SELECT PROT CONF */ - err = *(u_short *) mbx->data; - if (err) - { - discon_req(2, sc, pl, 0, err); - break; - } - - switch ((mbx->type >> 8) & 3) - { - case 2:/* SELECT B2 PROTOCOL */ - sel_b3_prot_req(sc, mb, pl, &isdn_appl[ap].ncpd); - break; - - case 3:/* SELECT B3 PROTOCOL */ - if (IS_DIAL(pl)) - con_b3_req(sc, mb, pl); - else - listen_b3_req(sc, mb, pl); - break; - } - break; - - case 1: /* LISTEN B3 CONF */ - err = *(u_short *) mbx->data; - if (err) - { - discon_req(4, sc, pl, 0, err); - break; - } - con_resp(sc, pl, 0); - break; - - case 2: /* CONNECT B3 CONF */ - err = *(u_short *) (mbx->data + 2); - n = *(u_short *) mbx->data; - - if (err) - { - discon_req(5, sc, pl, 0, err); - break; - } - chan->ncci = n; - chan->state = CONNECT; - break; - - case 3: /* CONNECT B3 IND */ - n = *(u_short *) mbx->data; - chan->ncci = n; - chan->state = CONNECT; - con_b3_resp(sc, mb, n, 0); - break; - - case 4: /* CONNECT B3 ACTIVE IND */ - if (chan->state < IDLE) - { - chan->state = IDLE; - ctrl->o_len = 0; - /* - * XXX the chan->ctrl arg is very bogus. - * Don't just use a cast to "fix" it. - */ - timeout(isdn_start_out, chan->ctrl, hz / 5); - break; - } - break; - - case 5: /* DISCONNECT B3 CONF */ - chan->state = ISDISCON; - err = *(u_short *) (mbx->data + 2); - if (err) - { - discon_req(6, sc, chan->plci, 0, err); - break; - } - break; - case 6: /* DISCONNECT B3 IND */ - chan->state = ISDISCON; - err = *(u_short *) (mbx->data + 2); - discon_req(7, sc, chan->plci, 0, err); - break; - - case 8: /* DATA B3 CONF */ - err = *(u_short *) (mbx->data + 2); - if (err) - { - ctrl->send_err++; - isdn_appl[ap].send_err++; - } - ctrl->o_len = 0; - chan->state= IDLE; - isdn_start_out(chan->ctrl); - break; - - case 9: /* DATA B3 IND */ - { - u_char *b = (u_char *) dpr; - - b += dpr->buf_ptr[mb]; - if (mbx->more_data) - { - chan->morenr= mbx->data[4]; - if(chan->i_len) - { - chan->i_len= 0; - break; - } - bcopy(b, &chan->i_buf[chan->i_len], mbx->data_len); - chan->i_len = mbx->data_len; - break; - } /* mbx->more_data == 0 */ - if (chan->i_len) - { - int l; - if(chan->morenr != mbx->data[4]) - break; - - if ((l = chan->i_len + mbx->data_len) <= 2048) - { - bcopy(b, &chan->i_buf[chan->i_len], mbx->data_len); - if(isdn_input(ap, l, chan->i_buf, ctrl->islisten)) - ctrl->lastact = time.tv_sec; - } - chan->i_len = 0; - break; - } /* chan->i_len == 0 && mbx->more_data == 0 */ - if(isdn_input(ap, mbx->data_len, b, ctrl->islisten)) - ctrl->lastact = time.tv_sec; - break; - } - break; - - default: - badstate(mbx,1,mb,dpr); - } -/* - else badstate(mbx,2,mb,dpr); -*/ - - reset_req(sc, mb,1); -} - -static void -d_intr(struct nic_softc * sc) -{ - dpr_type *dpr = sc->sc_dpr; - mbx_type *mbx = &dpr->dpr_mbx[2]; - chan_t *chan; - u_short ap, c, pl, err = 0; - isdn_ctrl_t *ctrl; - isdn_appl_t *appl; - - if (dpr->msg_flg[3]) - return; /* should not happen. might make problems */ - /* but there should be another intr., so what? */ - - pl = mbx->add_info; - if ((c = CHAN(pl)) < 2) - { - chan = &sc->sc_chan[c]; - ctrl = &isdn_ctrl[chan->ctrl]; - } else - { - c = 0xffff; - chan = NULL; - ctrl = NULL; - } - - ap= APPL(pl); - if(ctrl && (ctrl->appl & 0xC0) == 0) - appl= &isdn_appl[ctrl->appl]; - else if(ap < 0x30) - appl = &isdn_appl[ap]; - else if(ap < 0x40) - appl = NULL; - else - { - reset_req(sc, 2,2); - return; - } - - switch (mbx->type & 0x1f) - { - case 0: /* CONNECT CONF */ - err = *(u_short *) mbx->data; - if(err || (appl == NULL) || (chan == NULL) || (ctrl == NULL)) - { - if(chan) reset_plci(1, chan, pl); - if(appl) appl->state= 0; - break; - } - - if (ISBUSY(ctrl->appl)) - { - discon_req(8, sc, pl, 0, 0); - break; - } - chan->plci = pl; - chan->msg_nr= 0; - chan->ncci = -1; - ctrl->lastact = time.tv_sec; - ctrl->appl = ap; - appl->ctrl = chan->ctrl; - ctrl->islisten= 0; - chan->state = DIAL; - appl->state = 3; - break; - - case 1: /* CONNECT IND */ - if (ISBUSY(ctrl->appl)) - { - discon_req(9, sc, pl, 0, 0); - break; - } - chan->plci = pl; - chan->msg_nr= 0; - chan->ncci = -1; - ctrl->lastact = time.tv_sec; - ctrl->appl = 0x7f; - ctrl->islisten= 1; - chan->state = CALLED; - mbx->data[mbx->data[3] + 4] = 0; - isdn_accept_con_ind(ap, chan->ctrl, mbx->data[0], mbx->data[1] - ,mbx->data[2], mbx->data[3], (char *) &mbx->data[4]); - break; - - case 2: /* CONNECT ACTIVE IND */ - con_act_resp(sc, pl); - if (IS_LISTEN(pl)) - { - isdn_conn_ind(ctrl->appl,chan->ctrl,0); - break; - } - isdn_conn_ind(APPL(pl),chan->ctrl,1); - chan->state = CONNECT; - ctrl->appl = ap; - appl->ctrl = chan->ctrl; - break; - - case 3: /* DISCONNECT CONF */ - reset_plci(2, chan, pl); - break; - - case 4: /* DISCONNECT IND */ - discon_resp(sc, reset_plci(3, chan, pl)); - break; - - case 7: /* LISTEN CONF */ - isdn_state = *(u_short *) mbx->data; - break; - - case 10: /* INFO IND */ - isdn_info(ap,*(u_short *)mbx->data, mbx->data[2], mbx->data+3); - inf_resp(sc, pl); - break; - - default: - badstate(mbx,3,2,dpr); - } - reset_req(sc, 2,2); -} - -static void -s_intr(struct nic_softc * sc) -{ - dpr_type *dpr = sc->sc_dpr; - mbx_type *mbx = &dpr->dpr_mbx[0]; - mbx_type *smbx = &dpr->dpr_mbx[1]; - - if (dpr->msg_flg[1]) - return; /* should not happen. might make problems */ - /* but there should be another intr., so what? */ - - bzero(smbx, 16); - - switch (mbx->type & 0x1f) - { - case 0: /* INIT CONF */ - break; - case 1: /* INIT IND */ - smbx->type = mbx->type + 0x20; - dpr->msg_flg[1] = 1; - make_intr(1, sc); - break; - case 4: /* DNL MOD CONF */ - sc->sc_stat = mbx->data[0]; - if (sc->sc_flags) - sc->sc_flags = OPEN; - break; - case 6: /* DNL MOD IND */ - smbx->type = mbx->type + 0x20; - smbx->data_len = 1; - smbx->data[0] = mbx->data[1]; - sc->sc_stat = mbx->data[0]; - if (sc->sc_flags) - sc->sc_flags = OPEN; - dpr->msg_flg[1] = 1; - make_intr(1, sc); - break; - case 0x0e: /* SET CLOCK CONF */ - dpr->watchdog_cnt = 0xFF; - dpr->int_flg_pc = 0xFF; - dpr->api_active = 1; - break; - case 0x15: /* POLL IND */ - dpr->watchdog_cnt = 0xFF; - dpr->int_flg_pc = 0xFF; - dpr->api_active = 1; - smbx->type = mbx->type + 0x20; - dpr->msg_flg[1] = 1; - make_intr(1, sc); - break; - case 0x1e: /* MANUFACT CONF */ - if(((mbx->type >> 8) == 18 ) && (*mbx->data == 0)) /* LISTEN */ - break; - badstate(mbx,4,0,dpr); - break; - case 0x1f: /* MANUFACT IND */ - if((mbx->type >> 8) == 19 ) /* DATA */ - { - u_char *b = (u_char *) dpr; - b += dpr->buf_ptr[0]; - isdn_input(ispy_applnr, mbx->data_len, b, 0); - smbx->type = mbx->type + 0x20; - dpr->msg_flg[1] = 1; - make_intr(1, sc); - break; - } - default: - badstate(mbx,5,0,dpr); - } - reset_req(sc, 0, 3); -} - -static void -bs_intr(int mb, int c, struct nic_softc * sc) -{ - chan_t *chan = &sc->sc_chan[c]; - isdn_ctrl_t *ctrl = &isdn_ctrl[chan->ctrl]; - - if (chan->state == ACTIVE) - { - if (chan->more) - { - dpr_type *dpr = sc->sc_dpr; - mbx_type *mbx = &dpr->dpr_mbx[mb]; - u_char *b = (u_char *) dpr; - - bzero(mbx, 20); - mbx->type = BD_DATA_B3_REQ; - if (mb == 7) - mbx->type |= 0x40; - *(u_short *) mbx->data = chan->ncci; - mbx->data[4] = chan->msg_nr; - b += dpr->buf_ptr[mb]; - mbx->data_len = chan->more; - bcopy(chan->more_b, b, chan->more); - - chan->more = 0; - ctrl->o_len = -1; - - dpr->msg_flg[mb] = 3; - make_intr(mb, sc); - - ctrl->lastact = time.tv_sec; - return; - } - bsintr &= ~(1 << c); - } -} - -void -nicintr(int unit) -{ - register struct nic_softc *sc = &nic_sc[unit]; - dpr_type *dpr = sc->sc_dpr; - - if (dpr->msg_flg[2]) - d_intr(sc); - if (dpr->msg_flg[0]) - s_intr(sc); - if (dpr->msg_flg[6]) - b_intr(6, 1, sc); - if (dpr->msg_flg[4]) - b_intr(4, 0, sc); - if (bsintr) - { - if (dpr->msg_flg[7] == 0) - bs_intr(7, 1, sc); - if (dpr->msg_flg[5] == 0) - bs_intr(5, 0, sc); - } -} - - -static nic_devsw_installed = 0; - -static void nic_drvinit(void *unused) -{ - dev_t dev; - - if( ! nic_devsw_installed ) { - dev = makedev(CDEV_MAJOR ,0); - cdevsw_add(&dev,&nic_cdevsw, NULL); - nic_devsw_installed = 1; - } -} - -SYSINIT(nicdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,nic_drvinit,NULL) - -#endif /* NNIC > 0 */ diff --git a/sys/gnu/i386/isa/nic3008.h b/sys/gnu/i386/isa/nic3008.h deleted file mode 100644 index 5a87409..0000000 --- a/sys/gnu/i386/isa/nic3008.h +++ /dev/null @@ -1,123 +0,0 @@ -/* @(#)$Id: nic3008.h,v 1.1 1995/02/14 15:00:12 jkh Exp $ - ******************************************************************************* - * II - Version 0.1 $Revision: 1.1 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: nic3008.h,v $ - * Revision 1.1 1995/02/14 15:00:12 jkh - * An ISDN driver that supports the EDSS1 and the 1TR6 ISDN interfaces. - * EDSS1 is the "Euro-ISDN", 1TR6 is the soon obsolete german ISDN Interface. - * Obtained from: Dietmar Friede <dfriede@drnhh.neuhaus.de> and - * Juergen Krause <jkr@saarlink.de> - * - * This is only one part - the rest to follow in a couple of hours. - * This part is a benign import, since it doesn't affect anything else. - * - * - ******************************************************************************/ - -/* - * This file defines the NICCY 3008 Interface. - * Copyright Dr. Neuhaus GmbH, Hamburg and Dietmar Friede - * -*/ - -#pragma pack (1) - -typedef struct { - u_short type; /* Message Subtype/Type */ - u_char source; - u_char dest; - u_short number; /* laufende Nachrichten-Nummer */ - u_short timeoutval; /* Wert fr Timeout */ - u_char priority; /* Nachrichten-Priorit„t */ - u_char more_data; /* Nachricht vollst„ndig? */ - u_short data_len; /* Datenmenge */ - u_char buf_valid; /* im aux. buf.? */ - u_char reserved[1]; - u_short add_info; /* Maske */ - u_char data[0x30];/* Datenfeld */ -} mbx_type; - -/* ------------------------------------------------------------------------ */ - -typedef struct { -/* Offset 0x0000 ---------------------------------------------------------- */ - u_char msg_flg[8]; /* Messages in MBX i */ - u_char card_number; /* Kartennummer of Applikation */ - u_char card_state; /* Kartenstatus */ - u_short mainloop_cnt; /* NICCY's M'loop,68000-Notation*/ - u_char watchdog_cnt; /* Applikation "lebt"? */ - u_char hw_config; /* Steckmodule? */ - u_char jmp_config; /* Karten-Jumper? */ - u_char ram_config; /* Karten-Speicher? */ -/* Offset 0x0010 -----------------------------------------------------------*/ - char niccy_ver[0x0E]; /* "NICCY V x.yyy\c" */ - u_char int_flg_pc; /* Will PC Interrupts? */ - u_char int_flg_nic; /* Will NICCY Interrupts? */ -/* Offset 0x0020 -----------------------------------------------------------*/ - u_short buf_ptr[8]; /* Pointer to aux. buf. ... */ -/* Offset 0x0030 -----------------------------------------------------------*/ - u_short buf_len[8]; /* Size of aux. buf. ... */ -/* Offset 0x0040 -----------------------------------------------------------*/ - /* 0x40 Bytes fr die */ - /* frei verfgbar */ - u_char old_flg[8]; /* Messages in MBX i */ - u_char irq_level; /* welcher IRQ (als Bitmaske */ - u_char res[7]; /* FREI */ -/* Offset 0x0050 -----------------------------------------------------------*/ - u_char api_area_int_nr; /*SW-Int des API wenn API_ACTIVE*/ - u_char api_area_PLCI[2]; /* PLCI w„hrend ApiManufacturer */ - u_char capi_version[6]; /* Versionsnummer der CAPI */ - u_char api_area[0x27]; /* FREI */ -/* Offset 0x0080 -----------------------------------------------------------*/ - u_char api_active; /* Flag ob CAPI aktiv ist */ - u_char ext_hw_config; /* Bit 0: UART 16550 */ - /* Bit 1..7: reserved */ - u_char dpr_hw_id[0x0E]; /* Hardware ID */ -/* Offset 0x0090 -----------------------------------------------------------*/ - u_char dpr_listen_req;/* Anzahl Listen Request's */ - u_char dpr_state_b1; /* state B1 channel */ - /* 0x00 : channel ist frei */ - /* 0x01 : Verbindungsaufb. Req */ - /* 0x02 : Verbindungsaufb. Act */ - /* 0x03 : Verbindung besteht */ - /* 0x04 : eintreffender Ruf */ - /* 0x05 : Verbindung angenommen */ - /* 0x06 : Verbindungsabb. Req */ - /* 0x07 : Verbindungsabb. laeuft*/ - /* 0x08 : Verbindung getrennt */ - u_char dpr_state_b2; /* state B2 channel (siehe oben)*/ - u_char dpr_state_ic1; /* state of Intercomm-Channel */ - u_char dpr_state_ic2; /* ----------- " -------------- */ - u_char state_res[0x04]; - u_char dpr_si_b1; /* Service Indicator auf B1 */ - u_char dpr_si_b2; /* Service Indicator auf B2 */ - u_char dpr_state_res_0[0x05]; -/* Offset 0x00A0 -----------------------------------------------------------*/ - u_char dpr_state_hscx; /* state of HSCX */ - u_char dpr_state_itac; /* state of ITAC */ - u_char dpr_state_arcofi;/* state of ARCOFI */ - u_char dpr_state_modem; /* state of Aufsteckmodem */ - u_char dpr_state_com; /* state of COM */ - u_char dpr_state_res[0x0B]; -/* Offset 0x00B0 -----------------------------------------------------------*/ - u_char dpr_state_ia_tel;/* state of internal Appl. */ - u_char dpr_state_ia_com;/* state of internal Appl. */ - u_char dpr_state_ia_mod;/* state of internal Appl. */ - u_char dpr_state_res_1[0x0D]; -/* Offset 0x00C0 -----------------------------------------------------------*/ - u_char dpr_state_dcp[0x10];/* state of D-channel Prot */ -/* Offset 0x00D0 -----------------------------------------------------------*/ - u_char reserved[0x130]; -/* Offset 0x0200 -----------------------------------------------------------*/ - mbx_type dpr_mbx[8]; /* the mailboxes ... */ -} dpr_type; - -#pragma pack () diff --git a/sys/gnu/i386/isa/nic3009.c b/sys/gnu/i386/isa/nic3009.c deleted file mode 100644 index 2e5a322..0000000 --- a/sys/gnu/i386/isa/nic3009.c +++ /dev/null @@ -1,1358 +0,0 @@ -/* @(#)$Id: nic3009.c,v 1.15 1996/03/28 14:27:28 scrappy Exp $ - ******************************************************************************* - * II - Version 0.1 $Revision: 1.15 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: nic3009.c,v $ - * Revision 1.15 1996/03/28 14:27:28 scrappy - * Switched from using devfs_add_sw() to using devfs_add_swf() - * - * Reviewed by: julian@freebsd.org - * - * Revision 1.14 1995/12/17 21:14:36 phk - * Staticize. - * - * Revision 1.13 1995/12/08 23:19:30 phk - * Julian forgot to make the *devsw structures static. - * - * Revision 1.12 1995/12/08 11:12:47 julian - * Pass 3 of the great devsw changes - * most devsw referenced functions are now static, as they are - * in the same file as their devsw structure. I've also added DEVFS - * support for nearly every device in the system, however - * many of the devices have 'incorrect' names under DEVFS - * because I couldn't quickly work out the correct naming conventions. - * (but devfs won't be coming on line for a month or so anyhow so that doesn't - * matter) - * - * If you "OWN" a device which would normally have an entry in /dev - * then search for the devfs_add_devsw() entries and munge to make them right.. - * check out similar devices to see what I might have done in them in you - * can't see what's going on.. - * for a laugh compare conf.c conf.h defore and after... :) - * I have not doen DEVFS entries for any DISKSLICE devices yet as that will be - * a much more complicated job.. (pass 5 :) - * - * pass 4 will be to make the devsw tables of type (cdevsw * ) - * rather than (cdevsw) - * seems to work here.. - * complaints to the usual places.. :) - * - * Revision 1.11 1995/11/29 14:39:08 julian - * If you're going to mechanically replicate something in 50 files - * it's best to not have a (compiles cleanly) typo in it! (sigh) - * - * Revision 1.10 1995/11/29 10:47:05 julian - * OK, that's it.. - * That's EVERY SINGLE driver that has an entry in conf.c.. - * my next trick will be to define cdevsw[] and bdevsw[] - * as empty arrays and remove all those DAMNED defines as well.. - * - * Revision 1.9 1995/11/21 14:56:02 bde - * Completed function declarations, added prototypes and removed redundant - * declarations. - * - * Revision 1.8 1995/09/19 18:54:42 bde - * Fix benign type mismatches in isa interrupt handlers. Many returned int - * instead of void. - * - * Revision 1.7 1995/09/08 11:06:47 bde - * Fix benign type mismatches in devsw functions. 82 out of 299 devsw - * functions were wrong. - * - * Revision 1.6 1995/05/11 19:25:56 rgrimes - * Fix -Wformat warnings from LINT kernel. - * - * Revision 1.5 1995/03/28 07:54:33 bde - * Add and move declarations to fix all of the warnings from `gcc -Wimplicit' - * (except in netccitt, netiso and netns) that I didn't notice when I fixed - * "all" such warnings before. - * - * Revision 1.4 1995/02/16 08:06:21 jkh - * Fix a few bogons introduced when config lost the 3 char limitation. - * - * Revision 1.3 1995/02/15 11:59:41 jkh - * Fix a few more nits. Should compile better now! :_) - * - * Revision 1.2 1995/02/15 06:28:20 jkh - * Fix up include paths, nuke some warnings. - * - * Revision 1.1 1995/02/14 15:00:14 jkh - * An ISDN driver that supports the EDSS1 and the 1TR6 ISDN interfaces. - * EDSS1 is the "Euro-ISDN", 1TR6 is the soon obsolete german ISDN Interface. - * Obtained from: Dietmar Friede <dfriede@drnhh.neuhaus.de> and - * Juergen Krause <jkr@saarlink.de> - * - * This is only one part - the rest to follow in a couple of hours. - * This part is a benign import, since it doesn't affect anything else. - * - * - ******************************************************************************/ - -/* - * Copyright (c) 1994 Dietmar Friede (dietmar@friede.de) All rights reserved. - * FSF/FSAG GNU Copyright applies - * - * A low level driver for the NICCY-3009 ISDN Card. - * - */ - -#include "nnic.h" -#if NNNIC > 0 - -#include <sys/param.h> -#include <sys/ioctl.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/conf.h> -#include <sys/proc.h> -#ifdef DEVFS -#include <sys/devfsext.h> -#endif /*DEVFS*/ - -#include <i386/isa/isa_device.h> -#include <gnu/i386/isa/nic3009.h> -#include <gnu/i386/isa/niccyreg.h> -#include <gnu/isdn/isdn_ioctl.h> - - -#define OPEN 1 -#define LOAD_HEAD 3 -#define LOAD_DATA 5 -#define LOAD_ENTITY 8 -#define IS_DIAL(p) (((p)&0x20)==0) -#define IS_LISTEN(p) ((p)&0x20) -#define CHAN(pl) (((pl)&7)-1) -#define C_CHAN(x) ((x)&1) -#define APPL(pl) ((((pl)>>6)&0x7f)-1) -#define CARD(pl) (((pl)>>13)&7) -#define MK_APPL(pl) (((pl)+1)<<6) - -#define min(a,b) ((a)<(b)?(a):(b)) - -extern isdn_appl_t isdn_appl[]; -extern u_short isdn_state; -extern isdn_ctrl_t isdn_ctrl[]; -extern int ispy_applnr; -extern int Isdn_Appl, Isdn_Ctrl, Isdn_Typ; - -static old_spy= 0; - -static int nnicattach __P((struct isa_device *is)); -static int nnicprobe __P((struct isa_device *is)); -static int nnic_accept __P((int cn, int an, int rea)); -static int nnic_connect __P((int cn, int ap, int b_channel, int inf_mask, - int out_serv, int out_serv_add, - int src_subadr, unsigned ad_len, - char *dest_addr, int spv)); -static int nnic_disconnect __P((int cn, int rea)); -static int nnic_listen __P((int cn, int ap, int inf_mask, - int subadr_mask, int si_mask, int spv)); -static int nnic_output __P((int cn)); -static int nnic_state __P((int cn)); - -static d_open_t nnicopen; -static d_close_t nnicclose; -static d_ioctl_t nnicioctl; - -#define CDEV_MAJOR 60 -static struct cdevsw nnic_cdevsw = - { nnicopen, nnicclose, noread, nowrite, /*60*/ - nnicioctl, nostop, nullreset, nodevtotty,/* nnic */ - seltrue, nommap, NULL, "nnic", NULL, -1 }; - - -static short bsintr; - -struct isa_driver nnicdriver = {nnicprobe, nnicattach, "nnic"}; - -typedef enum -{ - DISCON, ISDISCON, DIAL, CALLED, CONNECT, IDLE, ACTIVE -} io_state; - -typedef struct -{ - char ctrl; - u_char msg_nr; - u_char morenr; - short plci; - short ncci; - short state; - short i_len; - char i_buf[2048]; - char o_buf[2048]; - u_short more; - char *more_b; -} chan_t; - -static struct nnic_softc -{ - dpr_type *sc_dpr; /* card RAM virtual memory base */ - u_short sc_vector; /* interrupt vector */ - short sc_port; - u_char sc_flags; - u_char sc_unit; - u_char sc_ctrl; - u_char sc_type; - short sc_stat; - chan_t sc_chan[2]; -#ifdef DEVFS - void *devfs_token; -#endif -} nnic_sc[NNNIC]; - -static void badstate __P((mbx_type *mbx, int n, int mb, dpr_type *dpr)); -static int con_b3_resp __P((int unit, int mb, u_short ncci, u_short pl, - u_char reject)); -static int discon_req __P((int w, int unit, int pl, int rea, int err)); -static int con_resp __P((int unit, int pl, int rea)); -static void dn_intr __P((unsigned unit, struct nnic_softc *sc)); -static int en_q __P((int unit, int t, int st, int pl, int l, u_char *b)); -static void make_intr __P((void *gen)); -static void nnnicintr __P((void *gen)); -static void nnic_reset __P((struct nnic_softc *sc, int reset)); -static int reset_plci __P((int w, chan_t *chan, int p)); -static int sel_b2_prot_req __P((int unit, int c, int pl, dlpd_t *dlpd)); -static int sel_b3_prot_req __P((int unit, int mb, u_short pl, - ncpd_t *ncpd)); -static void up_intr __P((unsigned unit, struct nnic_softc *sc)); - -static int -nnicprobe(struct isa_device * is) -{ - register struct nnic_softc *sc = &nnic_sc[is->id_unit & 127]; - dpr_type *dpr; - u_char *w; - int i; - - sc->sc_vector = is->id_irq; - sc->sc_port = is->id_iobase; - sc->sc_unit = is->id_unit; - w= (u_char *) dpr = sc->sc_dpr = (dpr_type *) is->id_maddr; - - i= ffs(sc->sc_vector)-1; - if(i == 9) i= 1; - outb(sc->sc_port, 0); - outb(sc->sc_port+1, i); - outb(sc->sc_port, ((unsigned) dpr >> 12) & 0xff); - -/* There should be memory, so lets test that */ - for (i=0;i<DPR_LEN;i++) - w[i] = (i+0xaf) & 0xff; - for (i=0;i<DPR_LEN;i++) - if (w[i] != ((i+0xaf) & 0xff)) - { - printf("Niccy card not found or bad memory %p\n", - is->id_maddr); - outb(sc->sc_port, 0); - return(0); - } - bzero(w,DPR_LEN-4); - - is->id_msize = DPR_LEN; - return (2); -} - -static void -nnic_reset(struct nnic_softc *sc, int reset) -{ - u_char o; - o= ffs(sc->sc_vector)-1; - if(reset == 0) - o|= 0x80; - outb(sc->sc_port+1,o); -} - -/* - * nnicattach() Install device - */ -static int -nnicattach(struct isa_device * is) -{ - struct nnic_softc *sc; - int cn; - isdn_ctrl_t *ctrl0, *ctrl1; - - sc = &nnic_sc[is->id_unit]; - sc->sc_ctrl = -1; - if ((cn = isdn_ctrl_attach(2)) == -1) - { - return (0); - } - sc->sc_ctrl = cn; - sc->sc_chan[0].plci = sc->sc_chan[1].plci = -1; - - ctrl0 = &isdn_ctrl[cn]; - ctrl1 = &isdn_ctrl[cn + 1]; - sc->sc_chan[0].ctrl = ctrl0->ctrl = cn; - sc->sc_chan[1].ctrl = ctrl1->ctrl = cn + 1; - ctrl0->o_buf = sc->sc_chan[0].o_buf; - ctrl1->o_buf = sc->sc_chan[1].o_buf; - ctrl0->listen = ctrl1->listen = nnic_listen; - ctrl0->disconnect = ctrl1->disconnect = nnic_disconnect; - ctrl0->accept = ctrl1->accept = nnic_accept; - ctrl0->connect = ctrl1->connect = nnic_connect; - ctrl0->output = ctrl1->output = nnic_output; - ctrl0->state = ctrl1->state = nnic_state; - ctrl0->unit = ctrl1->unit = is->id_unit; - ctrl0->appl = ctrl1->appl = -1; - ctrl0->o_len = ctrl1->o_len = -1; - sc->sc_flags= LOAD_ENTITY; -#ifdef DEVFS - sc->devfs_token = - devfs_add_devswf(&nnic_cdevsw, is->id_unit, DV_CHR, 0, 0, - 0600, "/isdn/nnic%d", is->id_unit); -#endif - - return (1); -} - -#define con_b3_req(unit,mb,pl) en_q(unit,mb|BD_CONN_B3_REQ,0,pl,0,NULL) -#define con_act_resp(unit,pl) en_q(unit,DD_CONN_ACT_RSP,0, pl,0,NULL) -#define discon_resp(sc,pl) en_q(unit,DD_DISC_RSP,0, pl,0,NULL) -#define inf_resp(unit,pl) en_q(unit,DD_INFO_RSP,0, pl,0,NULL) -#define listen_b3_req(unit,mb,pl) en_q(unit,mb|BD_LIST_B3_REQ,0,pl,0,NULL) - -/* If the Niccy card wants it: Interupt it. */ -static void -make_intr(void *gen) -{ - struct nnic_softc * sc = (struct nnic_softc *)gen; - dpr_type *dpr = sc->sc_dpr; - - dpr->watchdog_cnt = 0xFF; - - if (dpr->int_flg_nic) - dpr->signal_pc_to_niccy++; -} - -static int -en_q(int unit, int t, int st, int pl, int l, u_char *b) -{ - struct nnic_softc * sc= &nnic_sc[unit]; - dpr_type *dpr = sc->sc_dpr; - mbx_type *mbx = &dpr->dn_mbx; - -/* - if (dpr->card_state & ~4) - return (ENODEV); -*/ - if (mbx->msg_flag) - return (EBUSY); - - bzero(&mbx->type, 18); - mbx->type = t; - mbx->subtype = st; - mbx->plci = pl; - if (l) - { - mbx->data_len = l; - bcopy(b, mbx->data, l); - } - mbx->msg_flag = 1; - make_intr(sc); - return (0); -} - -static void -badstate(mbx_type * mbx, int n, int mb, dpr_type *dpr) -{ - printf("Niccy: not implemented %x len %d at %d.", mbx->type,mbx->data_len,n); - if(mbx->data_len) - { - int i; - - for(i=0; i<mbx->data_len; i++) printf(" %x",mbx->data[i]); - } - printf("\n"); -} - -static int -nnic_state(int cn) -{ - isdn_ctrl_t *ctrl = &isdn_ctrl[cn]; - struct nnic_softc *sc = &nnic_sc[ctrl->unit]; - chan_t *chan0 = &sc->sc_chan[0]; - chan_t *chan1 = &sc->sc_chan[1]; - dpr_type *dpr = sc->sc_dpr; - - if(sc->sc_flags == LOAD_ENTITY) - return(ENODEV); - if (dpr->card_state & ~4 ) - return (ENODEV); - if (dpr->card_state & 4 ) - return (EAGAIN); - if(chan0->state && chan1->state) - return(EBUSY); - return(0); -} - -static int -nnic_output(int cn) -{ - isdn_ctrl_t *ctrl = &isdn_ctrl[cn]; - struct nnic_softc *sc = &nnic_sc[ctrl->unit]; - chan_t *chan = &sc->sc_chan[C_CHAN(cn)]; - dpr_type *dpr = sc->sc_dpr; - mbx_type *mbx = &dpr->dn_mbx; - int l; - int len= ctrl->o_len; - - if (dpr->card_state /* & ~4 */) - return (ENODEV); - - if (bsintr || (chan->ncci == -1) || mbx->msg_flag || (chan->state != IDLE)) - return (EBUSY); - - chan->state = ACTIVE; - - bzero(&mbx->type, 20); - mbx->type = BD_DATA_B3_REQ; - if (C_CHAN(cn)) - mbx->type |= 0x40; - *(u_short *) mbx->data = chan->ncci; - mbx->data[4] = chan->msg_nr; - l = min(DATAFIELD_LEN-5, len); - mbx->data_len = l+5; - bcopy(ctrl->o_buf, &mbx->data[5], l); - - if (l < len) - { - chan->more = len - l; - chan->more_b = ctrl->o_buf + l; - mbx->more_data = 1; - bsintr = C_CHAN(cn)+1; - } else - { - chan->more = 0; - ctrl->o_len = -1; - bsintr= 0; - ++chan->msg_nr; - } - - mbx->msg_flag = 1; - make_intr(sc); - ctrl->lastact = time.tv_sec; - return (0); -} - -static int -con_resp(int unit, int pl, int rea) -{ - return(en_q(unit, DD_CONN_RSP, 0, pl, 1, (u_char *) & rea)); -} - -static int -reset_plci(int w, chan_t * chan, int p) -{ - isdn_ctrl_t *ctrl; - - if (p == -1) - return (-1); - - if(chan == NULL) - return(p); - - ctrl = &isdn_ctrl[chan->ctrl]; - if (chan->plci == p) - { - if (ISBUSY(ctrl->appl)) - { - isdn_disconn_ind(ctrl->appl); - isdn_appl[ctrl->appl].ctrl = -1; - isdn_appl[ctrl->appl].state = 0; - } - ctrl->appl = -1; - ctrl->o_len = -1; - chan->plci = -1; - chan->ncci = -1; - chan->state = DISCON; - chan->i_len = 0; - chan->more = 0; - } - return (p); -} - -static int -sel_b2_prot_req(int unit, int c, int pl, dlpd_t * dlpd) -{ - return(en_q(unit, (c ? 0x40 : 0)| BD_SEL_PROT_REQ, 2, pl, sizeof(dlpd_t), (u_char *) dlpd)); -} - -static int -sel_b3_prot_req(int unit, int mb, u_short pl, ncpd_t * ncpd) -{ - return(en_q(unit, mb | BD_SEL_PROT_REQ, 3, pl, sizeof(ncpd_t), (u_char *) ncpd)); -} - -static int -discon_req(int w, int unit , int pl, int rea, int err) -{ - if((pl == 0) || (pl == -1)) - return(0); - return(en_q(unit, DD_DISC_REQ,0, pl, 1, (u_char *) &rea)); -} - -static int -con_b3_resp(int unit, int mb, u_short ncci, u_short pl, u_char reject) -{ - u_char buf[32]; - int l = 4; - - bzero(buf, 32); - *(u_short *) buf = ncci; - buf[2] = reject; - buf[3] = 0; /* ncpi ??? */ - l += 15; - return(en_q(unit, mb | BD_CONN_B3_RSP,0, pl, l, buf)); -} - -static int -nnic_connect(int cn, int ap, int b_channel, int inf_mask, int out_serv - ,int out_serv_add, int src_subadr, unsigned ad_len - ,char *dest_addr, int spv) -{ - char buf[128]; - - if (ad_len > 118) - return (-1); - - buf[0] = spv ? 0x53 : 0; - buf[1] = b_channel; - if (spv) - inf_mask |= 0x40000000; - *(u_long *) & buf[2] = inf_mask; - buf[6] = out_serv; - buf[7] = out_serv_add; - buf[8] = src_subadr; - buf[9] = ad_len; - bcopy(dest_addr, &buf[10], ad_len); - return (en_q(isdn_ctrl[cn].unit, DD_CONN_REQ, 0, MK_APPL(ap), ad_len + 10, buf)); -} - -static int -nnic_listen(int cn, int ap, int inf_mask, int subadr_mask, int si_mask, int spv) -{ - u_short sbuf[4]; - - if (spv) - inf_mask |= 0x40000000; - *(u_long *) sbuf = inf_mask; - sbuf[2] = subadr_mask; - sbuf[3] = si_mask; - return (en_q(isdn_ctrl[cn].unit, DD_LISTEN_REQ, 0, MK_APPL(ap), 8, (u_char *) sbuf)); -} - -static int -nnic_disconnect(int cn, int rea) -{ - isdn_ctrl_t *ctrl = &isdn_ctrl[cn]; - chan_t *chan = &nnic_sc[ctrl->unit].sc_chan[C_CHAN(cn)]; - int p, err; - u_char buf[16]; - - if(chan->ncci != -1) - { - bzero(buf,16); - *(u_short *) buf = chan->ncci; - err= en_q(ctrl->unit, (C_CHAN(cn)?0x40:0)|BD_DISC_B3_REQ, 0 - , chan->plci, 3+sizeof(ncpi_t), buf); - if((err==0) && (ctrl->o_len == 0)) - ctrl->o_len= -1; - return(err); - } - p = chan->plci; - if ((p == 0) || (p == -1)) - return (ENODEV); - - err= en_q(ctrl->unit, DD_DISC_REQ, 0, p, 1, (u_char *) &rea); - if((err==0) && (ctrl->o_len == 0)) - ctrl->o_len= -1; - return(err); -} - -static int -nnic_accept(int cn, int an, int rea) -{ - isdn_ctrl_t *ctrl = &isdn_ctrl[cn]; - struct nnic_softc *sc = &nnic_sc[ctrl->unit]; - chan_t *chan = &sc->sc_chan[C_CHAN(cn)]; - isdn_appl_t *appl = &isdn_appl[an]; - - if(ISFREE(ctrl->appl)) - return(ENODEV); - - if (rea) - { - ctrl->appl= -1; - return(discon_req(1, ctrl->unit, chan->plci, rea, 0)); - } - ctrl->appl= an; - ctrl->lastact = time.tv_sec; - appl->ctrl= cn; - appl->state= 4; - - return(sel_b2_prot_req(ctrl->unit, C_CHAN(cn), chan->plci, &appl->dlpd)); -} - -static int -nnicopen(dev_t dev, int flags, int fmt, struct proc *p) -{ - struct nnic_softc *sc; - u_char unit; - int x; - - unit = minor(dev); - /* minor number out of limits ? */ - if (unit >= NNNIC) - return (ENXIO); - sc = &nnic_sc[unit]; - - x= splhigh(); - /* Card busy ? */ -/* - if (sc->sc_flags & 7) - { - splx(x); - return (EBUSY); - } -*/ - sc->sc_flags |= OPEN; - - splx(x); - return (0); -} - -static int -nnicclose(dev_t dev, int flags, int fmt, struct proc *p) -{ - struct nnic_softc *sc = &nnic_sc[minor(dev)]; - - sc->sc_flags &= ~7; - return (0); -} - -static int -nnicioctl(dev_t dev, int cmd, caddr_t data, int flags, struct proc *pr) -{ - int error; - int i, x; - struct nnic_softc *sc = &nnic_sc[minor(dev)]; - dpr_type *dpr = sc->sc_dpr; - mbx_type *mbx= &dpr->dn_mbx; - u_char *p= (u_char *)dpr; - struct head *head = (struct head *) data; - - error = 0; - switch (cmd) - { - case NICCY_DEBUG: - data[0]= 0x39; - bcopy(p, &data[1], 2044); - break; - case NICCY_LOAD: - switch(head->status) - { - case 0: /* Loading initial boot code */ - x = splhigh(); - nnic_reset(sc,1); - if(error = copyin(head->data+0x16,p, head->d_len-0x16)) - { - splx(x); - return (error); - } - nnic_reset(sc,0); - i= hz; - while (p[7] && i--) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "l9_0", 1); - if (error != EWOULDBLOCK) - { - splx(x); - return (error); - } - } - nnic_reset(sc,1); - splx(x); - if(p[7]) return(ENODEV); - return(0); - - case 1: /* Loading boot code */ - x = splhigh(); - - if(error = copyin(head->data+0x64,p, head->d_len-0x64)) - { - splx(x); - return (error); - } - nnic_reset(sc,0); - i= 5*hz; - while ((dpr->mainloop_cnt != 0x1147) && i--) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "l9_1", 1); - if (error != EWOULDBLOCK) - { - splx(x); - return (error); - } - } - - if(dpr->mainloop_cnt != 0x1147) - { - splx(x); - return(ENODEV); - } - - i= 1*hz; - while ((dpr->up_mbx.type != 1) && i--) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "l9_2", 1); - if (error != EWOULDBLOCK) - { - splx(x); - return (error); - } - } - if(dpr->up_mbx.type != 1) - { - splx(x); - return(ENODEV); - } - bzero(&mbx->type, 16); - dpr->up_mbx.msg_flag= 0; - mbx->type= 0x21; - mbx->msg_flag= 1; - - i= 1*hz; - while (mbx->msg_flag && i--) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "l9_3", 1); - if (error != EWOULDBLOCK) - { - splx(x); - return (error); - } - } - if(mbx->msg_flag) - { - splx(x); - return(ENODEV); - } - - head->status= 0; - splx(x); - return(0); - - default: - x = splhigh(); - while (mbx->msg_flag) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "l9_1h", 1); - if (error != EWOULDBLOCK) - { - splx(x); - return (error); - } - } - - bzero(&mbx->type, 16); - mbx->type = MD_DNL_MOD_REQ; - mbx->subtype = head->typ; - sc->sc_type = head->typ; - mbx->data_len = 12; - bcopy(head->nam, mbx->data, 8); - *(u_long *) (mbx->data + 8) = head->len; - - mbx->msg_flag = 1; - make_intr(sc); - i= 1*hz; - while ((dpr->up_mbx.msg_flag == 0) && i--) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "l9_2", 1); - if (error != EWOULDBLOCK) - { - splx(x); - return (error); - } - } - - if((dpr->up_mbx.type != MU_DNL_MOD_CNF) || dpr->up_mbx.data[0]) - { - dpr->up_mbx.msg_flag= 0; - make_intr(sc); - splx(x); - return(ENODEV); - } - dpr->up_mbx.msg_flag= 0; - make_intr(sc); - { - int len, l, off; - len= head->d_len; - off= 0; - l= 0x64; - - while(len > 0) - { - while (mbx->msg_flag) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "l9_4load", 1); - if (error != EWOULDBLOCK) - { - splx(x); - return (error); - } - } - mbx->type = MD_DNL_MOD_DATA; - len-= l; - mbx->more_data = len > 0; - mbx->data_len = l; - if(error= copyin(head->data+off, mbx->data, l)) - { - splx(x); - return (error); - } - off+= l; - l= min(len,512); - mbx->msg_flag = 1; - make_intr(sc); - } - } - - i= 3*hz; - while ((dpr->up_mbx.msg_flag == 0) && i--) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "l9_2", 1); - if (error != EWOULDBLOCK) - { - splx(x); - return (error); - } - } - if(dpr->up_mbx.type == 0) - { - dpr->up_mbx.msg_flag= 0; - make_intr(sc); - i= 3*hz; - while ((dpr->up_mbx.msg_flag == 0) && i--) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "l9_3", 1); - if (error != EWOULDBLOCK) - { - splx(x); - return (error); - } - } - } - - if(dpr->up_mbx.type != MU_DNL_MOD_IND) - { - dpr->up_mbx.msg_flag= 0; - make_intr(sc); - splx(x); - return(ENODEV); - } - head->status = dpr->up_mbx.data[0]; - mbx->data[0] = dpr->up_mbx.data[1]; - mbx->type= 0x20|MU_DNL_MOD_IND; - mbx->subtype = head->typ; - mbx->data_len = 1; - dpr->card_number = sc->sc_unit; - dpr->up_mbx.msg_flag= 0; - mbx->msg_flag= 1; - make_intr(sc); - splx(x); - return (0); - } - splx(x); - return(0); - case NICCY_SET_CLOCK: - x = splhigh(); - dpr->int_flg_pc = 0xff; - dpr->card_number = sc->sc_unit; - if (mbx->msg_flag) - { - splx(x); - return (EBUSY); - } - bzero(&mbx->type, 16); - mbx->type = MD_SET_CLOCK_REQ; - mbx->data_len = 14; - bcopy(data, mbx->data, 14); - - mbx->msg_flag = 1; - make_intr(sc); - splx(x); - return (0); - case NICCY_SPY: - x = splhigh(); - if (mbx->msg_flag) - { - splx(x); - return (EBUSY); - } - bzero(&mbx->type, 16); - mbx->type = MD_MANUFACT_REQ; - mbx->subtype = 18; - mbx->data_len = 1; - mbx->plci = MK_APPL(ispy_applnr); -/* There are ilegal states. So I use them to toggle */ - if((data[0] == 0) && (old_spy == 0)) data[0]= 255; - else if(data[0] && old_spy ) data[0]= 0; - old_spy= mbx->data[0]= data[0]; - - mbx->msg_flag = 1; - make_intr(sc); - splx(x); - return (0); - - case NICCY_RESET: - x = splhigh(); - nnic_reset(sc,1); - bzero((u_char*)dpr,DPR_LEN); - sc->sc_flags= LOAD_ENTITY; - splx(x); - return (0); - - default: - error = ENODEV; - } - return (error); -} - -static void -dn_intr(unsigned unit, struct nnic_softc * sc) -{ - dpr_type *dpr = sc->sc_dpr; - mbx_type *mbx= &dpr->dn_mbx; - chan_t *chan; - isdn_ctrl_t *ctrl; - int c,l, len; - - c= bsintr-1; - chan = &sc->sc_chan[c]; - ctrl = &isdn_ctrl[chan->ctrl]; - - if ((chan->state == ACTIVE) && (chan->more)) - { - len= chan->more; - - bzero(&mbx->type, 20); - mbx->type = BD_DATA_B3_REQ; - if (c) - mbx->type |= 0x40; - *(u_short *) mbx->data = chan->ncci; - mbx->data[4] = chan->msg_nr; - l = min(DATAFIELD_LEN-5, len); - mbx->data_len = l+5; - bcopy(chan->more_b, &mbx->data[5], l); - - if (l < len) - { - chan->more = len - l; - chan->more_b += l; - mbx->more_data = 1; - } else - { - chan->more = 0; - ctrl->o_len = -1; - bsintr= 0; - ++chan->msg_nr; - } - - mbx->msg_flag = 1; - make_intr(sc); - ctrl->lastact = time.tv_sec; - return; - } - bsintr= 0; -} - -static void -up_intr(unsigned unit, struct nnic_softc * sc) -{ - dpr_type *dpr = sc->sc_dpr; - mbx_type *msg= &dpr->up_mbx; - chan_t *chan; - u_short n, mb, c, pl, err = 0; - isdn_ctrl_t *ctrl; - isdn_appl_t *appl; - int error= 0; - - chan= NULL; - ctrl= NULL; - appl= NULL; - mb= 0; - pl = msg->plci; - - if(pl && (msg->type >= 0x40) && (msg->type < 0xfd) && (msg->type != 0x47)) - { - if ((c = CHAN(pl)) < 2) - { - chan = &sc->sc_chan[c]; - ctrl = &isdn_ctrl[chan->ctrl]; - } else - { - c = 0xffff; - chan= NULL; - ctrl= NULL; - } - - if(ctrl && (ctrl->appl & 0xC0) == 0) - appl= &isdn_appl[ctrl->appl]; - else if( APPL(pl) < 0x30) - appl = &isdn_appl[APPL(pl)]; - else if( APPL(pl) < 0x40) - appl= NULL; - else goto fin; - - if(msg->type >= 0x80) - { - mb= msg->type & 0x40; - msg->type &= 0xbf; - } - } - - switch (msg->type) - { - case 0x01: /* INIT IND */ - if(dpr->dn_mbx.msg_flag) return; - error= en_q(unit,msg->type|0x20,0,0,0,NULL); - break; - case 0x04: /* DNL MOD */ - sc->sc_stat = msg->data[0]; - if (sc->sc_flags ) - sc->sc_flags = OPEN; - break; - case 0x06: /* DNL MOD IND */ - if(dpr->dn_mbx.msg_flag) return; - sc->sc_stat = msg->data[0]; - if (sc->sc_flags) - sc->sc_flags = OPEN; - if(sc->sc_stat) - break; - error= en_q(unit,msg->type|0x20,sc->sc_type,0,1, &msg->data[1]); - break; - case 0x0e: /* SET CLOCK CONF */ - dpr->card_number = unit; -/* - dpr->api_active = 1; - dpr->watchdog_cnt = 0xFF; - dpr->api_area[0] = 0; - dpr->api_area[2] = 0; -*/ - dpr->int_flg_pc = 0xFF; - break; - case 0x15: /* POLL IND */ - if(dpr->dn_mbx.msg_flag) return; - dpr->api_active = 1; - dpr->watchdog_cnt = 0xFF; - dpr->int_flg_pc = 0xFF; - error= en_q(unit,msg->type|0x20,0,0,0,NULL); - break; - case 0x16: /* STATE IND */ - if(dpr->dn_mbx.msg_flag) return; - if(sc->sc_flags & LOAD_ENTITY) - { - if(sc->sc_flags & 7) - sc->sc_flags = OPEN; - else sc->sc_flags= 0; - } - error= en_q(unit,msg->type|0x20,0,0,0,NULL); - break; - case 0x17: /* STATE RESP */ - break; - case 0x1e: /* MANUFACT CONF */ - if(msg->subtype == 18) - break; - badstate(msg,1,0,dpr); - break; - case 0x1f: /* MANUFACT IND */ - if(msg->subtype == 19) - { - if(dpr->dn_mbx.msg_flag) return; - isdn_input(ispy_applnr, msg->data_len, msg->data,0); - error= en_q(unit,msg->type|0x20,msg->subtype,0,0,NULL); - break; - } - badstate(msg,2,0,dpr); - break; - case 0x40: /* CONNECT CONF */ - err = *(u_short *) msg->data; - if (err || (appl == NULL) || (chan == NULL) || (ctrl == NULL)) - { - if(chan) reset_plci(3, chan, pl); - if(appl) appl->state= 0; - break; - } - if (ISBUSY(ctrl->appl)) - { - if(dpr->dn_mbx.msg_flag) return; - error= discon_req(2, unit, pl, 0, 0); - break; - } - chan->plci = pl; - chan->msg_nr = 0; - chan->ncci = -1; - ctrl->lastact = time.tv_sec; - ctrl->appl = APPL(pl); - appl->ctrl = chan->ctrl; - ctrl->islisten= 0; - chan->state = DIAL; - appl->state= 3; - break; - - case 0x41: /* CONNECT IND */ - if (ISBUSY(ctrl->appl)) - { - if(dpr->dn_mbx.msg_flag) return; - error= discon_req(3, unit, pl, 0, 0); - break; - } - chan->plci = pl; - chan->msg_nr = 0; - chan->ncci = -1; - ctrl->lastact = time.tv_sec; - ctrl->appl = 0x7f; - ctrl->islisten= 1; - chan->state = CALLED; - msg->data[msg->data[3] + 4] = 0; - isdn_accept_con_ind(APPL(pl), chan->ctrl, msg->data[0], msg->data[1] - ,msg->data[2], msg->data[3], (char *) &msg->data[4]); - break; - - case 0x42: /* CONNECT ACTIVE IND */ - if(dpr->dn_mbx.msg_flag) return; - error= con_act_resp(unit, pl); - if (IS_LISTEN(pl)) - { - isdn_conn_ind(ctrl->appl,chan->ctrl,0); - break; - } - isdn_conn_ind(APPL(pl),chan->ctrl,1); - chan->state = CONNECT; - ctrl->appl = APPL(pl); - appl->ctrl = chan->ctrl; - break; - - case 0x43: /* DISCONNECT CONF */ - reset_plci(4, chan, pl); - break; - - case 0x44: /* DISCONNECT IND */ - if(dpr->dn_mbx.msg_flag) return; - error= discon_resp(unit, reset_plci(5, chan, pl)); - break; - - case 0x47: /* LISTEN CONF */ - isdn_state = *(u_short *) msg->data; - break; - - case 0x4a: /* INFO IND */ - if(dpr->dn_mbx.msg_flag) return; - isdn_info(APPL(pl),*(u_short *)msg->data, msg->data[2], msg->data+3); - error= inf_resp(unit, pl); - break; - case 0x80: /* SELECT PROT CONF */ - if(dpr->dn_mbx.msg_flag) return; - err = *(u_short *) msg->data; - if (err) - { - error= discon_req(4, unit, pl, 0, err); - break; - } - - switch (msg->subtype) - { - case 2:/* SELECT B2 PROTOCOL */ - if(ISFREE(ctrl->appl)) - break; - error= sel_b3_prot_req(unit, mb, pl, &isdn_appl[ctrl->appl].ncpd); - break; - - case 3:/* SELECT B3 PROTOCOL */ - if (IS_DIAL(pl)) - error= con_b3_req(unit, mb, pl); - else - error= listen_b3_req(unit, mb, pl); - break; - } - break; - - case 0x81: /* LISTEN B3 CONF */ - if(dpr->dn_mbx.msg_flag) return; - err = *(u_short *) msg->data; - if (err) - { - error= discon_req(5, unit, pl, 0, err); - break; - } - error= con_resp(unit, pl, 0); - break; - - case 0x82: /* CONNECT B3 CONF */ - err = *(u_short *) (msg->data + 2); - n = *(u_short *) msg->data; - - if (err) - { - if(dpr->dn_mbx.msg_flag) return; - error= discon_req(6, unit, pl, 0, err); - break; - } - if(ISFREE(ctrl->appl)) - break; - chan->ncci = n; - chan->state = CONNECT; - break; - - case 0x83: /* CONNECT B3 IND */ - if(ISFREE(ctrl->appl)) - break; - if(dpr->dn_mbx.msg_flag) return; - n = *(u_short *) msg->data; - chan->ncci = n; - chan->state = CONNECT; - error= con_b3_resp(unit, mb, n, pl, 0); - break; - - case 0x84: /* CONNECT B3 ACTIVE IND */ - if(ISFREE(ctrl->appl)) - break; - if (chan->state < IDLE) - { - chan->state = IDLE; - ctrl->o_len = 0; - /* - * XXX the chan->ctrl arg is very bogus. - * Don't just use a cast to "fix" it. - */ - timeout(isdn_start_out, chan->ctrl, hz / 5); - } - break; - - case 0x85: /* DISCONNECT B3 CONF */ - if(ISBUSY(ctrl->appl)) - chan->state = ISDISCON; - err = *(u_short *) (msg->data + 2); - if (err) - { - if(dpr->dn_mbx.msg_flag) return; - error= discon_req(7, unit, pl, 0, err); - break; - } - break; - case 0x86: /* DISCONNECT B3 IND */ - if(dpr->dn_mbx.msg_flag) return; - if(ISBUSY(ctrl->appl)) - chan->state = ISDISCON; - err = *(u_short *) (msg->data + 2); - error= discon_req(8, unit, pl, 0, err); - break; - - case 0x88: /* DATA B3 CONF */ - if(ISFREE(ctrl->appl)) - break; - err = *(u_short *) (msg->data + 2); - if (err) - { - ctrl->send_err++; - isdn_appl[ctrl->appl].send_err++; - } - chan->state = IDLE; - ctrl->o_len = 0; - isdn_start_out(chan->ctrl); - break; - - case 0x89: /* DATA B3 IND */ - if(ISFREE(ctrl->appl)) - break; - if (msg->more_data) - { - if(chan->i_len) - { - if((chan->morenr != msg->data[4]) || ((chan->i_len + msg->data_len - 5) > 2048)) - break; - } - else - chan->morenr= msg->data[4]; - bcopy(msg->data+5, &chan->i_buf[chan->i_len], msg->data_len-5); - chan->i_len += msg->data_len -5; - break; - } /* msg->more_data == 0 */ - if (chan->i_len) - { - int l; - - if(chan->morenr != msg->data[4]) - break; - - if ((l = chan->i_len + msg->data_len - 5) <= 2048) - { - bcopy(msg->data+5, &chan->i_buf[chan->i_len], msg->data_len); - if(isdn_input(ctrl->appl, l, chan->i_buf, ctrl->islisten)) - ctrl->lastact = time.tv_sec; - } - chan->i_len = 0; - break; - } /* chan->i_len == 0 && msg->more_data == 0 */ - if(isdn_input(ctrl->appl, msg->data_len-5, msg->data+5,ctrl->islisten)) - ctrl->lastact = time.tv_sec; - break; - - default: - badstate(msg,3,mb,dpr); - break; - } - -fin: - if(error) - { -printf("E?%x",error); - return; - } - msg->msg_flag= 0; - timeout(make_intr, (void *)sc,1); -} - -static void -nnnicintr(void *gen) -{ - unsigned int unit = (int)gen; - register struct nnic_softc *sc = &nnic_sc[unit]; - dpr_type *dpr = sc->sc_dpr; - - if(dpr->up_mbx.msg_flag) - up_intr(unit,sc); - if (bsintr && (dpr->dn_mbx.msg_flag == 0)) - dn_intr(unit,sc); -} -void -nnicintr(int unit) -{ - timeout(nnnicintr, (void *)unit,1); -} - - -static nnic_devsw_installed = 0; - -static void nnic_drvinit(void *unused) -{ - dev_t dev; - - if( ! nnic_devsw_installed ) { - dev = makedev(CDEV_MAJOR, 0); - cdevsw_add(&dev,&nnic_cdevsw, NULL); - nnic_devsw_installed = 1; - } -} - -SYSINIT(nnicdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,nnic_drvinit,NULL) - -#endif /* NNNIC > 0 */ diff --git a/sys/gnu/i386/isa/nic3009.h b/sys/gnu/i386/isa/nic3009.h deleted file mode 100644 index 8e794cc..0000000 --- a/sys/gnu/i386/isa/nic3009.h +++ /dev/null @@ -1,88 +0,0 @@ -/* @(#)$Id: nic3009.h,v 1.1 1995/02/14 15:00:16 jkh Exp $ - ******************************************************************************* - * II - Version 0.1 $Revision: 1.1 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: nic3009.h,v $ - * Revision 1.1 1995/02/14 15:00:16 jkh - * An ISDN driver that supports the EDSS1 and the 1TR6 ISDN interfaces. - * EDSS1 is the "Euro-ISDN", 1TR6 is the soon obsolete german ISDN Interface. - * Obtained from: Dietmar Friede <dfriede@drnhh.neuhaus.de> and - * Juergen Krause <jkr@saarlink.de> - * - * This is only one part - the rest to follow in a couple of hours. - * This part is a benign import, since it doesn't affect anything else. - * - * - ******************************************************************************/ - -/* - * This file defines the NICCY 3009 Interface. Copyright Dr. Neuhaus GmbH, - * Hamburg and Dietmar Friede - * - */ - -#define NO_MORE_DATA 0x00 /* der Message folgen keine Daten */ -#define MORE_DATA 0x01 /* der Message folgen weitere Daten */ - -#define DPR_LEN 0x800 /* 2 kBytes gross */ -#define DPR_VAR_AREA_LEN 0x100 /* davon fuer allg. Variablen */ - -#define DPR_MBX_LEN (DPR_LEN-DPR_VAR_AREA_LEN)/2 /* 0x380 lang */ -#define DPR_MBX_FLAG_LEN 2 /* zwei Bytes MBX-Zustand... */ -#define DPR_MSG_HDR_LEN 10 /* Msg-Laenge ohne Datafield */ -#define DATAFIELD_LEN (DPR_MBX_LEN-DPR_MBX_FLAG_LEN-DPR_MSG_HDR_LEN) -#define MAX_B3_LEN (2048+2) /* Daten und Network-Header */ - -#pragma pack (1) -typedef struct -{ - u_char msg_flag; /* Signalisierung NICCY / PC */ - u_char progress; /* NICCY-interne Verwendung ! */ - u_char type; - u_char subtype; - u_short number; - u_char more_data; - u_char reserved; - u_short data_len; - u_short plci; - u_char data[DATAFIELD_LEN]; -} mbx_type; - -typedef struct -{ - mbx_type up_mbx; /* Offset 0x000-0x37F */ - mbx_type dn_mbx; /* Offset 0x380-0x6FF */ - u_char card_number; /* Offset 0x700 */ - u_char card_state; /* Offset 0x701 */ - u_short mainloop_cnt; /* Offset 0x702-0x703 */ - u_char watchdog_cnt; /* Offset 0x704 */ - u_char hw_config; /* Offset 0x705 */ - u_char int_flg_pc; /* Offset 0x706 */ - u_char int_flg_nic; /* Offset 0x707 */ - u_char api_area[64]; /* Offset 0x708-0x747 */ - u_char api_active; /* Offset 0x748 */ - u_char tei; /* Offset 0x749 */ - u_char state_b1; /* Offset 0x74A */ - u_char state_b2; /* Offset 0x74B */ - u_char si_b1; /* Offset 0x74C */ - u_char si_b2; /* Offset 0x74D */ - u_short calls_in; /* Offset 0x74E-0x74F */ - u_short calls_out; /* Offset 0x750-0x751 */ - u_char ram_config; /* Offset 0x752 */ - u_char spv_request_flag; /* Offset 0x753 */ - u_char dcp_state_b1; /* Offset 0x754 */ - u_char dcp_state_b2; /* Offset 0x755 */ - u_char dc_protocol; /* Offset 0x756 */ - u_char poll_flag; /* Offset 0x757 */ - u_char debug[DPR_LEN - 0x758 - 4]; /* Offset 0x758-0x7FB */ - u_short signal_niccy_to_pc; /* Offset 0x7FC-0x7FD */ - u_short signal_pc_to_niccy; /* Offset 0x7FE-0x7FF */ -} dpr_type; -#pragma pack () diff --git a/sys/gnu/i386/isa/niccyreg.h b/sys/gnu/i386/isa/niccyreg.h deleted file mode 100644 index a696148..0000000 --- a/sys/gnu/i386/isa/niccyreg.h +++ /dev/null @@ -1,167 +0,0 @@ -/* @(#)$Id: niccyreg.h,v 1.1 1995/02/14 15:00:19 jkh Exp $ - ******************************************************************************* - * II - Version 0.1 $Revision: 1.1 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: niccyreg.h,v $ - * Revision 1.1 1995/02/14 15:00:19 jkh - * An ISDN driver that supports the EDSS1 and the 1TR6 ISDN interfaces. - * EDSS1 is the "Euro-ISDN", 1TR6 is the soon obsolete german ISDN Interface. - * Obtained from: Dietmar Friede <dfriede@drnhh.neuhaus.de> and - * Juergen Krause <jkr@saarlink.de> - * - * This is only one part - the rest to follow in a couple of hours. - * This part is a benign import, since it doesn't affect anything else. - * - * - ******************************************************************************/ - -/* - * This file defines the NICCY 3008 Interface. - * Copyright Dr. Neuhaus GmbH, Hamburg and Dietmar Friede - * -*/ - -#define MBX_MU 0 -#define MBX_MD 1 -#define MBX_DU 2 -#define MBX_DD 3 -#define MBX_B1U 4 -#define MBX_B1D 5 -#define MBX_B2U 6 -#define MBX_B2D 7 - -#define MBX_xU 0x55 -#define MBX_xD 0xAA - -/* -------------------------------------------------------------------- */ - -#define MU_INIT_CNF 0x00 -#define MU_INIT_IND 0x01 -#define MU_RESET_CNF 0x02 -#define MU_HANDSET_IND 0x03 -#define MU_DNL_MOD_CNF 0x04 -/* reserved: 0x05 */ -#define MU_DNL_MOD_IND 0x06 -#define MU_DISC_MOD_CNF 0x07 -#define MU_LIST_MOD_CNF 0x08 -#define MU_LIST_MOD_DATA 0x09 -/* reserved: 0x0A to 0x0B */ -#define MU_HW_CONFIG_CNF 0x0C -#define MU_HW_ID_CNF 0x0D -#define MU_SET_CLOCK_CNF 0x0E -#define MU_GET_CLOCK_CNF 0x0F -#define MU_ACT_IA_CNF 0x10 -#define MU_ACT_IA_IND 0x11 -#define MU_DEACT_IA_CNF 0x12 -#define MU_DEACT_IA_IND 0x13 -#define MU_POLL_CNF 0x14 -#define MU_POLL_IND 0x15 -/* reserved: 0x16 to 0x1D */ -#define MU_MANUFACT_CNF 0x1E -#define MU_MANUFACT_IND 0x1F - -/*---------------------------------------------------------------------------*/ - -#define MD_INIT_REQ 0x20 -#define MD_INIT_RSP 0x21 -#define MD_RESET_REQ 0x22 -#define MD_HANDSET_RSP 0x23 -#define MD_DNL_MOD_REQ 0x24 -#define MD_DNL_MOD_DATA 0x25 -#define MD_DNL_MOD_RSP 0x26 -#define MD_DISC_MOD_REQ 0x27 -#define MD_LIST_MOD_REQ 0x28 -/* reserved: 0x29 to 0x2B */ -#define MD_HW_CONFIG_REQ 0x2C -#define MD_HW_ID_REQ 0x2D -#define MD_SET_CLOCK_REQ 0x2E -#define MD_GET_CLOCK_REQ 0x2F -#define MD_ACT_IA_REQ 0x30 -#define MD_ACT_IA_RSP 0x31 -#define MD_DEACT_IA_REQ 0x32 -#define MD_DEACT_IA_RSP 0x33 -#define MD_POLL_REQ 0x34 -#define MD_POLL_RSP 0x35 -#define MD_STATE_IND 0x37 -#define MD_MANUFACT_REQ 0x3E -#define MD_MANUFACT_RSP 0x3F - -/*---------------------------------------------------------------------------*/ - -#define DU_CONN_CNF 0x40 -#define DU_CONN_IND 0x41 -#define DU_CONN_ACT_IND 0x42 -#define DU_DISC_CNF 0x43 -#define DU_DISC_IND 0x44 -#define DU_DATA_CNF 0x45 -#define DU_DATA_IND 0x46 -#define DU_LISTEN_CNF 0x47 -#define DU_GET_PAR_CNF 0x48 -#define DU_INFO_CNF 0x49 -#define DU_INFO_IND 0x4A -#define DU_CONN_INFO_CNF 0x4B -#define DU_REL_PLCI_CNF 0x4C -/* reserved: 0x4C to 0x5E */ -#define DU_STR_NOT_COMP 0x5F - -/*---------------------------------------------------------------------------*/ - -#define DD_CONN_REQ 0x60 -#define DD_CONN_RSP 0x61 -#define DD_CONN_ACT_RSP 0x62 -#define DD_DISC_REQ 0x63 -#define DD_DISC_RSP 0x64 -#define DD_DATA_REQ 0x65 -#define DD_DATA_RSP 0x66 -#define DD_LISTEN_REQ 0x67 -#define DD_GET_PAR_REQ 0x68 -#define DD_INFO_REQ 0x69 -#define DD_INFO_RSP 0x6A -#define DD_CONN_INFO_REQ 0x6B -#define DD_REL_PLCI_REQ 0x6C - -/*---------------------------------------------------------------------------*/ - -#define BD_SEL_PROT_REQ 0xA0 -#define BD_LIST_B3_REQ 0xA1 -#define BD_CONN_B3_REQ 0xA2 -#define BD_CONN_B3_RSP 0xA3 -#define BD_C_B3_ACT_RSP 0xA4 -#define BD_DISC_B3_REQ 0xA5 -#define BD_DISC_B3_RSP 0xA6 -#define BD_GET_P_B3_REQ 0xA7 -#define BD_DATA_B3_REQ 0xA8 -#define BD_DATA_B3_RSP 0xA9 -#define BD_RESET_B3_REQ 0xAA -#define BD_RESET_B3_RSP 0xAB - -/*---------------------------------------------------------------------------*/ - - -#define NICCY_DEBUG _IOWR('N',1,dbg_type) -#define NICCY_RESET _IOWR('N',2,int) -#define NICCY_LOAD _IOWR('N',3,struct head) -#define NICCY_SET_CLOCK _IOWR('N',4,time_str_t) -#define NICCY_SPY _IOWR('N',5,int) - -struct head -{ - u_long len; - u_long sig; - char nam[8]; - char ver[5]; - u_char typ; - u_short status; - u_long d_len; - u_char *data; -}; - -typedef char time_str_t[14]; -typedef u_char dbg_type[10000]; diff --git a/sys/gnu/isdn/if_ii.c b/sys/gnu/isdn/if_ii.c deleted file mode 100644 index d9da5fd..0000000 --- a/sys/gnu/isdn/if_ii.c +++ /dev/null @@ -1,245 +0,0 @@ -/* @(#)$Id: if_ii.c,v 1.6 1996/06/12 05:02:18 gpalmer Exp $ - ******************************************************************************* - * II - Version 0.1 $Revision: 1.6 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - */ - -/* - * Copyright (c) 1994 Dietmar Friede (dietmar@friede.de) All rights reserved. - * FSF/FSAG GNU Copyright applies - * - * A high level ip isdn driver. - * - * Uses loop driver as template. Small - and simple - is beautiful. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/mbuf.h> -#include <sys/socket.h> -#include <sys/errno.h> -#include <sys/ioctl.h> -#include <sys/protosw.h> - -#include <net/if.h> -#include <net/if_types.h> -#include <net/netisr.h> -#include <net/route.h> - -#ifdef INET -#include <netinet/in.h> -#include <netinet/in_systm.h> -#include <netinet/in_var.h> -#include <netinet/ip.h> -#endif - -#include "ii.h" -#include <gnu/isdn/isdn_ioctl.h> - -#define IIMTU 1500 - -static struct ifnet ii_if[NII]; -static int applnr[NII]; -static int next_if = 0; - -static int ii_ioctl __P((struct ifnet *ifp, int cmd, caddr_t data)); -static int iioutput __P((struct ifnet *ifp, struct mbuf *m, - struct sockaddr *dst, struct rtentry *rtp)); - -int -iiattach(int ap) -{ - register struct ifnet *ifp; - - if (next_if >= NII) - return -1; - - applnr[next_if] = ap; - ifp = &ii_if[next_if]; - ifp->if_unit = next_if; - ifp->if_name = "ii"; - ifp->if_mtu = IIMTU; - ifp->if_flags = IFF_SIMPLEX | IFF_POINTOPOINT ; - ifp->if_ioctl = ii_ioctl; - ifp->if_output = iioutput; - ifp->if_type = IFT_ISDNBASIC; - ifp->if_hdrlen = 0; - ifp->if_addrlen = 0; - ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; - if_attach(ifp); - /* ifp->if_flags |= IFF_RUNNING; */ - return next_if++; -} - -static int -iioutput(struct ifnet * ifp, struct mbuf * m, struct sockaddr * dst, - struct rtentry * rtp) -{ - int s; - - if (dst->sa_family != AF_INET) - { - m_freem(m); - return EAFNOSUPPORT; - } - s = splhigh(); - if (IF_QFULL(&ifp->if_snd)) - { - IF_DROP(&ifp->if_snd); - m_freem(m); - ifp->if_oerrors++; - isdn_output(applnr[ifp->if_unit]); - splx(s); - return (ENOBUFS); - } - IF_ENQUEUE(&ifp->if_snd, m); - - ifp->if_opackets++; - ifp->if_obytes += m->m_pkthdr.len; - - isdn_output(applnr[ifp->if_unit]); - splx(s); - return (0); -} - -int -ii_input(int no, int len, char *buf, int dir) -{ - struct mbuf *m; - struct ifnet *ifp = &(ii_if[no]); - int s; - - s = splhigh(); - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == 0) - { - splx(s); - return (0); - } - - if (len >= MHLEN) - { - MCLGET(m, M_DONTWAIT); - if ((m->m_flags & M_EXT) == 0) - { - (void) m_free(m); - splx(s); - return (0); - } - } - bcopy((caddr_t) buf, mtod(m, caddr_t), len); - m->m_pkthdr.rcvif = ifp; - m->m_pkthdr.len = len; - m->m_len = len; - - if (IF_QFULL(&ipintrq)) - { - IF_DROP(&ipintrq); - ifp->if_ierrors++; - m_freem(m); - splx(s); - return(0); - } - IF_ENQUEUE(&ipintrq, m); - ifp->if_ipackets++; - schednetisr(NETISR_IP); - splx(s); - return(len); -} - -void -ii_connect(int no) -{ - struct ifnet *ifp = &ii_if[no]; - ifp->if_flags |= IFF_RUNNING; -} - -void -ii_disconnect(int no) -{ - struct ifnet *ifp = &ii_if[no]; - ifp->if_flags &= ~IFF_RUNNING; -} - -int -ii_out(int no, char *buf, int len) -{ - struct ifnet *ifp = &ii_if[no]; - struct mbuf *m0, *m; - int l; - - IF_DEQUEUE(&ifp->if_snd, m); - if (m == 0) - { - return (0); - } - /* - * Copy the mbuf chain into the transmit buf - */ - l = 0; - for (m0 = m; m != 0; m = m->m_next) - { - if((l+= m->m_len) > len) - { - m_freem(m0); - return(0); - } - bcopy(mtod(m, caddr_t), buf, m->m_len); - buf += m->m_len; - } - m_freem(m0); - - return (l); -} - -/* - * Process an ioctl request. - */ -static int -ii_ioctl(ifp, cmd, data) - register struct ifnet *ifp; - int cmd; - caddr_t data; -{ - struct ifaddr *ifa = (struct ifaddr *) data; - struct ifreq *ifr = (struct ifreq *) data; - int s; - - switch (cmd) - { - case SIOCSIFDSTADDR: - case SIOCAIFADDR: - case SIOCSIFADDR: - if (ifa->ifa_addr->sa_family != AF_INET) - return(EAFNOSUPPORT); - ifp->if_flags |= IFF_UP; - /* FALLTHROUGH */ - case SIOCSIFFLAGS: - s= splhigh(); - if((!(ifp->if_flags & IFF_UP)) && (ifp->if_flags & IFF_RUNNING)) - { - isdn_disconnect(applnr[ifp->if_unit],0); - ifp->if_flags &= ~IFF_RUNNING; - } - break; - case SIOCSIFMTU: - ifr->ifr_metric = ifp->if_mtu; - break; - case SIOCGIFMTU: - if(ifr->ifr_metric < 2048) - return(EAFNOSUPPORT); - ifp->if_mtu = ifr->ifr_metric; - break; - default: -printf("IIO %x",cmd); - return(EINVAL); - } - return(0); -} diff --git a/sys/gnu/isdn/iispy.c b/sys/gnu/isdn/iispy.c deleted file mode 100644 index 4b6e83a..0000000 --- a/sys/gnu/isdn/iispy.c +++ /dev/null @@ -1,201 +0,0 @@ -/* @(#)$Id: iispy.c,v 1.11 1996/03/28 14:27:51 scrappy Exp $ - ******************************************************************************* - * II - Version 0.1 $Revision: 1.11 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - */ - -#include "ispy.h" -#if NISPY > 0 - -#include <sys/param.h> -#include <sys/buf.h> -#include <sys/systm.h> -#include <sys/ioctl.h> -#include <sys/tty.h> -#include <sys/proc.h> -#include <sys/uio.h> -#include <sys/kernel.h> -#include <sys/conf.h> -#ifdef DEVFS -#include <sys/devfsext.h> -#endif /*DEVFS*/ -/*#include "malloc.h"*/ - -#include <gnu/isdn/isdn_ioctl.h> - - -int ispy_applnr; -static int next_if =0; -static unsigned long ispy_cnt, ispy_out; -static const char dir = 0; -#define ISPY_SIZE 260 -#define OPEN 1 -#define READ_WAIT 2 -#define ISPYBUF 16 -#define ISPYMASK (ISPYBUF-1) -/* ISPYBUF has to be a power of 2 */ - -static -struct ispy_data -{ - struct ispy_buf - { - unsigned long cnt; - struct timeval stamp; - char ibuf[ISPY_SIZE]; - unsigned char dir; - int ilen; - } b[ISPYBUF]; - int state; -#ifdef DEVFS - void *devfs_token; -#endif -} ispy_data[NISPY]; - -static d_open_t ispyopen; -static d_close_t ispyclose; -static d_read_t ispyread; -static d_ioctl_t ispyioctl; - -#define CDEV_MAJOR 59 -static struct cdevsw ispy_cdevsw = - { ispyopen, ispyclose, ispyread, nowrite, /*59*/ - ispyioctl, nostop, nullreset, nodevtotty,/* ispy */ - seltrue, nommap, NULL, "ispy", NULL, -1 }; - - -int -ispyattach(int ap) -{ - struct ispy_data *ispy; - - if(next_if >= NISPY) - return(-1); - ispy= &ispy_data[next_if]; - ispy->state= 0; - ispy_applnr= ap; -#ifdef DEVFS - ispy->devfs_token = - devfs_add_devswf(&ispy_cdevsw, next_if, DV_CHR, 0, 0, - 0600, "isdn/ispy%d", next_if); -#endif - return(next_if++); -} - -int -ispy_input(int no, int len, char *buf, int out) -{ - struct ispy_data *ispy= &ispy_data[no]; - struct ispy_buf *b= &ispy->b[ispy_cnt&ISPYMASK]; - - if(len > ISPY_SIZE) - return(0); - if(len) - { - b->cnt= ispy_cnt++; - b->stamp= time; - b->dir= out; - bcopy(buf, b->ibuf, len); - } - b->ilen= len; - if(ispy->state & READ_WAIT) - { - ispy->state &= ~READ_WAIT; - wakeup((caddr_t) &ispy->state); - } - return(len); -} - -static int -ispyopen(dev_t dev, int flags, int fmt, struct proc *p) -{ - struct ispy_data *ispy; - - if (minor(dev)>NISPY) - return (ENXIO); - - ispy= &ispy_data[minor(dev)]; - - if(ispy->state&OPEN) return(EBUSY); - ispy->state |= OPEN; - - return (0); -} - -static int -ispyclose(dev_t dev, int flags, int fmt, struct proc *p) -{ - struct ispy_data *ispy= &ispy_data[minor(dev)]; - - if(ispy->state & READ_WAIT) - wakeup((caddr_t) &ispy->state); - ispy->state = 0; - return (0); -} - -static int -ispyioctl (dev_t dev, int cmd, caddr_t data, int flags, struct proc *p) -{ - switch (cmd) { - default: - return (ENOTTY); - } - return (0); -} - -static int -ispyread(dev_t dev, struct uio * uio, int ioflag) -{ - int x; - int error = 0; - struct ispy_data *ispy= &ispy_data[minor(dev)]; - struct ispy_buf *b; - - if((ispy_cnt-ispy_out) > ISPYBUF) - ispy_out= ispy_cnt - ISPYBUF; - b= &ispy->b[ispy_out&ISPYMASK]; - ispy_out++; - while(b->ilen == 0) - { - ispy->state |= READ_WAIT; - if(error= tsleep((caddr_t) &ispy->state, TTIPRI | PCATCH, "ispy", 0 )) - return(error); - } - - x = splhigh(); - if(b->ilen) - { - error = uiomove((char *) &b->dir, 1, uio); - if(error == 0) - error = uiomove((char *) &b->cnt - ,sizeof(unsigned long)+sizeof(struct timeval)+b->ilen, uio); - b->ilen= 0; - } - splx(x); - return error; -} - -static ispy_devsw_installed = 0; - -static void -ispy_drvinit(void *unused) -{ - dev_t dev; - - if( ! ispy_devsw_installed ) { - dev = makedev(CDEV_MAJOR, 0); - cdevsw_add(&dev,&ispy_cdevsw, NULL); - ispy_devsw_installed = 1; - } -} - -SYSINIT(ispydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ispy_drvinit,NULL) - -#endif diff --git a/sys/gnu/isdn/iitel.c b/sys/gnu/isdn/iitel.c deleted file mode 100644 index f28f294..0000000 --- a/sys/gnu/isdn/iitel.c +++ /dev/null @@ -1,262 +0,0 @@ -/* @(#)$Id: iitel.c,v 1.13 1996/04/07 13:20:40 bde Exp $ - ******************************************************************************* - * II - Version 0.1 $Revision: 1.13 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - */ - -#include "itel.h" -#if NITEL > 0 - -#include <sys/param.h> -#include <sys/buf.h> -#include <sys/systm.h> -#include <sys/conf.h> -#include <sys/ioctl.h> -#include <sys/proc.h> -#include <sys/uio.h> -#include <sys/kernel.h> -#include <sys/malloc.h> -#ifdef DEVFS -#include <sys/devfsext.h> -#endif /*DEVFS*/ - -#include "gnu/isdn/isdn_ioctl.h" - - -static int applnr[NITEL]; -static int next_if =0; -#define ITEL_SIZE 1024 -#define OPEN 1 -#define CONNECT 2 -#define READ_WAIT 4 -#define WRITE_WAIT 8 -#define min(a,b) ((a)<(b)?(a):(b)) - -static d_open_t itelopen; -static d_close_t itelclose; -static d_read_t itelread; -static d_write_t itelwrite; -static d_ioctl_t itelioctl; - -#define CDEV_MAJOR 57 -static struct cdevsw itel_cdevsw = - { itelopen, itelclose, itelread, itelwrite, /*57*/ - itelioctl, nostop, nullreset, nodevtotty,/* itel */ - seltrue, nommap, NULL, "itel", NULL, -1 }; - -static -struct itel_data -{ - char ibuf[ITEL_SIZE]; - char obuf[ITEL_SIZE]; - int state; - int ilen, olen; -#ifdef DEVFS - void *devfs_token; -#endif -} itel_data[NITEL]; - -int -itelattach(int ap) -{ - struct itel_data *itel; - - if(next_if >= NITEL) - return(-1); - itel= &itel_data[next_if]; - itel->ilen= itel->olen= 0; - itel->state= 0; - applnr[next_if]= ap; -#ifdef DEVFS - itel->devfs_token = - devfs_add_devswf(&itel_cdevsw, next_if, DV_CHR, 0, 0, - 0600, "isdn/itel%d", next_if); -#endif - return(next_if++); -} - -int -itel_input(int no, int len, char *buf, int dir) -{ - struct itel_data *itel= &itel_data[no]; - - if(itel->ilen || ( len > ITEL_SIZE)) - return(0); - if(len) - bcopy(buf, itel->ibuf, len); - itel->ilen= len; - if(itel->state & READ_WAIT) - { - itel->state &= ~READ_WAIT; - wakeup((caddr_t) itel->ibuf); - } - return(len); -} - -int -itel_out(int no, char *buf, int len) -{ - struct itel_data *itel= &itel_data[no]; - int l; - - if((itel->state & CONNECT) == 0) - return(0); - if((l= itel->olen) && (itel->olen <= len)) - bcopy(itel->obuf, buf, l); - - itel->olen= 0; - if(itel->state & WRITE_WAIT) - { - itel->state &= ~WRITE_WAIT; - wakeup((caddr_t) itel->obuf); - } - return(l); -} - -void -itel_connect(int no) -{ - itel_data[no].state |= CONNECT; -} - -void -itel_disconnect(int no) -{ - struct itel_data *itel= &itel_data[no]; - int s; - - s= itel->state; - if(itel->state &= OPEN) - { - itel->ilen= itel->olen= 0; - if(s & READ_WAIT) - wakeup((caddr_t) itel->ibuf); - if(s & WRITE_WAIT) - wakeup((caddr_t) itel->obuf); - } -} - -int -itelopen(dev_t dev, int flags, int fmt, struct proc *p) -{ - struct itel_data *itel; - - if (minor(dev)>NITEL) - return (ENXIO); - - itel= &itel_data[minor(dev)]; - if((itel->state & CONNECT) == 0) - return(EIO); - - if(itel->state&OPEN) return(0); - itel->ilen= itel->olen= 0; - itel->state |= OPEN; - - return (0); -} - -int -itelclose(dev_t dev, int flags, int fmt, struct proc *p) -{ - struct itel_data *itel= &itel_data[minor(dev)]; - - if(itel->state & READ_WAIT) - wakeup((caddr_t) itel->ibuf); - if(itel->state & WRITE_WAIT) - wakeup((caddr_t) itel->obuf); - itel_data[minor(dev)].state &= CONNECT; - return (0); -} - -int -itelioctl (dev_t dev, int cmd, caddr_t data, int flags, struct proc *p) -{ - switch (cmd) { - default: - return (ENOTTY); - } - return (0); -} - -int -itelread(dev_t dev, struct uio * uio, int ioflag) -{ - int x; - int error = 0; - struct itel_data *itel= &itel_data[minor(dev)]; - - if((itel->state & CONNECT) == 0) - return(EIO); - - while((itel->ilen == 0) && (itel->state & CONNECT)) - { - itel->state |= READ_WAIT; - tsleep((caddr_t) itel->ibuf, PZERO | PCATCH, "itelrd", 0); - } - - x = splhigh(); - if(itel->ilen) - { - error = uiomove(itel->ibuf, itel->ilen, uio); - itel->ilen= 0; - } else error= EIO; - splx(x); - return error; -} - -int -itelwrite(dev_t dev, struct uio * uio, int ioflag) -{ - int x; - int error = 0; - struct itel_data *itel= &itel_data[minor(dev)]; - - if((itel->state & CONNECT) == 0) - return(EIO); - - while(itel->olen && (itel->state & CONNECT)) - { - itel->state |= WRITE_WAIT; - tsleep((caddr_t) itel->obuf, PZERO | PCATCH, "itelwr", 0); - } - - x = splhigh(); - if((itel->state & CONNECT) == 0) - { - splx(x); - return(0); - } - - if(itel->olen == 0) - { - itel->olen= min(ITEL_SIZE, uio->uio_resid); - error = uiomove(itel->obuf, itel->olen, uio); - isdn_output(applnr[minor(dev)]); - } - splx(x); - return error; -} - -static itel_devsw_installed = 0; - -static void itel_drvinit(void *unused) -{ - dev_t dev; - - if( ! itel_devsw_installed ) { - dev = makedev(CDEV_MAJOR, 0); - cdevsw_add(&dev,&itel_cdevsw, NULL); - itel_devsw_installed = 1; - } -} - -SYSINIT(iteldev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,itel_drvinit,NULL) - -#endif diff --git a/sys/gnu/isdn/iitty.c b/sys/gnu/isdn/iitty.c deleted file mode 100644 index 51df7a8..0000000 --- a/sys/gnu/isdn/iitty.c +++ /dev/null @@ -1,362 +0,0 @@ -/* @(#)$Id: iitty.c,v 1.21 1996/04/02 22:06:23 gpalmer Exp $ - ******************************************************************************* - * II - Version 0.1 $Revision: 1.21 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - */ - -#include "ity.h" -#if NITY > 0 - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/conf.h> -#include <sys/ioctl.h> -#include <sys/select.h> -#include <sys/tty.h> -#include <sys/proc.h> -#include <sys/file.h> -#include <sys/uio.h> -#include <sys/kernel.h> -#include <sys/syslog.h> -#include <sys/types.h> -#ifdef DEVFS -#include <sys/devfsext.h> -#endif /*DEVFS*/ - -#include "gnu/isdn/isdn_ioctl.h" - -static d_open_t ityopen; -static d_close_t ityclose; -static d_read_t ityread; -static d_write_t itywrite; -static d_ioctl_t ityioctl; -static d_stop_t itystop; -static d_devtotty_t itydevtotty; - -#define CDEV_MAJOR 56 -static struct cdevsw ity_cdevsw = - { ityopen, ityclose, ityread, itywrite, /*56*/ - ityioctl, itystop, noreset, itydevtotty,/* ity */ - ttselect, nommap, NULL, "ity", NULL, -1 }; - - -static int ityparam __P((struct tty *tp, struct termios *t)); -static void itystart __P((struct tty *tp)); - -static int itydefaultrate = 64000; -static short ity_addr[NITY]; -static struct tty ity_tty[NITY]; -static int applnr[NITY]; -static int next_if= 0; -#ifdef DEVFS -void *devfs_token[NITY]; -static void *devfs_token_out[NITY]; -#endif - -#define UNIT(x) (minor(x)&0x3f) -#define OUTBOUND(x) ((minor(x)&0x80)==0x80) - -int -ityattach(int ap) -{ - if(next_if >= NITY) - return(-1); - - applnr[next_if]= ap; -#ifdef DEVFS - devfs_token[next_if] = - devfs_add_devswf(&ity_cdevsw, next_if, DV_CHR, 0, 0, - 0600, "isdn/ity%d", next_if); - devfs_token_out[next_if] = - devfs_add_devswf(&ity_cdevsw,(next_if | 0x80), DV_CHR, 0, 0, - 0600, "isdn/Oity%d", next_if); -#endif - return(next_if++); -} - -/* ARGSUSED */ -static int -ityopen(dev_t dev, int flag, int mode, struct proc * p) -{ - register struct tty *tp; - register int unit; - int error = 0; - - unit = UNIT(dev); - if (unit >= next_if) - return (ENXIO); - - tp = &ity_tty[unit]; - tp->t_oproc = itystart; - tp->t_param = ityparam; - tp->t_dev = dev; - if ((tp->t_state & TS_ISOPEN) == 0) - { - ttychars(tp); - if (tp->t_ispeed == 0) - { - tp->t_iflag = TTYDEF_IFLAG; - tp->t_oflag = TTYDEF_OFLAG; - tp->t_cflag = TTYDEF_CFLAG; - tp->t_lflag = TTYDEF_LFLAG; - tp->t_ispeed = tp->t_ospeed = itydefaultrate; - } - ityparam(tp, &tp->t_termios); - ttsetwater(tp); - } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) - return (EBUSY); - (void) spltty(); - - if (OUTBOUND(dev)) { - /* - * XXX should call l_modem() here and not meddle with CLOCAL, - * but itystart() wants TS_CARR_ON to give the true carrier. - */ - tp->t_cflag |= CLOCAL; - tp->t_state |= TS_CONNECTED; - } - - while ((flag & O_NONBLOCK) == 0 && (tp->t_cflag & CLOCAL) == 0 && - (tp->t_state & TS_CARR_ON) == 0) - { - error = tsleep(TSA_CARR_ON(tp), TTIPRI | PCATCH, "iidcd", 0); - if (error) - break; - } - (void) spl0(); - if (error == 0) - error = (*linesw[tp->t_line].l_open) (dev, tp); - return (error); -} - -/* ARGSUSED */ -static int -ityclose(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; -{ - register struct tty *tp; - register ity; - register int unit; - - unit = UNIT(dev); - ity = ity_addr[unit]; - if(tp = &ity_tty[unit]) - (*linesw[tp->t_line].l_close) (tp, flag); - ttyclose(tp); - isdn_disconnect(applnr[unit],0); - return (0); -} - -static int -ityread(dev, uio, flag) - dev_t dev; - struct uio *uio; - int flag; -{ - register struct tty *tp = &ity_tty[UNIT(dev)]; - - return ((*linesw[tp->t_line].l_read) (tp, uio, flag)); -} - -static int -itywrite(dev, uio, flag) - dev_t dev; - struct uio *uio; - int flag; -{ - int unit = UNIT(dev); - register struct tty *tp = &ity_tty[unit]; - - return ((*linesw[tp->t_line].l_write) (tp, uio, flag)); -} - -int -ity_input(int no, int len, char *buf, int dir) -{ - register struct tty *tp = &ity_tty[no]; - int i; - - if (tp->t_state & TS_ISOPEN) - for(i= 0; i<len; i++) - (*linesw[tp->t_line].l_rint)(buf[i], tp); - else len= 0; - return(len); -} - -static void -itystart(struct tty *tp) -{ - int s, unit; - - unit = UNIT(tp->t_dev); - - s = splhigh(); - if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) - { - splx(s); - return; - } - ttwwakeup(tp); - if (tp->t_outq.c_cc) - { - if(OUTBOUND(tp->t_dev) && (tp->t_cflag & CLOCAL) && - ((tp->t_state & TS_CARR_ON) == 0)) - isdn_msg(applnr[unit]); - else isdn_output(applnr[unit]); - tp->t_state |= TS_BUSY; - } - splx(s); -} - -int -ity_out(int no, char *buf, int len) -{ - struct tty *tp = &ity_tty[no]; - int i; - - if(tp == NULL) - return(0); - if(tp->t_outq.c_cc) - { - for (i = 0; i < len && tp->t_outq.c_cc; ++i) - buf[i]= getc(&tp->t_outq); - return(i); - } - tp->t_state &=~ (TS_BUSY|TS_FLUSH); - if (tp->t_line) - (*linesw[tp->t_line].l_start)(tp); - else - itystart(tp); - return(0); -} - -void -ity_connect(int no) -{ - struct tty *tp = &ity_tty[no]; - - if(tp == NULL) - return; - if(OUTBOUND(tp->t_dev)) tp->t_cflag &= ~CLOCAL; - (*linesw[tp->t_line].l_modem) (tp, 1); - tp->t_state &=~ (TS_BUSY|TS_FLUSH); - if (tp->t_line) - (*linesw[tp->t_line].l_start)(tp); - else - itystart(tp); -} - -void -ity_disconnect(int no) -{ - struct tty *tp = &ity_tty[no]; - if(tp) (*linesw[tp->t_line].l_modem) (tp, 0); -} - -static int -ityioctl(dev, cmd, data, flag,p) - dev_t dev; - int cmd; - caddr_t data; - int flag; - struct proc *p; -{ - register struct tty *tp; - register int unit = UNIT(dev); - register int error; - - tp = &ity_tty[unit]; - error = (*linesw[tp->t_line].l_ioctl) (tp, cmd, data, flag,p); - if (error >= 0) - return (error); - error = ttioctl(tp, cmd, data, flag); - if (error >= 0) - return (error); - - switch (cmd) - { - default: - return (ENOTTY); - } - return (0); -} - -static int -ityparam(tp, t) - register struct tty *tp; - register struct termios *t; -{ - register int cflag = t->c_cflag; - int unit = UNIT(tp->t_dev); - int ospeed = t->c_ospeed; - - /* check requested parameters */ - if (ospeed < 0 || (t->c_ispeed && t->c_ispeed != t->c_ospeed)) - return (EINVAL); - /* and copy to tty */ - tp->t_ispeed = t->c_ispeed; - tp->t_ospeed = t->c_ospeed; - tp->t_cflag = cflag; - - if (ospeed == 0) - { - isdn_disconnect(applnr[unit],0); - return (0); - } - return (0); -} - -/* - * Stop output on a line. - */ -/* ARGSUSED */ -static void -itystop(struct tty *tp, int flag) -{ - register int s; - - s = splhigh(); - if (tp->t_state & TS_BUSY) - { - if ((tp->t_state & TS_TTSTOP) == 0) - tp->t_state |= TS_FLUSH; - } - splx(s); -} - -static struct tty * -itydevtotty(dev_t dev) -{ - register int unit = UNIT(dev); - if (unit >= next_if) - return (NULL); - - return (&ity_tty[unit]); -} - -static ity_devsw_installed = 0; - -static void -ity_drvinit(void *unused) -{ - dev_t dev; - - if( ! ity_devsw_installed ) { - dev = makedev(CDEV_MAJOR, 0); - cdevsw_add(&dev,&ity_cdevsw, NULL); - ity_devsw_installed = 1; - } -} - -SYSINIT(itydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ity_drvinit,NULL) - -#endif diff --git a/sys/gnu/isdn/isdn.c b/sys/gnu/isdn/isdn.c deleted file mode 100644 index b36a1a9..0000000 --- a/sys/gnu/isdn/isdn.c +++ /dev/null @@ -1,647 +0,0 @@ -/* @(#)$Id: isdn.c,v 1.13 1996/06/12 05:02:21 gpalmer Exp $ - ******************************************************************************* - * II - Version 0.1 $Revision: 1.13 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - */ - -/* - * Copyright (c) 1994 Dietmar Friede (dietmar@friede.de) All rights reserved. - * FSF/FSAG GNU Copyright applies - * - * An intermediate level for ISDN Drivers. - * - */ - -#include "isdn.h" -#include "ii.h" -#include "ity.h" -#include "itel.h" -#include "ispy.h" -#if NISDN > 0 - -#define TYPNR 4 -#define N_ISDN_APPL (NII + NITY + NITEL + NISPY) - -#include <sys/param.h> -#include <sys/ioctl.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/conf.h> -#include <sys/proc.h> -#ifdef DEVFS -#include <sys/devfsext.h> -#endif /*DEVFS*/ - -#include <gnu/isdn/isdn_ioctl.h> - -isdn_appl_t isdn_appl[N_ISDN_APPL]; -isdn_ctrl_t isdn_ctrl[N_ISDN_CTRL]; -static int Isdn_Appl, Isdn_Ctrl, Isdn_Typ; - -static void isdn_attach __P((void)); -static timeout_t isdn_check; -static char *isdn_get_prot __P((int ap, int dir)); -static int isdn_get_prot_size __P((int ap)); -static int isdn_set_prot __P((int ap, int dir, char *p)); -static void passout __P((int unit, int l, char *buf)); - -static d_open_t isdnopen; -static d_close_t isdnclose; -static d_read_t isdnread; -static d_ioctl_t isdnioctl; - -#define CDEV_MAJOR 55 -static struct cdevsw isdn_cdevsw = - { isdnopen, isdnclose, isdnread, nowrite, /*55*/ - isdnioctl, nostop, nullreset, nodevtotty,/* isdn */ - seltrue, nommap, NULL, "isdn", NULL, -1 }; - - -static int o_flags, r_flags, bufind[TYPNR]; -static char buffer[TYPNR][257]; -static u_char appl_list[TYPNR]; - -typedef u_char prot[2]; -static u_char prot_size[2] = {0, 2}; -static prot passiv[6] = {{0}, {3, 3}}; -static prot activ[6] = {{0}, {1, 3}}; - -u_short isdn_state= 0; -static isdn_timeout= 0; - -static int -isdn_get_prot_size(int ap) -{ - return (prot_size[isdn_appl[ap].prot]); -} - -static char * -isdn_get_prot(int ap, int dir) -{ - if(dir) - return(activ[isdn_appl[ap].prot]); - return(passiv[isdn_appl[ap].prot]); -} - -static int -isdn_set_prot(int ap, int dir, char *p) -{ - char *pr; - int i, l; - if ((l = isdn_get_prot_size(ap)) == 0) - return (0); - if (dir) - pr = passiv[isdn_appl[ap].prot]; - else - pr = activ[isdn_appl[ap].prot]; - for (i = 0; i < l; i++, pr++, p++) - *p = *pr; - return (l); -} - -static void -isdn_attach() -{ - isdn_appl_t *appl; - int i, an; - - appl_list[0]= Isdn_Typ= an= 0; - - for(i= 0 ; i<NII; i++,an++) - { - appl = &isdn_appl[an]; - appl->ctrl = -1; - appl->state = 0; - appl->appl = an; - appl->typ = Isdn_Typ; - appl->drivno = iiattach(an); - appl->PassUp = ii_input; - appl->PassDown = ii_out; - appl->Connect = ii_connect; - appl->DisConn = ii_disconnect; - } - - appl_list[1]= an; - Isdn_Typ= 1; - for(i= 0 ; i<NITY; i++,an++) - { - appl = &isdn_appl[an]; - appl->ctrl = -1; - appl->state = 0; - appl->appl = an; - appl->typ = Isdn_Typ; - appl->drivno = ityattach(an); - appl->PassUp = ity_input; - appl->PassDown = ity_out; - appl->Connect = ity_connect; - appl->DisConn = ity_disconnect; - } - - appl_list[2]= an; - Isdn_Typ= 2; - for(i= 0 ; i<NITEL; i++,an++) - { - appl = &isdn_appl[an]; - appl->ctrl = -1; - appl->state = 0; - appl->appl = an; - appl->typ = Isdn_Typ; - appl->drivno = itelattach(an); - appl->PassUp = itel_input; - appl->PassDown = itel_out; - appl->Connect = itel_connect; - appl->DisConn = itel_disconnect; - } - - appl_list[3]= an; - Isdn_Typ= 3; - for(i= 0 ; i<NISPY; i++,an++) - { - appl = &isdn_appl[an]; - appl->ctrl = -1; - appl->state = 0; - appl->appl = an; - appl->typ = Isdn_Typ; - appl->drivno = ispyattach(an); - appl->PassUp = ispy_input; - } - Isdn_Appl= an; -} - -int -isdn_ctrl_attach(int n) -{ - int c = Isdn_Ctrl; - - if(Isdn_Ctrl == 0) isdn_attach(); - if ((Isdn_Ctrl += n) <= N_ISDN_CTRL) - return (c); - Isdn_Ctrl = c; -#ifdef DEVFS -/*SOMETHING GOES IN HERE I THINK*/ -#endif - return (-1); -} - -/* - * isdnopen() New open on device. - * - * I forbid all but one open per application. The only programs opening the - * isdn device are the ISDN-daemon - */ -static int -isdnopen(dev_t dev, int flags, int fmt, struct proc *p) -{ - if (minor(dev)>Isdn_Typ) - return (ENXIO); - - /* Card busy ? */ - if (o_flags & (1 << minor(dev))) - return (EBUSY); - - o_flags |= (1 << minor(dev)); - - return (0); -} - -static int -isdnclose(dev_t dev, int flags, int fmt, struct proc *p) -{ - o_flags &= ~(1 << minor(dev)); - return (0); -} - -static int -isdnread(dev_t dev, struct uio * uio, int ioflag) -{ - int x; - int error = 0; - int unit= minor(dev); - - r_flags &= ~(1 << unit); - - x = splhigh(); - if(bufind[unit] == 0) - { - r_flags |= (1 << unit); - error= tsleep((caddr_t) buffer[unit], PZERO + 1, "isdnin", hz); - } - if(bufind[unit]) - { - buffer[unit][bufind[unit]++]= 0; - error = uiomove(buffer[unit], bufind[unit], uio); - bufind[unit] = 0; - } - splx(x); - return error; -} - -static int -isdnioctl(dev_t dev, int cmd, caddr_t data, int flags, struct proc *p) -{ - int err, x; - isdn_appl_t *appl; - isdn_ctrl_t *ctrl; - unsigned ab, an, cn; - - err = 0; - ab= appl_list[minor(dev)]; - - switch (cmd) - { - case ISDN_LISTEN: - { - listen_t *s= (listen_t *) data; - - an= ab; - if (s->ctrl >= Isdn_Ctrl) - return (ENODEV); - cn= s->ctrl; - ctrl = &isdn_ctrl[cn]; - - x = splhigh(); - while(isdn_state) - { - err = tsleep((caddr_t) ctrl, PZERO | PCATCH, "slisten", 2); - if (err != EWOULDBLOCK) - { - splx(x); - return (err); - } - } - - isdn_state = 0xffff; - while((err = (*ctrl->listen) (s->ctrl, minor(dev) | 0x30 - , s->inf_mask ,s->subadr_mask ,s->si_mask, /* XXX */ 0)) == EBUSY) - { - err = tsleep((caddr_t) ctrl, PZERO | PCATCH, "blisten", 2); - if (err != EWOULDBLOCK) - { - splx(x); - return (err); - } - } - - if (err) - { - splx(x); - return (err); - } - while (isdn_state == 0xffff) - { - err = tsleep((caddr_t) ctrl, PZERO | PCATCH, "ilisten", 2); - if (err != EWOULDBLOCK) - { - splx(x); - return (err); - } - } - splx(x); - err= isdn_state; - isdn_state= 0; - return (err); /* tricky but it works */ - } - break; - - case ISDN_DIAL: - { - dial_t *d= (dial_t*)data; - telno_t *t= &d->telno; - - an = d->appl + ab; - cn = d->ctrl; - - if (an >= Isdn_Appl || cn >= Isdn_Ctrl) - return (ENODEV); - - appl = &isdn_appl[an]; - - if (ISBUSY(appl->ctrl) || appl->state) - return (EBUSY); - - appl->state= 1; - x = splhigh(); - - while((err = (*isdn_ctrl[cn].connect) (cn, an - ,d->b_channel, d->inf_mask, d->out_serv - ,d->out_serv_add, d->src_subadr, t->length - ,t->no, d->spv)) == EBUSY) - { - err = tsleep((caddr_t) appl, PZERO | PCATCH, "idial", 2); - if (err != EWOULDBLOCK) - { - splx(x); - return (err); - } - } - if(err) appl->state= 0; - splx(x); - return(err); - } - break; - case ISDN_HANGUP: - cn = data[0]; - if (cn >= Isdn_Ctrl) - return (ENODEV); - x = splhigh(); - - while((err = (*isdn_ctrl[cn].disconnect) (cn, data[1])) == EBUSY) - { - err = tsleep((caddr_t) data, PZERO | PCATCH, "ihang", 2); - if (err != EWOULDBLOCK) - { - splx(x); - return (err); - } - } - splx(x); - break; - case ISDN_ACCEPT: - cn = data[0]; - an = data[1] + ab; - if (cn >= Isdn_Ctrl) - return (ENODEV); - x = splhigh(); - while((err = (*isdn_ctrl[cn].accept) (cn, an, data[2])) == EBUSY) - { - err = tsleep((caddr_t) data, PZERO | PCATCH, "iaccept", 2); - if (err != EWOULDBLOCK) - { - splx(x); - return (err); - } - } - splx(x); - break; - case ISDN_SET_PARAM: - { - isdn_param *p = (isdn_param *) data; - - an = p->appl + ab; - if (an >= Isdn_Appl) - return (ENODEV); - appl = &isdn_appl[an]; - bcopy(p, appl, sizeof(isdn_param)); - appl->appl+= ab; - } - break; - case ISDN_GET_PARAM: - { - isdn_param *p = (isdn_param *) data; - an = p->appl + ab; - if (an >= Isdn_Appl) - return (ENODEV); - appl = &isdn_appl[an]; - bcopy(appl, p, sizeof(isdn_param)); - } - break; - default: - err = ENODEV; - } - - return (err); -} - -void -isdn_start_out(int cn) -{ - isdn_ctrl_t *ctrl = &isdn_ctrl[cn]; - isdn_appl_t *appl = &isdn_appl[ctrl->appl]; - int x; - - x= splhigh(); - if (ctrl->o_len == 0) - { - int l; - l = isdn_set_prot(ctrl->appl, ctrl->islisten, ctrl->o_buf); - ctrl->o_len = (*appl->PassDown) (appl->drivno, ctrl->o_buf+l,2048-l); - - if (ctrl->o_len == 0) - { - splx(x); - return; - } - ctrl->o_len+= l; - (*ctrl->output) (cn); - } - - splx(x); -} - -int -isdn_output(int an) -{ - isdn_appl_t *appl = &isdn_appl[an]; - - if (ISFREE(appl->ctrl)) - { - int l; - char buf[10]; - - if(appl->state) - return(0); - - l = sprintf(buf,"d %d", an-appl_list[appl->typ]); - passout(appl->typ,l,buf); - return(0); - } - isdn_start_out(appl->ctrl); - return (0); -} - -int -isdn_msg(int an) -{ - isdn_appl_t *appl = &isdn_appl[an]; - - if (ISFREE(appl->ctrl)) - { - int l; - char buf[256]; - - l = sprintf(buf,"M %d", an-appl_list[appl->typ]); - l += (*appl->PassDown) (appl->drivno, buf+l,256-l); - passout(appl->typ,l,buf); - return(0); - } - return (1); -} - -int -isdn_input(int an, int len, char *buf, int dir) -{ - int l; - char *p; - isdn_appl_t *appl = &isdn_appl[an]; - - if (l = isdn_get_prot_size(an)) - { - p= isdn_get_prot(an,dir); - if((p[0] != buf[0]) || (p[1] != buf[1])) - return(0); - len -= l; - buf += l; - } - return ((*appl->PassUp) (appl->drivno, len, buf, dir)); -} - -void -isdn_accept_con_ind(int an, int cn, char serv, char serv_add, char subadr, char nl, char *num) -{ - int l; - char buf[32]; - - an&= 0xf; - l = sprintf(buf, "a %d %d %d %d %c %d %d %s", an, cn ,serv, serv_add - , subadr,(u_char) num[0], nl, num + 1); - passout(an,l,buf); -} - -void -isdn_info(int an, int typ, int len, char *data) -{ - int l; - char buf[64]; - u_short no; - - if(an < Isdn_Appl) - no= isdn_appl[an].typ; - else no= an&0xf; - - if(no > Isdn_Typ) no= 3; - - if(len>48) len= 48; - data[len]= 0; - l = sprintf(buf,"i %d %d %d %s", an, typ, len, data); - passout(no,l,buf); -} - -static void -isdn_check(void *chan) -{ - int i; - - isdn_timeout= 0; - for(i= 0; i < Isdn_Ctrl; i++) - { - int an; - isdn_ctrl_t *ctrl = &isdn_ctrl[i]; - - if((an= ctrl->appl) < Isdn_Appl) - { - isdn_appl_t *appl = &isdn_appl[an]; - - if(appl->timeout) - { - isdn_timeout= 1; - if(time.tv_sec > (ctrl->lastact + (appl->timeout))) - { - isdn_disconnect(an,0); - break; - } - } - } - } - - if(isdn_timeout) - { - timeout(isdn_check,0,hz/2); - } -} - -void -isdn_conn_ind(int an, int cn, int dial) -{ - isdn_appl_t *appl = &isdn_appl[an]; - int l; - char buf[10]; - - if (appl->Connect) - (*appl->Connect) (appl->drivno); - - l = sprintf(buf,"C %d %d %d", an-appl_list[appl->typ], cn, dial); - passout(appl->typ,l,buf); - if((isdn_timeout == 0) && appl->timeout) - { - isdn_timeout= 1; - timeout(isdn_check,0,hz/2); - } -} - -void -isdn_disconn_ind(int an) -{ - isdn_appl_t *appl = &isdn_appl[an]; - int l; - char buf[10]; - - if(( an < 0) || (an >= Isdn_Appl)) - return; - - appl->state= 0; - if (appl->DisConn) - (*appl->DisConn) (appl->drivno); - l = sprintf(buf,"D %d", an-appl_list[appl->typ]); - passout(appl->typ,l,buf); -} - -void -isdn_disconnect(int an, int rea) -{ - isdn_appl_t *appl = &isdn_appl[an]; - - if (ISBUSY(appl->ctrl)) - { - int x; - x = splhigh(); - (*isdn_ctrl[appl->ctrl].disconnect)(appl->ctrl,rea); - splx(x); - } -} - -static void -passout(int unit, int l, char *buf) -{ - int x; - - x = splhigh(); - if ((bufind[unit] + l) >= 256) - { - splx(x); - return; - } - bcopy(buf,&buffer[unit][bufind[unit]],l); - bufind[unit] += l; - buffer[unit][bufind[unit]++]= 0; - if (r_flags & (1<<unit)) - { - r_flags &= ~(1 << unit); - wakeup((caddr_t) buffer[unit]); - } - splx(x); -} - -static isdn_devsw_installed = 0; - -static void -isdn_drvinit(void *unused) -{ - dev_t dev; - - if( ! isdn_devsw_installed ) { - dev = makedev(CDEV_MAJOR,0); - cdevsw_add(&dev,&isdn_cdevsw,NULL); - isdn_devsw_installed = 1; - } -} - -SYSINIT(isdndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,isdn_drvinit,NULL) - -#endif /* NISDN > 0 */ |