mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-11 09:50:12 +00:00
Removing old isdn stuff.
This commit is contained in:
parent
eca997a43f
commit
494405d890
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=19063
@ -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))
|
@ -1,4 +0,0 @@
|
||||
SUBDIR= answ dbg iid ispy itel ittd load nsplit play rst rstcode \
|
||||
spy ulaw2alaw alaw2ulaw
|
||||
|
||||
.include <bsd.subdir.mk>
|
@ -1,2 +0,0 @@
|
||||
BINDIR?= /usr/sbin
|
||||
LIBDIR?= /usr/share/isdn
|
@ -1,5 +0,0 @@
|
||||
PROG= alaw2ulaw
|
||||
CFLAGS+= -DBSD -O
|
||||
NOMAN= yes
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -1 +0,0 @@
|
||||
stolen from isdndrv-0.1.1
|
@ -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);
|
||||
}
|
||||
}
|
@ -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]];
|
||||
}
|
@ -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>
|
@ -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
|
@ -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>
|
@ -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.
|
@ -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);
|
||||
}
|
@ -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);
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
@ -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.
|
@ -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)
|
@ -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!
|
@ -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.
|
@ -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
|
@ -1,4 +0,0 @@
|
||||
PROG= iid
|
||||
CFLAGS+= -DBSD -O
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -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.
|
@ -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);
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
PROG= ispy
|
||||
NOMAN= yes
|
||||
CFLAGS+= -DBSD -O
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -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");
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
PROG= iteld
|
||||
CFLAGS+= -DBSD -O
|
||||
NOMAN= yes
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -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);
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
PROG= ittd
|
||||
CFLAGS+= -DBSD -O
|
||||
NOMAN= yes
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -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.
|
@ -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);
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
PROG= load
|
||||
CFLAGS+= -DBSD -O
|
||||
NOMAN= yes
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -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);
|
||||
}
|
@ -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>
|
@ -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:
|
@ -1 +0,0 @@
|
||||
0:A8:pr.:w100:
|
@ -1,2 +0,0 @@
|
||||
isdn:dv=/dev/ityo0:cm=d123.:pa=none:
|
||||
re:dv=/dev/ityo0:cm=d133.:pa=none:
|
@ -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
|
@ -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
|
@ -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");
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
ity00 "/usr/libexec/getty Pc" unknown on secure
|
||||
ity01 "/usr/libexec/getty Pc" unknown on secure
|
@ -1,5 +0,0 @@
|
||||
PROG= nsplit
|
||||
CFLAGS+= -DBSD -O
|
||||
NOMAN= yes
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -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");
|
||||
|
||||
}
|
@ -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>
|
@ -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
|
@ -1,5 +0,0 @@
|
||||
PROG= rst
|
||||
CFLAGS+= -DBSD -O
|
||||
NOMAN=
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -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");
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
PROG= rstcode
|
||||
CFLAGS+= -DBSD -O
|
||||
NOMAN= yes
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -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);
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
PROG= spy
|
||||
CFLAGS+= -DBSD -O
|
||||
NOMAN=
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -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);
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
PROG= ulaw2alaw
|
||||
CFLAGS+= -DBSD -O
|
||||
NOMAN= yes
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -1 +0,0 @@
|
||||
stolen from isdndrv-0.1.1
|
@ -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]];
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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 f<>r 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 f<>r die */
|
||||
/* frei verf<72>gbar */
|
||||
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 ()
|
File diff suppressed because it is too large
Load Diff
@ -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 ()
|
@ -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];
|
@ -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);
|
||||
}
|
@ -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
|
@ -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
|
@ -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
|
@ -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 */
|
Loading…
Reference in New Issue
Block a user