This commit is contained in:
Matthias Urlichs 1995-11-08 19:17:48 +01:00 committed by Harald Welte
parent 31dd84ea4c
commit f68fc8e219
66 changed files with 711 additions and 554 deletions

136
DOKU
View File

@ -16,6 +16,11 @@ unter der GPL bzw. ihrem deutschen
Achtung:
=======
Es gibt eine Mailingliste zum Thema: linux-isdn@uranus.central.de.
"Bitte trag mich ein"-Requests bitte _nicht_ drothin, sondern an
linux-isdn-request@uranus.central.de.
Version 14: Die CL- und DL-Zeilen haben sich geändert (erweitert um
<Key>-Parameter). Intelligente Karten funktionieren NOCH NICHT.
@ -140,14 +145,19 @@ wer kann und will, m
Kernelpatches
=============
Die Patches basieren auf dem in der Versionsnummer bezeichneten Kernel.
Die Patches basieren auf dem Kernel 1.2.11.
Frühere bzw. spätere Kernels auf eigene Gefahr bzw. Bastelei.
Insbesondere sollten die Leute, die meckern, weil sie den Kram nicht unter
1.3.xx zum Laufen bekommen, sich ernsthaft fragen, wieso sie einen Kernel
einsetzen, der ausdrücklich für Leute gedacht ist, die selber nach Bugs
suchen können.
Was die einzelnen Patches machen und ob sie benötigt werden,
steht in den einzelnen Dateien am Anfang. Lesen, bevor der Kernel verändert
wird!
Der Kernel sollte mit CONFIG_MODVERSIONS gebaut werden.
Der Kernel sollte mit CONFIG_MODVERSIONS gebaut werden; das ist zwar nicht
unbedingt notwendig, aber sinnvoll.
Das modutils-1.2.8-Paket wird in jedem Fall benötigt, um Parameter an die
einzelnen Module zu übergeben.
@ -223,16 +233,24 @@ for i in biglog more_free setnoswap ; do
patch -p0 -d /usr/src/linux < $i
done
# Andere Patche in diesem Verzeichnis ansehen, evtl. ebenfalls installieren.
# Vorsicht, die Patches beruhen auf Linux 1.2.11.
#
# Kernel installieren und booten.
# (alten Kernel unbedingt zu Backupzwecken erhalten!)
# Danach:
vi config/config.data
# Zeile "PROTOCOLS" und "SUBPROTOCOLS" ansehen. Siehe unten "DL-Zeile".
make.isdn
# Als Superuser:
# Wenn er nun über config.new und config.data meckert:
# Siehe unten Probleme.
# mv config/config.new config/config.data
# vi config/config.data
# # Insbesondere: Zeilen "PROTOCOLS" und "SUBPROTOCOLS" ansehen.
# # Siehe unten "DL-Zeile".
# Danach: Nochmal make.isdn starten.
#
# Nun als Superuser:
make.isdn
# oder einfach "make install".
Editiere /lib/modules/modules.isdn:
-o Tel0 isdn/teles.o name=$(cardname Tel0) mem=0xD6000 irq=5 ipl=1
anstatt
@ -245,6 +263,54 @@ vi /etc/isdn.conf # ISDN-Nummern, Dienste, etc. eintragen
Sämtliche Gerätedateien werden automatisch angelegt.
Probleme bei der Installation
--------
Als allererstes: Der obige Hinweis re Kernel installieren sollte ernst
genommen werden. Grund: Jeder modularisierte Treiber _braucht_ Zugriff auf
die korrekt konfigurierten Sourcen genau des Kernels, unter dem er später
laufen soll. Dies gilt ganz besonders, wenn der Kernel mit
CONFIG_MODVERSIONS gebaut wurde (das ist um einiges sicherer!).
Wenn sich die Module nicht laden lassen, weil insmod Sachen wie "kfree"
nicht findet, dann liegt das daran, daß die Version der Sourcen des
Kernels, des laufenden Kernels, und der ISDN-Treiber, nicht übereinstimmt.
Also: cd /wo/auch/immer/ist/src/linux; make config; make dep; make;
make modules; make modules_install; cp arch/i386/boot/zImage /boot/linux\
.versionsnummer; vi /etc/lilo.conf; lilo; reboot.
Disclaimer: So mache ich das.
config.new und config.dist und config.data. Das Problem ist, daß ich an der
config.data gelegentlich was ändern muß, aber der Benutzer daran auch
rumspielt (dazu ist die Datei da). Was tun?
Einfach: Mit den Parametern der alten config.data wird die neue config.dist
"geladen", und das Ergebnis liegt nun in config.new. Dasselbe passiert,
wenn es noch keine config.data gibt. In beiden Fällen tut man gut daran,
sich die Datei config.new näher anzusehen, evtl. mit der alten config.data
zu vergleichen, und dann "mv config.new config.data". Sicherheitshalber
weigert sich das Makefile in config/, ohne diesen Schritt weiterzuarbeiten.
Autoconfig und wieso nicht: Nein, ich weigere mich (momentan), automatisch
nach Karten, deren Interrupts, deren Konfigurationsregister etc.pp. zu
suchen. Bei einem laufenden Kernel ist das alles andere als einfach!
Stattdessen müssen die entsprechenden Daten in /lib/modules/modules.isdn
eingetragen werden. Wenn irgendwas nicht stimmt, wird im allgemeinen die
Karte nicht erkannt und das Treibermodul nicht geladen.
Ausnahme: IRQs, die werden momentan nicht überprüft. Das kann man manuell
machen: nach der installation der Treiber beim ISDN-Anschluß der Karte
anrufen. Dann "cat /proc/interrupts". Wenn neben dem Wort ISDN eine Zahl
kleiner drei steht, stimmt was nicht -- anderen Interrupt probieren,
BIOS-Konfiguration überprüfen: auch korrekt eingestellte Interrupts können
Probleme machen, wenn zB das BIOS eines PCI-Rechners den Interrupt zu einem
PCI- anstatt zu einem ISA-Slot routet. (Evtl müssen da trotz BIOS-
Konfiguration noch Jumper auf dem Mainboard umgesetzt werden. Doku des
Teils lesen!)
Treiberparameter:
-----------------
@ -284,8 +350,9 @@ Beispiel: insmod d_teles.o
rmmod Tel0 ; rmmod d_teles.o
Alle Treiber können vor oder nach Start des Masterprogramms geladen oder
wieder entfernt werden. Aktive Verbindungen werden (unsauber) abgebrochen.
Alle Kartentreiber können vor oder nach Start des Masterprogramms geladen
oder wieder entfernt werden. Aktive Verbindungen werden (unsauber)
abgebrochen.
Testen:
@ -561,6 +628,10 @@ Alle Zeilentypen:
möglich (Beispiel: "Bin0/23".)
<Mod> sind einzelne Buchstaben, die der betreffenden Zeile eine Sonder-
behandlung verpassen. Welche, ist jeweils beschrieben.
Die Unterscheidung "mehrere gleichzeitig" oder "nur eine
gleichzeitig" bei Wählverbindungen bezieht sich jeweils auf eine
Art/Partner-Kombination; allgemeinere Einschränkungen werden mit
einer Extra-CL-Zeile realisiert.
<Parameter...> ist eine Folge von einem oder mehr Parameter-Wert-Angaben.
(Manche Parameter haben keine Wertangabe.)
Merke: Zeilen ohne Parameter sind nicht besonders sinnvoll.
@ -592,7 +663,7 @@ Parameter:
kommende abgewiesen werden. (Default: Der abgehende Ruf wird
abgebrochen.)
:yi Bei einem ankommeden Ruf wird automatisch ein abgehender gestartet und
der ankommende wird abgewiesen.
der ankommende wird abgewiesen (Callback).
:bi Bei einem ankommenden Ruf, der nicht angenommen werden kann (belegt?),
wird automatisch auf einer anderen Leitung zurückgerufen.
:fr ebenfalls zu setzen ist meist sinnvoll.
@ -651,8 +722,14 @@ X Wenn diese Zeile (oder eine dar
i für ankommende Verbindungen
o für abgehende Verbindungen
f für Festverbindungen
d für Wählverbindungen
d für Wählverbindungen (nur eine gleichzeitig)
m für Wählverbindungen (mehrere gleichzeitig)
p für Verbindungsaufbau nach Bedarf
Ist keines der Zeichen 'd','p','f' vorhanden, wird 'd' angenommen, mit
dem Unterschied, daß die so bezeichnete Verbindung mehrmals unabhängig
voneinander aufgebaut werden kann (z.B. Login). 'd' bezeichnet eine
nur einmal herstellbare Verbindung (TCP, wenn das Interface nach
Verbindungsende verschwinden soll).
Der Suchalgorithmus findet zunächst eine zur Verbindung passende Zeile mit
R-Flag und hängt an deren Parameterliste alle ebenfalls passenden Zeilen
@ -686,7 +763,8 @@ Mod:
i für ankommende Verbindungen
o für abgehende Verbindungen
f für Festverbindungen
d für Wählverbindungen
d für Wählverbindungen (nur eine gleichzeitig)
m für Wählverbindungen (mehrere gleichzeitig)
p für Verbindungsaufbau nach Bedarf
,# Verzögerung bei Verbindungsende, in Sekunden, für sauberes
Herunterfahren des B-Kanalprotokolls.
@ -714,7 +792,8 @@ Mod:
i für ankommende Verbindungen
o für abgehende Verbindungen
f für Festverbindungen
d für Wählverbindungen
d für Wählverbindungen (nur eine gleichzeitig)
m für Wählverbindungen (mehrere gleichzeitig)
p für Verbindungsaufbau nach Bedarf
u für Parameter, die nur beim Programmstart gesetzt werden (x75-Kram zB)
a für Parameter, die bei Neueinlesen der Konfigdaten gesetzt werden
@ -740,8 +819,11 @@ Mod:
i für ankommende Verbindungen
o für abgehende Verbindungen
f für Festverbindungen (der zu verwendende B-Kanal steht in der P-Zeile)
d für Wählverbindungen
d für Wählverbindungen (nur eine gleichzeitig)
m für Wählverbindungen (mehrere gleichzeitig)
p für Verbindungsaufbau nach Bedarf
B Backup-Nummer, wird nur verwendet, wenn das Wählen anderer Nummern
mindestens einmal fehlschlug.
TM-Zeile ("Time")
@ -864,8 +946,8 @@ Die Reihenfolge ist wichtig.
:lp X X X CAPI-Bitmasken für EAZ, Service, Infos. Hexadezimal.
Default: 03FF E7BF 003F.
:st XXXXX Protokollstack XXXXX laden. Siehe Handbuch zur Karte.
Default ist u_1tr6_pmp (wenn "german" und nicht "euro" inn
config/config-data angegeben wurde) oder u_dss1_pmp (sonst).
Default ist u_1tr6_pmp (wenn "german" und nicht "euro" in
config/config.data angegeben wurde) oder u_dss1_pmp (sonst).
:ea N NNN EAZ N auf lokale Nummer (MSN) NNN mappen.
Default ist die letzte Ziffer der Nummer.
Nicht bei :pb verwenden.
@ -956,7 +1038,8 @@ B Die Verbindung wird beim Hochfahren des Managers automatisch aufgebaut.
i für ankommende Verbindungen
o für abgehende Verbindungen
f für Festverbindungen. "B" wird hier normalerweise ebenfalls angegeben.
d für Wählverbindungen
d für Wählverbindungen (nur eine gleichzeitig)
m für Wählverbindungen (mehrere gleichzeitig)
p für Verbindungsaufbau nach Bedarf ("reconn"-Modul nicht vergessen!);
wird beim Programmstart automatisch mitgestartet. Die eigentliche
ISDN-Verbindung wird hierdurch _nicht_ aufgebaut, dafür ist "B" gedacht.
@ -1343,14 +1426,16 @@ Steuerprogramm f
Hintergrund setzt.
-f dev Steuerdevice anstelle von /dev/isdnmon.
-I Debugbefehle werden von stdin gelesen.
-t Testflag. Nicht verwenden.
-l setzt ein strlog-Modul auf die Steuerverbindung. Debugging.
-L setzt ein qinfo-Modul auf die Steuerverbindung. Debugging.
-w setzt ein strlog-Modul auf die programminterne Verbindung zwischen
dem eigentlichen Programm und dem ISDN-Level-3-Code. Debugging.
-w setzt ein logh-Modul auf die programminterne Verbindung zwischen
dem Treiber im Kernel und dem Masterprozeß. Debugging.
-L, -W wie -l / -w, jedoch im Kernel-Log anstatt auf stderr.
-m schreibt die programminterne Verbindung zwischen Ebene 3 und 4
auf stderr mit. Sehr wichtig beim Debuggen.
-M schreibt diverse andere Debugginginfo nach stderr.
-x file Datei mit (internen) Steuerbefehlen, die nach dem vollständigen Start
des ISDN-Krams ausgeführt wird. Ungetestet.
file... Steuerdateien.
file... Konfigurationsdateien.
monitor
@ -1416,13 +1501,12 @@ Hackers Corner
==============
Debuggingoptionen:
Das Masterprogramm schickt Debugkram nach stdout. Umleiten nach /dev/null
wenn's stört.
Das Masterprogramm schickt Debugkram nach stderr und manches andere nach
stdout. Umleiten nach /dev/null wenn's stört; die Debugsachen werden
sukzessive abgestellt, wenn ich mal wieder ein wenig Zeit habe. :-/
In isdn/cards/dumb/Config.c stehen ein paar DEBUG_*-Flags.
In isdn/config/config.data finden sich die Konstanten CONF_DEBUG und
CONF_MOD2, die das Verhalten von isdn_2/isdn_2.c kontrollieren.
Das Debuggingverhalten des Haupttreibers im Kernel läßt sich durch die
isdn2_debug- und isdn2_log-Flags steuern; siehe isdn_2/isdn_2.c.
Hinweis: Wenn alles funktioniert, kann man die Debuggerei getrost
abschalten. Allerdings ist dann die Fehlersuche so gut wie unmöglich...

View File

@ -6,9 +6,6 @@ SUBDIRS = config include compat streams support isdn_3 isdn_4 tools \
.PHONY: depend
all:: .diddepend
depend::
$(MAKE) -C compat depend
$(MAKE) -C streams depend
dep: depend

14
README
View File

@ -4,6 +4,20 @@ Die Anleitung und der ganze Kram findet sich in der Datei DOKU, oder
README.isdn in den Kernelsourcen.
*** 1995-11-06
Release 19. Kleinere Bugfixes, insbesondere funktioniert das Senden von
EAZ unter 1TR6 wieder...
Der Backoff-Algorithmus, wennn die Gegenstelle nicht antwortet, wurde von
"konstant oder linear" auf "exponentiell" umgestellt. Sorry, aber das muß
so sein -- sonst meckert die Telekomik.
Der Master spuckt jetzt seine ganzen Debugmeldungen auf stderr aus und
protokolliert Statusmeldungen (Gebühreneinheiten) auf stdout.
VORHER WAR DAS UMGEKEHRT, das hat manchen Benutzer durcheinandergebracht.
*** 1995-10-30
Release 17.

View File

@ -16,7 +16,7 @@
#include <sys/param.h>
#include <sys/sysmacros.h>
#include "streams.h"
#include <sys/stropts.h>
#include "stropts.h"
/* #include <sys/user.h> */
#include <sys/errno.h>
#include "streamlib.h"

View File

@ -11,7 +11,7 @@
#include <unistd.h>
#include <string.h>
#ifdef linux
#include <linux/syscompat.h>
#include <compat.h>
#endif
short mx[] = {16,32,64,128,256,512,1024,2048};

View File

@ -11,7 +11,7 @@
#include <unistd.h>
#include <string.h>
#ifdef linux
#include <linux/syscompat.h>
#include <compat.h>
#endif
short mult[] = {2,2,4,8,16,32,64,128};

View File

@ -6,7 +6,7 @@ REALSOURCE=loader.c
OBJS=$(addsuffix .o,$(CARDS))
EXTRA_CFLAGS= -DCARDTYPE=$(basename $@ .o)
SUBDIRS=capi dumb
SUBDIRS=capi dumb arnet
include $(TOPDIR)/Make.rules

View File

@ -14,7 +14,7 @@
#include "f_malloc.h"
#include <sys/sysmacros.h>
#include "streams.h"
#include <sys/stropts.h>
#include "stropts.h"
/* #ifdef DONT_ADDERROR */
#include "f_user.h"
/* #endif */
@ -23,14 +23,16 @@
#include <fcntl.h>
#include <stddef.h>
#include "streamlib.h"
#include "lap.h"
#include <sys/termios.h>
#include "loader.h"
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/tqueue.h>
#include <asm/io.h>
#include <asm/irq.h>
#include "loader.h"
extern void log_printmsg (void *log, const char *text, mblk_t * mp, const char*);
extern void logh_printmsg (void *log, const char *text, mblk_t * mp);
@ -134,16 +136,21 @@ static unsigned short memsz[] = {
};
#define NRMEM (sizeof(memsz)/sizeof(memsz[0]))
struct arnet_info { unsigned char *membase; short irq; short ioaddr;
struct arnet_info {
struct cardinfo info,*infoptr;
struct arnet_info *next;
unsigned short nports; short handshake;
struct tq_struct queue; char usage;
unsigned char ena01; unsigned char ena23; unsigned char irqf;
struct arnet_port port[4];
ARNET_ADDR memsize; ARNET_ADDR freemem[NRMEM]; ARNET_ADDR limmem;
ARNET_ADDR curpage; }
arnet_list[3] = {{NULL,}};
ARNET_ADDR curpage; };
short arnet_ncards = 0;
#define ARNET_NCARDS 4
#define ARNET_NPORTS 4
static struct arnet_info *arnet_map[NR_IRQS] = { NULL, };
static struct arnet_info *arnet_cards[ARNET_NCARDS];
const char *astr(char x)
{
@ -163,7 +170,7 @@ ldprintf(".%d.",__LINE__);
}
#define MEM(type,arn,offset) *(volatile unsigned type *)((void *)((arn)->membase + ((offset) & 0x3FFF)))
#define MEM(type,arn,offset) *(volatile unsigned type *)((void *)((arn)->info.memaddr + ((offset) & 0x3FFF)))
#define ADDR_SCA0 0xe110babe
#define ADDR_SCA1 0xca11babe
@ -175,29 +182,29 @@ arnet_page(struct arnet_info *arn, ARNET_ADDR addr)
switch(addr) {
case ADDR_NONE:
if(dodebug) { if(arn->curpage != ADDR_NONE) { arn->curpage = ADDR_NONE; dprintf("C-_"); } }
outb_p(0x00,arn->ioaddr+8);
outb_p(0x00,arn->info.ioaddr+8);
return NULL;
case ADDR_SCA0:
if(dodebug) { if(arn->curpage != ADDR_NONE) { arn->curpage = ADDR_NONE; dprintf("C0_"); } }
outb_p(0xC0,arn->ioaddr+8);
outb_p(0xC0,arn->info.ioaddr+8);
break;
case ADDR_SCA1:
if(dodebug) { if(arn->curpage != ADDR_NONE) { arn->curpage = ADDR_NONE; dprintf("C1_"); } }
outb_p(0xE0,arn->ioaddr+8);
outb_p(0xE0,arn->info.ioaddr+8);
break;
default:
dprintf(" BadPage 0x%lx ",addr);
return NULL;
}
SLOW_DOWN_IO; SLOW_DOWN_IO;
return arn->membase;
return (void *)arn->info.memaddr;
}
inline static void *
arnet_mempage(struct arnet_info *arn, ARNET_ADDR addr)
{
outb_p(((addr >> 14) & 0x0F) | 0x80, arn->ioaddr+8);
outb_p(((addr >> 14) & 0x0F) | 0x80, arn->info.ioaddr+8);
if(dodebug) { if(arn->curpage != (addr & ~0x3FFF)) { arn->curpage = addr & ~0x3FFF; dprintf("P%lx_",0x0F&(addr >> 14)); } }
return arn->membase+(addr & 0x3FFF);
return (void *)arn->info.memaddr+(addr & 0x3FFF);
}
#define SEL_SCA(arp) arnet_page((arp)->inf,((arp)->portnr > 1) ? ADDR_SCA1 : ADDR_SCA0)
@ -295,7 +302,7 @@ if(dodebug>1)ddprintf("v ");
} while(nszoff > 0);
arn->limmem = (arn->limmem + nlsz) & ~0x3FFF;
printf("ARNET %d: mem limit at %ldk\n",arn-arnet_list, (arn->limmem+0x4000) >> 10);
printf("ARNET %d: mem limit at %ldk\n",arn->info.ipl, (arn->limmem+0x4000) >> 10);
}
thisaddr = arn->limmem;
arn->limmem += lsz;
@ -508,7 +515,7 @@ arnet_mode(struct arnet_port *arp, int mode)
unsigned char offset;
long flags;
int err;
unsigned char inb3 = inb_p(arn->ioaddr+3);
unsigned char inb3 = inb_p(arn->info.ioaddr+3);
dprintf("ARNET_MODE %d of %d: ",mode,arp->portnr);
@ -520,22 +527,22 @@ dprintf("ARNET_MODE %d of %d: ",mode,arp->portnr);
case 0:
offset = 0x20;
arn->ena01 = arn->ena01 & ~0x15;
outb_p(arn->ena01,arn->ioaddr+0x09); break;
outb_p(arn->ena01,arn->info.ioaddr+0x09); break;
break;
case 1:
offset = 0x40;
arn->ena01 = arn->ena01 & ~0x2A;
outb_p(arn->ena01,arn->ioaddr+0x09); break;
outb_p(arn->ena01,arn->info.ioaddr+0x09); break;
break;
case 2:
offset = 0x20;
arn->ena23 = arn->ena23 & ~0x15;
outb_p(arn->ena23,arn->ioaddr+0x0E); break;
outb_p(arn->ena23,arn->info.ioaddr+0x0E); break;
break;
case 3:
offset = 0x40;
arn->ena23 = arn->ena23 & ~0x2A;
outb_p(arn->ena23,arn->ioaddr+0x0E); break;
outb_p(arn->ena23,arn->info.ioaddr+0x0E); break;
break;
default:
restore_flags(flags);
@ -560,22 +567,22 @@ dprintf(" ... unknown portnr\n");
case 0:
offset = 0x20;
if(mode & 2) arn->ena01 &= ~0x10;
outb_p(arn->ena01,arn->ioaddr+0x09); break;
outb_p(arn->ena01,arn->info.ioaddr+0x09); break;
break;
case 1:
offset = 0x40;
if(mode & 2) arn->ena01 &= ~0x20;
outb_p(arn->ena01,arn->ioaddr+0x09); break;
outb_p(arn->ena01,arn->info.ioaddr+0x09); break;
break;
case 2:
offset = 0x20;
if(mode & 2) arn->ena23 &= ~0x10;
outb_p(arn->ena23,arn->ioaddr+0x0E); break;
outb_p(arn->ena23,arn->info.ioaddr+0x0E); break;
break;
case 3:
offset = 0x40;
if(mode & 2) arn->ena23 &= ~0x20;
outb_p(arn->ena23,arn->ioaddr+0x0E); break;
outb_p(arn->ena23,arn->info.ioaddr+0x0E); break;
break;
default:
dprintf(" ... unknown portnr\n");
@ -634,25 +641,25 @@ dprintf(" ... mode unknown\n");
offset = 0x20;
arn->ena01 |= 0x05;
if(((inb3 >> 5) != 3) && !(mode & 2)) arn->ena01 |= 0x10;
outb_p(arn->ena01,arn->ioaddr+0x09);
outb_p(arn->ena01,arn->info.ioaddr+0x09);
break;
case 1:
offset = 0x40;
arn->ena01 |= 0x0A;
if(((inb3 >> 5) != 3) && !(mode & 2)) arn->ena01 |= 0x20;
outb_p(arn->ena01,arn->ioaddr+0x09);
outb_p(arn->ena01,arn->info.ioaddr+0x09);
break;
case 2:
offset = 0x20;
arn->ena23 |= 0x05;
if(((inb3 >> 5) != 3) && !(mode & 2)) arn->ena23 |= 0x10;
outb_p(arn->ena23,arn->ioaddr+0x0E);
outb_p(arn->ena23,arn->info.ioaddr+0x0E);
break;
case 3:
offset = 0x40;
arn->ena23 |= 0x0A;
if(((inb3 >> 5) != 3) && !(mode & 2)) arn->ena23 |= 0x20;
outb_p(arn->ena23,arn->ioaddr+0x0E);
outb_p(arn->ena23,arn->info.ioaddr+0x0E);
break;
}
arp->mode = mode;
@ -840,7 +847,7 @@ dprintf("G %d @ %d ",buf[arp->recvcur].buflen,arp->recvcur);
arp->recvend = (arp->recvend == arp->recvnum) ? 0 : (arp->recvend + 1);
thebuf = RBUFPTR(&buf[arp->recvend]);
dprintf("F %d @ %ld:%x ",arp->recvlen,arp->recvend,thebuf);
dprintf("F %d @ %d:%lx ",arp->recvlen,arp->recvend,thebuf);
SEL_SCA(arp);
MEM(long ,arn,dmaoff+0x00) = thebuf;
MEM(short,arn,dmaoff+0x0E) = arp->recvlen;
@ -1101,13 +1108,13 @@ ldprintf(".%d.",__LINE__);
}
if(irq2 & 0x01) {
unsigned char errs = MEM(char,arn,dmaoff+0x10);
dprintf(":DMI err rcv, s%02x m%02x ", errs,
dprintf(":DMI err rcv %d, s%02x m%02x ", errs,
MEM(char ,arn,dmaoff+0x14),
MEM(short,arn,dmaoff+0x0E));
if(msk2 & 0x01) {
errs &= MEM(char,arn,dmaoff+0x14);
if(errs & 0x20) { /* buffer overrun receive -- fatal */
printf(" * ARNET %d.%d: buffer overrun\n",arp->inf-arnet_list,arp->portnr);
printf(" * ARNET %d.%d: buffer overrun\n",arp->inf->info.ipl,arp->portnr);
if(!arp->recvsingle) {
if(0) {
struct dmabuf *buf = arnet_mempage(arn,arp->dmarecv);
@ -1140,7 +1147,7 @@ ldprintf(".%d.",__LINE__);
}
}
else if(errs & 0x10) { /* counter overflow */
printf(" * ARNET %d.%d: counter overrun\n",arp->inf-arnet_list,arp->portnr);
printf(" * ARNET %d.%d: counter overrun\n",arp->inf->info.ipl,arp->portnr);
}
} else
dprintf(" RE-masked-; ");
@ -1167,7 +1174,7 @@ ldprintf(".%d.",__LINE__);
MEM(short,arn,dmaoff+0x2E));
if(msk2 & 0x04) {
if(errs & 0x20) { /* buffer over/underrun */
if(dodebug>1)printf(" * ARNET %d.%d: buffer underrun\n",arp->inf-arnet_list,arp->portnr);
if(dodebug>1)printf(" * ARNET %d.%d: buffer underrun\n",arp->inf->info.ipl,arp->portnr);
if(0)arnet_memdump(arn,"Buf Underrun");
if(arp->sendoverflow > 1) {
} else {
@ -1175,7 +1182,7 @@ ldprintf(".%d.",__LINE__);
}
}
if(errs & 0x10) { /* counter overflow */
printf(" * ARNET %d.%d: counter underrun\n",arp->inf-arnet_list,arp->portnr);
printf(" * ARNET %d.%d: counter underrun\n",arp->inf->info.ipl,arp->portnr);
if(arp->sendsingle) {
} else {
}
@ -1256,66 +1263,79 @@ if(dodebug)dprintf("TxI Off; ");
}
static void
arnet_intr(int irq, struct pt_regs *foo)
arnet_intrx(struct arnet_info *arn)
{
int arc = arnet_ncards;
struct arnet_info *arn = arnet_list;
unsigned long flags;
unsigned char irqf;
ldprintf(".%d.",__LINE__);
while(arc > 0) {
unsigned long flags;
save_flags(flags); cli();
if(arn->usage++) {
if(irq != 0) {
if(dodebug>1)dprintf(".D.");
queue_task(&arn->queue,&tq_timer);
}
restore_flags(flags);
goto next;
}
save_flags(flags); cli();
if(arn->usage++) {
if(dodebug>1)dprintf(".D.");
queue_task(&arn->queue,&tq_timer);
restore_flags(flags);
if((irq != 0) && (arn->irq != irq))
goto next;
irqf = inb_p(arn->ioaddr+0x07);
if((irq != 0) && !(irqf & 1)) {
if(0)dprintf("stray interrupt! ");
goto next;
}
while(irqf & 0x01) {
if(dodebug>1)ddprintf("k ");
arnet_intr1(&arn->port[0]);
if(arn->nports > 1)
arnet_intr1(&arn->port[1]);
if(arn->nports > 2)
arnet_intr1(&arn->port[2]);
if(arn->nports > 3)
arnet_intr1(&arn->port[3]);
irqf = inb_p(arn->ioaddr+0x07);
}
if((irqf ^ arn->irqf) & 0x1E) {
dprintf("ARNET: DCD changed: from %02x to %02x\n",
irqf,arn->irqf);
/* TODO */
}
arn->irqf = irqf;
next:
arn->usage--;
arc--;
arn++;
goto next;
}
restore_flags(flags);
irqf = inb_p(arn->info.ioaddr+0x07);
while(irqf & 0x01) {
if(dodebug>1)ddprintf("k ");
arnet_intr1(&arn->port[0]);
if(arn->nports > 1)
arnet_intr1(&arn->port[1]);
if(arn->nports > 2)
arnet_intr1(&arn->port[2]);
if(arn->nports > 3)
arnet_intr1(&arn->port[3]);
irqf = inb_p(arn->info.ioaddr+0x07);
}
if((irqf ^ arn->irqf) & 0x1E) {
dprintf("ARNET: DCD changed: from %02x to %02x\n",
irqf,arn->irqf);
/* TODO */
}
arn->irqf = irqf;
next:
arn->usage--;
}
static void
arnet_exit1(struct arnet_info *arn)
arnet_intr(int irq, struct pt_regs *foo)
{
int cnt;
struct arnet_port *arp = arn->port;
ldprintf(".%d.",__LINE__);
arn->usage = 99;
struct arnet_info *arn;
for(arn=arnet_map[irq];arn != NULL; arn = arn->next)
arnet_intrx(arn);
}
void NAME(REALNAME,exit)(struct cardinfo *inf)
{
struct arnet_info **parn, *arn = NULL;
int cnt;
struct arnet_port *arp;
ldprintf(".%d.",__LINE__);
parn = &arnet_map[inf->irq];
while(*parn != NULL) {
if((*parn)->infoptr == inf) {
arn = *parn;
*parn = arn->next;
break;
}
}
if(arn == NULL) {
printf("ARNET error: exit: info record not found!\n");
return;
}
if(arnet_cards[inf->ipl] != arn) {
printf("ARNET error: exit: info record not found!\n");
return;
}
arnet_cards[inf->ipl] = NULL;
arn->usage = 99;
arp = arn->port;
for(cnt=0;cnt < arn->nports; arp++,cnt++) {
dprintf("Port %d: ",cnt);
if(arp->inf != arn) {
@ -1328,42 +1348,65 @@ dprintf("Port %d: ",cnt);
MEM(char,arn, 0x14) = 0x00; /* IRQ off */
MEM(char,arn, 0x15) = 0x00; /* IRQ off */
MEM(char,arn, 0x16) = 0x00; /* IRQ off */
if(arn->irq != 0)
free_irq(arn->irq);
release_region(arn->ioaddr,16);
if((arnet_map[arn->info.irq] == NULL) && (arn->info.irq != 0))
free_irq(arn->info.irq);
release_region(arn->info.ioaddr,16);
kfree(arn);
}
static int
arnet_init1(struct arnet_info *arn)
int NAME(REALNAME,init)(struct cardinfo *inf)
{
uchar_t inb3, inb4, inb5, inb6, inbc;
unsigned short x;
struct arnet_port *arp;
struct arnet_info *arn;
printf("Arnet: ");
if(inf->ioaddr < 0x100) {
printf("IOADDR %d bad\n",inf->ioaddr);
return -EINVAL;
}
if(inf->ipl >= ARNET_NCARDS) {
printf("IPL %d bad, 0 <= ipl <= %d\n",inf->ipl,ARNET_NCARDS-1);
return -EINVAL;
}
if(arnet_cards[inf->ipl] != NULL) {
printf("IPL %d busy!\n",inf->ipl);
return -EBUSY;
}
arn = kmalloc(sizeof(*arn),GFP_KERNEL);
if(arn == NULL) {
printf("no memory!\n");
return -ENOMEM;
}
bzero(arn,sizeof(*arn));
arn->usage = 99;
bzero(&arn->queue,sizeof(arn->queue));
arn->queue.routine = (void *)&arnet_intr;
arn->queue.data = (void *)(long)arn->irq;
arn->queue.routine = (void *)&arnet_intrx;
arn->queue.data = (void *)arn;
arn->infoptr = inf;
arn->info = *inf;
for(x=0;x<NRMEM;x++)
arn->freemem[x] = 0;
arn->limmem = 256;
inb3 = inb_p(arn->ioaddr+3);
inb4 = inb_p(arn->ioaddr+4);
inb5 = inb_p(arn->ioaddr+5);
inb6 = inb_p(arn->ioaddr+6);
if(check_region(arn->ioaddr,16)) {
printf("*** region 0x%x..0x%x blocked\n",arn->ioaddr,arn->ioaddr+15);
return 0;
inb3 = inb_p(arn->info.ioaddr+3);
inb4 = inb_p(arn->info.ioaddr+4);
inb5 = inb_p(arn->info.ioaddr+5);
inb6 = inb_p(arn->info.ioaddr+6);
if(check_region(arn->info.ioaddr,16)) {
printf("*** region 0x%x..0x%x blocked\n",arn->info.ioaddr,arn->info.ioaddr+15);
kfree(arn);
return -EBUSY;
}
arn->memsize = 1<<(((inb3&0x1C)>>2)+16);
printf("cf %02x: %d kByte, memory at %p, bus %d, adapter %s; %d ports; rev %02x; ", inb3, arn->memsize>>10, arn->membase, inb3&3, astr(inb3>>5), inb5, inb4);
if((unsigned long)arn->membase & 0xFF003FFF) {
printf("*** invalid membase: 0x%p\n",arn->membase);
return 0;
printf("cf %02x: %ld kByte, memory at %lx, bus %d, adapter %s; %d ports; rev %02x; ", inb3, arn->memsize>>10, arn->info.memaddr, inb3&3, astr(inb3>>5), inb5, inb4);
if(((unsigned long)arn->info.memaddr & 0xFF003FFF) || ((unsigned long)arn->info.memaddr < 0x80000)) {
printf("*** invalid memaddr: 0x%lx\n",arn->info.memaddr);
kfree(arn);
return -EINVAL;
}
{
unsigned long i;
@ -1379,7 +1422,8 @@ arnet_init1(struct arnet_info *arn)
arn->nports = inb5;
if(arn->nports != 2 && arn->nports != 4) {
printf("huh? card with %d ports?\n",arn->nports);
return 0;
kfree(arn);
return -EIO;
}
arn->handshake = inb6;
if(inb6 == 0)
@ -1404,14 +1448,14 @@ arnet_init1(struct arnet_info *arn)
arp->mode = -1;
}
outb_p(0x00,arn->ioaddr+0x09);
outb_p(0x00,arn->info.ioaddr+0x09);
if(arn->nports > 2)
outb_p(0x00,arn->ioaddr+0x0E);
outb_p(0x00,arn->info.ioaddr+0x0E);
udelay(2);
outb_p(0x40,arn->ioaddr+0x09);
outb_p(0x40,arn->info.ioaddr+0x09);
udelay(500);
arn->ena01 = arn->ena23 = 0x70;
switch(arn->irq) {
switch(arn->info.irq) {
case 0: inbc = 0; break;
case 3: inbc = 1; break;
case 5: inbc = 2; break;
@ -1421,15 +1465,16 @@ arnet_init1(struct arnet_info *arn)
case 12: inbc = 6; break;
case 15: inbc = 7; break;
default:
printf("*** unknown IRQ %d\n",arn->irq);
return 0;
printf("*** unknown IRQ %d\n",arn->info.irq);
kfree(arn);
return -EBUSY;
}
inbc <<= 1;
inbc |= 1 | (((long)arn->membase >> 10) & 0x30);
outb_p((long)arn->membase >> 16, arn->ioaddr+13);
outb_p(inbc, arn->ioaddr+12);
arn->irqf = inb_p(arn->ioaddr+7);
printf("inbc %02x, inbd %02lx; irqf %02x",inbc,(((long)arn->membase)>>16)&0xFF, arn->irqf);
inbc |= 1 | (((long)arn->info.memaddr >> 10) & 0x30);
outb_p((long)arn->info.memaddr >> 16, arn->info.ioaddr+13);
outb_p(inbc, arn->info.ioaddr+12);
arn->irqf = inb_p(arn->info.ioaddr+7);
printf("inbc %02x, inbd %02lx; irqf %02x",inbc,(((long)arn->info.memaddr)>>16)&0xFF, arn->irqf);
/* Now checking memory access */
@ -1455,27 +1500,31 @@ arnet_init1(struct arnet_info *arn)
if(MEM(char,arn,0x33) != 0xAA) {
if((arn->nports <= 2) || (MEM(char,arn,0x33) != 0x5A)) {
printf("ERROR: Readback A, %02x\n", MEM(char,arn,0x33));
return 0;
return -EIO;
}
printf("ERROR: second chip unselectable A, %02x\n", MEM(char,arn,0x33));
return 0;
kfree(arn);
return -EIO;
}
if(MEM(char,arn,0x53) != 0x55) {
if((arn->nports <= 2) || (MEM(char,arn,0x53) != 0xA5)) {
printf("ERROR: Readback B, %02x\n", MEM(char,arn,0x53));
return 0;
return -EIO;
}
printf("ERROR: second chip unselectable B, %02x\n", MEM(char,arn,0x53));
return 0;
kfree(arn);
return -EIO;
}
if(arn->nports > 2) {
arnet_page(arn,ADDR_SCA1);
if(MEM(char,arn,0x33) != 0x5A) {
printf("ERROR: Readback C, %02x\n", MEM(char,arn,0x33));
return 0;
kfree(arn);
return -EIO;
} else if(MEM(char,arn,0x53) != 0xA5) {
printf("ERROR: Readback D, %02x\n", MEM(char,arn,0x53));
return 0;
kfree(arn);
return -EIO;
}
}
@ -1488,71 +1537,46 @@ arnet_init1(struct arnet_info *arn)
MEM(char,arn,0x53) = 0xFF;
}
if((arn->irq != 0) && request_irq(arn->irq,arnet_intr,0 /* SA_INTERRUPT */,"arnet")) {
printf("*** IRQ %d not available\n",arn->irq);
return 0;
if((arn->info.irq != 0) && (arnet_map[arn->info.irq] == NULL) && request_irq(arn->info.irq,arnet_intr,0 /* SA_INTERRUPT */,"arnet")) {
printf("*** IRQ %d not available\n",arn->info.irq);
kfree(arn);
return -EBUSY;
}
request_region(arn->ioaddr,16,"arnet");
request_region(arn->info.ioaddr,16,"arnet");
arn->next = arnet_map[arn->info.irq];
arnet_map[arn->info.irq] = arn;
arnet_cards[arn->info.ipl] = arn;
printf("\n");
arn->usage = 0;
return 1;
return 0;
}
static int
arnet_init (void)
{
ldprintf(".%d.",__LINE__);
arnet_ncards = 0;
arnet_list[arnet_ncards].membase = (void *)0xCC000;
arnet_list[arnet_ncards].irq = 15;
arnet_list[arnet_ncards].ioaddr = 0x300;
if(arnet_init1(&arnet_list[0])) arnet_ncards++;
printf ("ARNET: %d cards found\n",arnet_ncards);
if(arnet_ncards == 0)
return -ESRCH;
else
return 0;
}
static void
arnet_exit(void)
{
int arc = arnet_ncards;
struct arnet_info *arn = arnet_list;
ldprintf(".%d.",__LINE__);
while(arc > 0) {
dprintf("Exit, %d ports: ",arn->nports);
ddprintf("l ");
arnet_exit1(arn);
arc--;
arn++;
}
}
/* Streams code to open the driver. */
static int
arnet_open (queue_t * q, dev_t dev, int flag, int sflag ERR_DECL)
{
struct arnet_info *arn = arnet_list;
struct arnet_info **parn = arnet_cards;
struct arnet_info *arn = NULL;
struct arnet_port *arp;
int mdev = arnet_ncards;
int mdev = ARNET_NCARDS-1;
int cdev;
int err;
ldprintf(".%d.",__LINE__);
dev = minor (dev);
cdev = dev & 0x0F;
while(mdev > 0 && cdev >= arn->nports) {
while(mdev > 0 && cdev >= 0) {
if((arn = *parn) != NULL && cdev < arn->nports)
break;
ddprintf("n ");
cdev -= arn->nports;
arn++;
cdev -= ARNET_NPORTS;
parn++;
mdev --;
}
if(mdev == 0) {
if(mdev == 0 || cdev < 0) {
ERR_RETURN(-ENXIO);
}
arn->usage++;
@ -1567,13 +1591,11 @@ ddprintf("n ");
arp->q = q;
arp->mode = dev >> 4;
MORE_USE;
WR (q)->q_ptr = (caddr_t) arp;
q->q_ptr = (caddr_t) arp;
if((err = arnet_mode(arp,arp->mode)) < 0) {
arnet_dmaexit(arp);
LESS_USE;
arn->usage--;
q->q_ptr = NULL;
WR(q)->q_ptr = NULL;
@ -1595,6 +1617,7 @@ ddprintf("n ");
arp->recvend,
MEM(short,arn,dmaoff+0x0C));
}
(*arn->info.use_count)++;
return dev;
}
@ -1620,7 +1643,7 @@ arnet_close (queue_t *q, int dummy)
arp->q = NULL;
arn->usage--;
LESS_USE;
(*arn->info.use_count)--;
return;
}
@ -1630,7 +1653,7 @@ static void
arnet_wput (queue_t *q, mblk_t *mp)
{
struct arnet_port *arp = (struct arnet_port *) q->q_ptr;
struct arnet_info *arn = arp->inf;
/* struct arnet_info *arn = arp->inf; */
ldprintf(".%d.",__LINE__);
#ifdef CONFIG_DEBUG_STREAMS
@ -1641,13 +1664,13 @@ ldprintf(".%d.",__LINE__);
freemsg(mp);
return;
}
switch (DATATYPE(mp)) {
switch (DATA_TYPE(mp)) {
case M_IOCTL:
DATA_TYPE(mp) = M_IOCNAK;
((struct iocblk *)mp->b_rptr)->ioc_error = EINVAL;
qreply (q, mp);
break;
CASE_DATA
case CASE_DATA:
putq (q, mp);
break;
case M_FLUSH:
@ -1763,7 +1786,6 @@ if(dodebug>1)ddprintf("q ");
}
#ifdef MODULE
static int devmajor1 = 0;
static int devmajor2 = 0;
@ -1773,18 +1795,13 @@ static int do_init_module(void)
int err;
ldprintf(".%d.",__LINE__);
if((err = arnet_init()) < 0)
return err;
err = register_strdev(0,&arnet_info,0);
if(err < 0) {
arnet_exit();
if(err < 0)
return err;
}
devmajor1 = err;
err = register_strdev(0,&arnet_tinfo,arnet_ncards);
err = register_strdev(0,&arnet_tinfo,ARNET_NCARDS);
if(err < 0) {
unregister_strdev(devmajor1,&arnet_info,0);
arnet_exit();
return err;
}
devmajor2 = err;
@ -1794,9 +1811,9 @@ ldprintf(".%d.",__LINE__);
static int do_exit_module(void)
{
int err1 = unregister_strdev(devmajor1,&arnet_info,0);
int err2 = unregister_strdev(devmajor2,&arnet_tinfo,arnet_ncards);
int err2 = unregister_strdev(devmajor2,&arnet_tinfo,ARNET_NCARDS);
ldprintf(".%d.",__LINE__);
arnet_exit();
return err1 || err2;
}
#endif

View File

@ -26,7 +26,7 @@
#include "isdn_proto.h"
#include "smallq.h"
#include "isdn_limits.h"
#include <sys/stream.h>
#include "stream.h"
#include "streamlib.h"
#include <sys/errno.h>
#include <sys/sysmacros.h>
@ -49,13 +49,6 @@
#define SetSPL(x) spl((x))
#endif
/* This is ANSI... */
#define xxappxx(a,b) a##b
#define NAME(a,b) xxappxx(a,b) /* isn't C wonderful */
#define xxstrxx(a) #a
#define STRING(a) xxstrxx(a) /* ditto */
extern void log_printmsg (void *log, const char *text, mblk_t * mp, const char*);
static void reset_card(struct _bintec *bp);
static void toss_unknown (struct _bintec *bp);
@ -253,7 +246,8 @@ bd_msgout( struct _bintec *bp )
}
if(++count > 1000) {
printf("\n%sBINTEC: The board seems to be in an infinite loop.\n",KERN_ERR);
isdn2_new_state(&bp->card,2);
if(bp->waitmsg == 0)
isdn2_new_state(&bp->card,2);
CTRL_RESET(bp);
return -EIO;
}
@ -262,7 +256,8 @@ bd_msgout( struct _bintec *bp )
if (*bp->state & 0x80) { /* board failed */
CTRL_RESET(bp); /* reset board */
printf("BINTEC: msgout: board failed???\n");
isdn2_new_state(&bp->card,2);
if(bp->waitmsg == 0)
isdn2_new_state(&bp->card,2);
return -EIO;
}
return 0;
@ -1042,8 +1037,7 @@ pushone(struct _bintec *bp, int thechan)
if(err == 0) {
freeb(mb);
S_enqueue(&bp->chan[0].q_out,mr);
if(bp->chan[0].q_out.nblocks == 1)
sendone(bp,0);
sendone(bp,0);
} else if(err == -EAGAIN) {
S_requeue(&chan->q_in, mb);
freemsg(mr);
@ -1084,8 +1078,7 @@ postproc(struct _bintec *bp, mblk_t *mb, int ch)
isdn2_chstate(&bp->card,MDL_ERROR_IND,0);
return -EIO;
}
if(bp->chan[0].q_out.nblocks == 1)
sendone(bp,0);
sendone(bp,0);
break;
case CAPI_DATAB3_IND:
{
@ -1117,8 +1110,7 @@ postproc(struct _bintec *bp, mblk_t *mb, int ch)
card instead. */
isdn2_chstate(&bp->card,MDL_ERROR_IND,0);
}
if(chan->q_in.nblocks == 1)
pushone(bp,ch);
pushone(bp,ch);
}
break;
case CAPI_DATAB3_CONF:
@ -1216,8 +1208,7 @@ process_unknown (struct _bintec *bp)
cr->ncci = ci->ncci;
cr->blknum = ci->blknum;
S_enqueue(&bp->chan[0].q_out,mr);
if(bp->chan[0].q_out.nblocks == 1)
sendone(bp,0);
sendone(bp,0);
}
freemsg(mb);
}

View File

@ -50,7 +50,7 @@ CMDR 41
#include "smallq.h"
#include "isdn_limits.h"
#include "isdn_proto.h"
#include <sys/stream.h>
#include "stream.h"
#include "streamlib.h"
#include <sys/errno.h>
#ifdef SCO
@ -199,11 +199,6 @@ typedef struct _hscx {
#define DUMBTIME 300 /* poll: times per second */
#define xxappxx(a,b) a##b
#define NAME(a,b) xxappxx(a,b) /* isn't C wonderful */
#define xxstrxx(a) #a
#define STRING(a) xxstrxx(a) /* ditto */
void NAME(REALNAME,poll)(struct _dumb *dumb);
#else
void NAME(REALNAME,poll)(void *);

View File

@ -8,11 +8,6 @@
#error "You have to define CARDTYPE for this to work."
#endif
#define xxappxx(a,b) a##b
#define NAME(a,b) xxappxx(a,b) /* isn't C wonderful */
#define xxstrxx(a) #a
#define STRING(a) xxstrxx(a) /* ditto */
extern int NAME(CARDTYPE,init)(struct cardinfo *inf);
extern void NAME(CARDTYPE,exit)(struct cardinfo *inf);
@ -38,6 +33,7 @@ static int do_init_module(void)
inf.memaddr = mem;
inf.ID = name;
inf.debug = debug;
inf.use_count = &mod_use_count_;
return NAME(CARDTYPE,init)(&inf);
}

View File

@ -1,14 +1,5 @@
all::
depend::
rm -f syscompat.h linux
ln -s compat.h syscompat.h
ln -s . linux
KERNEL=1
TOPDIR=..
include $(TOPDIR)/Make.rules
clean::
rm -f linux

View File

@ -348,14 +348,14 @@ char kernel_version[] = UTS_RELEASE;
int init_module(void)
{
/* This should work... */
#if defined(__ELF__)
#define U
#else
#define U "_"
#endif
rename_module_symbol(U "do_i_sleep_on",U "interruptible_sleep_on");
rename_module_symbol(U "do_sleep_on",U "sleep_on");
/* This should _really_ work... */
printk("If exactly two \"rename...\" errors follow, ignore them.\n");
if(!rename_module_symbol("_do_i_sleep_on","_interruptible_sleep_on") &&
!rename_module_symbol( "do_i_sleep_on", "interruptible_sleep_on"))
return -ENOENT;
if(!rename_module_symbol("_do_sleep_on","_sleep_on") &&
!rename_module_symbol( "do_sleep_on", "sleep_on"))
return -ENOENT;
return 0;
}

View File

@ -13,7 +13,7 @@
#include <sys/param.h>
#include <sys/sysmacros.h>
#include "streams.h"
#include <sys/stropts.h>
#include "stropts.h"
#ifdef DONT_ADDERROR
#include "f_user.h"
#endif

View File

@ -4,7 +4,7 @@
#ifdef KERNEL
#ifdef linux
#include <linux/syscompat.h>
#include "compat.h"
#endif
#ifdef M_UNIX /* SCO et al */

View File

@ -1,10 +1,10 @@
#ifndef _INC_KERNEL
#define _INC_KERNEL
#ifndef KERNEL
#if defined(linux)
#include <linux/config.h>
#endif
#ifndef KERNEL
#include <malloc.h>
#include <stdio.h>
#include <sys/param.h>
@ -36,7 +36,13 @@ extern void panic(const char *x, ...);
#define kfree(a) free((a))
#define kfree_s(a,b) free((a))
#undef HZ
#define HZ 10 /* don't need more granularity */
#else /* KERNEL */
#ifndef __KERNEL__
#define __KERNEL__
#endif
#include <linux/kernel.h>
char *loghdr(char level);
#undef KERN_EMERG

View File

@ -8,8 +8,13 @@ struct cardinfo {
unsigned char irq, ipl;
unsigned long ID;
unsigned int debug;
long *use_count;
};
#define xxappxx(a,b) a##b
#define NAME(a,b) xxappxx(a,b) /* isn't C wonderful */
#define xxstrxx(a) #a
#define STRING(a) xxstrxx(a) /* ditto */
#endif

View File

@ -2,7 +2,7 @@
#define _PRIM_H
#include <linux/config.h>
#include <linux/syscompat.h>
#include "compat.h"
#include "config.h"
#include "kernel.h"
@ -12,7 +12,7 @@
#ifdef linux
#include <linux/major.h>
#ifdef KERNEL
#include <linux/syscompat.h>
#include "compat.h"
#else
#include <stdio.h> /* printf */
#include <unistd.h>

View File

@ -18,7 +18,7 @@
#include "f_signal.h"
#include <sys/param.h>
#include <sys/sysmacros.h>
#include <sys/stropts.h>
#include "stropts.h"
#include "streams.h"
#include "config.h"

View File

@ -7,10 +7,10 @@
#if !(defined(__sys_stream_h) || defined(_SYS_STREAM_H) || defined(_LINUX_STREAM_H))
#ifdef KERNEL
#include <sys/stream.h>
#include "stream.h"
#else
#ifdef linux
#include <sys/stream.h>
#include "stream.h"
#else
#include <sys/aux-stream.h>
#endif /* KERNEL */

View File

@ -4,7 +4,7 @@
#include <linux/types.h>
#include <linux/syscompat.h>
#include <linux/fs.h>
#include <linux/stropts.h>
#include "stropts.h"
#include <linux/kernel.h>
#define MAX_STRDEV MAX_CHRDEV /* don't change */

View File

@ -1,4 +1,4 @@
#include <sys/stream.h>
#include "stream.h"
/*
* Compare two feature vectors, mask off certain bits.
* Return..:

View File

@ -13,7 +13,7 @@
#include <sys/param.h>
#include <sys/sysmacros.h>
#include "streams.h"
#include <sys/stropts.h>
#include "stropts.h"
#ifdef DONT_ADDERROR
#include "f_user.h"
#endif

View File

@ -14,7 +14,7 @@
#include <stdio.h>
#include <ctype.h>
#include "ip_mon.h"
#include <sys/stropts.h>
#include "stropts.h"
#include <sys/file.h>
#include <sys/stat.h>
#include <fcntl.h>

View File

@ -18,7 +18,7 @@
#include "f_malloc.h"
#include <sys/sysmacros.h>
#include "streams.h"
#include <sys/stropts.h>
#include "stropts.h"
/* #ifdef DONT_ADDERROR */
#include "f_user.h"
/* #endif */
@ -2219,7 +2219,13 @@ isdn2_wput (queue_t *q, mblk_t *mp)
switch (DATA_TYPE(mp)) {
case M_IOCTL:
DATA_TYPE(mp) = M_IOCNAK;
((struct iocblk *)mp->b_rptr)->ioc_error = EINVAL;
((struct iocblk *)mp->b_rptr)->ioc_error =
#ifdef LINUX
ENOIOCTLCMD
#else
EINVAL
#endif
;
qreply (q, mp);
break;
case CASE_DATA:

View File

@ -1091,7 +1091,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
}
} else {
printf("CAPI error: DISCONNECTB3_CONF in wrong state %d\n",conn->state);
printf("CAPI error: DISCONNECTB3_CONF in wrong state %d, wf 0x%lx\n",conn->state,conn->waitflags);
err = -EIO;
break;
}
@ -1209,7 +1209,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
setstate(conn,0);
}
} else {
printf("CAPI error: DISCONNECT_CONF in wrong state %d, info %04x\n",conn->state,c2->info);
printf("CAPI error: DISCONNECT_CONF in wrong state %d, info %04x, wf 0x%lx\n",conn->state,c2->info,conn->waitflags);
isdn3_setup_conn (conn, EST_DISCONNECT);
setstate(conn,0);
report_terminate(conn,c2->info,0);
@ -1251,7 +1251,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
}
} else {
printf("CAPI error: CONNECT_CONF in wrong state %d, info %04x\n",conn->state,c2->info);
printf("CAPI error: CONNECT_CONF in wrong state %d, info %04x, wf 0x%lx\n",conn->state,c2->info,conn->waitflags);
isdn3_setup_conn (conn, EST_DISCONNECT);
report_terminate(conn,c2->info,0);
if(send_disconnect(conn,0,N1_LocalProcErr) < 0)
@ -1276,7 +1276,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
conn->waitflags &=~ (1<<WF_SELECTB2_CONF);
err = after_active(conn,0);
} else {
printf("CAPI error: SELECTB2_CONF in wrong state %d, info %04x\n",conn->state,c2->info);
printf("CAPI error: SELECTB2_CONF in wrong state %d, info %04x, wf 0x%lx\n",conn->state,c2->info,conn->waitflags);
report_terminate(conn,c2->info,0);
if(send_disconnect(conn,0,N1_OutOfOrder) < 0)
setstate(conn,0);
@ -1299,7 +1299,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
conn->waitflags &=~ (1<<WF_SELECTB3_CONF);
err = after_active(conn,0);
} else {
printf("CAPI error: SELECTB3_CONF in wrong state %d, info %04x\n",conn->state,c2->info);
printf("CAPI error: SELECTB3_CONF in wrong state %d, info %04x, wf 0x%lx\n",conn->state,c2->info,conn->waitflags);
report_terminate(conn,c2->info,0);
if(send_disconnect(conn,0,N1_OutOfOrder) < 0)
setstate(conn,0);
@ -1322,7 +1322,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
conn->waitflags &=~ (1<<WF_CONNECTACTIVE_IND);
err = after_active(conn,0);
} else {
printf("CAPI error: CONNECTACTIVE_IND in wrong state %d\n",conn->state);
printf("CAPI error: CONNECTACTIVE_IND in wrong state %d, wf 0x%lx\n",conn->state,conn->waitflags);
if(send_disconnect(conn,0,N1_OutOfOrder) < 0)
setstate(conn,0);
}
@ -1362,7 +1362,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
conn->ncci0 = c2->ncci;
err = after_active(conn,1);
} else {
printf("CAPI error: CONNECTB3_IND in wrong state %d\n",conn->state);
printf("CAPI error: CONNECTB3_IND in wrong state %d, wf 0x%lx\n",conn->state,conn->waitflags);
if(send_disconnect(conn,0,N1_OutOfOrder) < 0)
setstate(conn,0);
}
@ -1404,7 +1404,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
err = after_active(conn,0);
} else {
err = -EIO;
printf("CAPI error: LISTENB3_CONF in wrong state %d, info %04x\n",conn->state,c2->info);
printf("CAPI error: LISTENB3_CONF in wrong state %d, info %04x, wf 0x%lx\n",conn->state,c2->info,conn->waitflags);
if(send_disconnect(conn,0,N1_OutOfOrder) < 0)
setstate(conn,0);
}
@ -1428,7 +1428,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
err = after_active(conn,1);
} else {
err = -EIO;
printf("CAPI error: CONNECTB3_CONF in wrong state %d, info %04x\n",conn->state,c2->info);
printf("CAPI error: CONNECTB3_CONF in wrong state %d, info %04x, wf 0x%lx\n",conn->state,c2->info,conn->waitflags);
if(send_disconnect(conn,0,N1_OutOfOrder) < 0)
setstate(conn,0);
}
@ -1451,7 +1451,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
conn->waitflags &=~ (1<<WF_CONNECTB3ACTIVE_IND);
err = after_active(conn,0);
} else {
printf("CAPI error: CONNECTB3ACTIVE_IND in wrong state %d\n",conn->state);
printf("CAPI error: CONNECTB3ACTIVE_IND in wrong state %d, wf 0x%lx\n",conn->state,conn->waitflags);
if(send_disconnect(conn,0,N1_OutOfOrder) < 0)
setstate(conn,0);
}
@ -2093,12 +2093,12 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
err = after_active(conn,0);
} else {
err = -EIO;
printf("CAPI error: CONTROL_EAZ in wrong state %d, info %04x\n",conn->state,c2->info);
printf("CAPI error: CONTROL_EAZ in wrong state %d, info %04x, wf 0x%lx\n",conn->state,c2->info,conn->waitflags);
if(send_disconnect(conn,0,N1_OutOfOrder) < 0)
setstate(conn,0);
}
} else if(talk->tstate < STATE_CONF_FIRST || talk->tstate > STATE_CONF_LAST) {
printf("CAPI error: CONTROL_EAZ in wrong state %d, info %04x\n",conn->state,c2->info);
printf("CAPI error: CONTROL_EAZ in wrong tstate %ld\n",talk->tstate);
}
if(c2->info != 0) {
printf("CAPI error: EAZMAPPING failed %04x\n",c2->info);

View File

@ -1,5 +1,3 @@
/* Show the reasons for not changing connection states */
#define REPORT
/**
** ISDN Level 3 control module
@ -13,7 +11,7 @@
#include <sys/param.h>
#include <sys/sysmacros.h>
#include "streams.h"
#include <sys/stropts.h>
#include "stropts.h"
#ifdef DONT_ADDERROR
#include "f_user.h"
#endif
@ -44,6 +42,11 @@
ushort_t hdrseq = 2;
/* Show the reasons for not changing connection states? */
#ifdef DO_DEBUGGING
#define REPORT
#endif
/*
* Global data. These should be allocated dynamically. They are not because
* most kernels don't have a way to find out how much kernel memory is left,
@ -226,7 +229,9 @@ isdn3_killconn (isdn3_conn conn, char force)
isdn3_talk talk = conn->talk;
#ifdef REPORT
printf ("Conn %ld: Killing %d St %lo: min %d, at %d", conn->call_ref, force, conn->minorstate, conn->minor, conn->fminor);
#endif
if(force)
conn->id = 0;
@ -383,7 +388,7 @@ isdn3_killconn (isdn3_conn conn, char force)
int i;
for(i=0;i<NMINOR;i++) {
if(minor2conn[i]==conn) {
printf("ISDN_3 DeadConn %p, at pos %d, minor %d\n",minor2conn[i],i,conn->minor);
if(0)printf("ISDN_3 DeadConn %p, at pos %d, minor %d\n",minor2conn[i],i,conn->minor);
minor2conn[i]=NULL;
}
}
@ -877,7 +882,9 @@ Xisdn3_setup_conn (isdn3_conn conn, char established, const char *deb_file, unsi
mblk_t *mp;
isdn23_hdr hdr;
#ifdef REPORT
printf ("Disconnect %d.",established);
#endif
/* The connection isn't in the process of being established any more. */
if (conn->minorstate & MS_CONNDELAY_TIMER) {
conn->minorstate &= ~MS_CONNDELAY_TIMER;
@ -2299,8 +2306,7 @@ printf("ErX k\n");
if(call_ref != 0)
conn->call_ref = call_ref;
}
if(theID == CMD_OFF) printf(" D1 ");
printf ("* Conn%p: min %d at %d; minor %d min %d; callref %ld connref %d \n",
if(0)printf ("* Conn%p: min %d at %d; minor %d min %d; callref %ld connref %d \n",
conn, conn->minor, conn->fminor,
minor, fminor, conn->call_ref, conn->conn_id);
if (conn->minor == 0 && !nodisc && (theID != CMD_OFF)) {
@ -2308,11 +2314,9 @@ if(theID == CMD_OFF) printf(" D1 ");
if (conn->minor != 0)
minor2conn[conn->minor] = conn;
}
else printf(" D4 ");
if (do_talk)
conn->minorstate |= MS_FORCING;
if (conn->minor != 0) {
if(theID == CMD_OFF) printf(" D5 ");
if (conn->fminor == 0)
conn->fminor = fminor;
minor2conn[conn->minor] = conn;
@ -2322,7 +2326,6 @@ if(theID == CMD_OFF) printf(" D5 ");
if (conn->stack[0] == 0)
memcpy(conn->stack,stack,sizeof(conn->stack));
if(do_int != 0) {
if(theID == CMD_OFF) printf(" D6 ");
if(conn->minor == 0) {
printf("\n*** CM Zero!\n");
} else if(do_int > 0)
@ -2330,11 +2333,9 @@ if(theID == CMD_OFF) printf(" D6 ");
else
minorflags[conn->minor] &=~ MINOR_INT;
}
if(theID == CMD_OFF) printf(" D7 ");
conn->lockit++;
isdn3_setup_conn (conn, EST_NO_CHANGE);
conn->lockit--;
if(theID == CMD_OFF) printf(" D8 ");
if(conn->state == 0) {
/* XXX */
}
@ -2345,7 +2346,6 @@ if(theID == CMD_OFF) printf(" D8 ");
printf ("ErrOut t of %d is %d\n", talk->hndl->SAPI, err);
goto err_out;
}
if(theID == CMD_OFF) printf(" D9 ");
break;
}
/* ok_out: */
@ -2448,7 +2448,7 @@ isdn3_findminor (ushort_t minor)
if (minor2conn[minor] == NULL)
return NULL;
conn = minor2conn[minor];
printf (".FindMinor%p %d gets C %d:%d\n", conn, minor, conn->minor, conn->fminor);
if(0)printf (".FindMinor%p %d gets C %d:%d\n", conn, minor, conn->minor, conn->fminor);
return conn;
}
@ -2482,15 +2482,19 @@ isdn3_findtalk (isdn3_card card, isdn3_hndl hndl, mblk_t *info, int create)
int i;
int err;
char systr[200] = "";
if(card->info != NULL)
sprintf(systr+strlen(systr),"'%-*s'",card->info->b_wptr-card->info->b_rptr,card->info->b_rptr);
else strcat(systr,"NULL");
strcat(systr," and info ");
if(info != NULL)
sprintf(systr+strlen(systr),"'%-*s'",info->b_wptr-info->b_rptr,info->b_rptr);
else strcat(systr,"NULL");
syslog(LOG_DEBUG,"====== Create 0x%02x with card %s",hndl->SAPI,systr);
#if 0
char systr[200] = "";
if(card->info != NULL)
sprintf(systr+strlen(systr),"'%-*s'",card->info->b_wptr-card->info->b_rptr,card->info->b_rptr);
else
strcat(systr,"NULL");
strcat(systr," and info ");
if(info != NULL)
sprintf(systr+strlen(systr),"'%-*s'",info->b_wptr-info->b_rptr,info->b_rptr);
else
strcat(systr,"NULL");
syslog(LOG_DEBUG,"====== Create 0x%02x with card %s",hndl->SAPI,systr);
#endif
if(card->info != NULL) {
mblk_t *mi = card->info;
streamchar *sta = mi->b_rptr;
@ -2661,7 +2665,7 @@ isdn3_findconn (isdn3_talk talk, long protocol, long call_ref)
for (conn = talk->conn; conn != NULL; conn = conn->next)
if (conn->subprotocol == protocol && conn->call_ref == call_ref
&& (conn->state != 0)) {
printf(".FindConn%p, ref %ld:",conn,call_ref);
if(0)printf(".FindConn%p, ref %ld:",conn,call_ref);
return conn;
}
return NULL;
@ -2735,7 +2739,7 @@ isdn3_open (queue_t * q, dev_t dev, int flag, int sflag ERR_DECL)
WR (q)->q_ptr = (caddr_t) & isdn3_q;
q->q_ptr = (caddr_t) isdn3_q;
printf ("ISDN Master driver %d opened.\n", dev);
if(0)printf ("ISDN Master driver %d opened.\n", dev);
return 0;
}
@ -2746,7 +2750,7 @@ isdn3_close (queue_t *q, int dummy)
{
flushq (q, FLUSHALL);
flushq (WR (q), FLUSHALL);
printf ("ISDN Master driver closed.\n");
if(0)printf ("ISDN Master driver closed.\n");
isdn3_q = NULL;
return;
}
@ -2942,8 +2946,7 @@ isdn3_rsrv (queue_t * q)
isdn3_talk talk;
if (conn == NULL) {
if (0)
printf ("XData: Conn for minor %d nf\n", hdr.hdr_detach.minor);
if (0) printf ("XData: Conn for minor %d nf\n", hdr.hdr_detach.minor);
break;
}
if ((talk = conn->talk) == NULL) {
@ -3041,7 +3044,7 @@ isdn3_rsrv (queue_t * q)
break;
}
if (minorflags[hdr.hdr_open.minor] & MINOR_OPEN) {
printf ("Open: Minor %d open\n", hdr.hdr_open.minor);
if(0)printf ("Open: Minor %d open\n", hdr.hdr_open.minor);
break;
}
@ -3070,7 +3073,7 @@ isdn3_rsrv (queue_t * q)
isdn3_conn conn = isdn3_findminor (hdr.hdr_close.minor);
mblk_t *mx;
printf("\n*** Closed %d\n",hdr.hdr_close.minor);
if(0)printf("\n*** Closed %d\n",hdr.hdr_close.minor);
minorflags[hdr.hdr_close.minor] = 0;
if (conn != 0 && conn->minor == hdr.hdr_close.minor) {
SUBDEV cm = conn->minor;
@ -3239,7 +3242,7 @@ printf(" *SM %d: %d %d.%d\n",__LINE__,conn->conn_id,conn->minor,conn->fminor);
if (hdr.hdr_notify.SAPI == SAPI_INVALID) {
for (talk = card->talk; talk != NULL; talk = talk->next) {
printf("chstate for SAPI %x\n",talk->hndl->SAPI);
if(0)printf("chstate for SAPI %x\n",talk->hndl->SAPI);
(*talk->hndl->chstate) (talk, hdr.hdr_notify.ind, hdr.hdr_notify.add);
}
switch (hdr.hdr_notify.ind) {

View File

@ -1135,11 +1135,13 @@ recv (isdn3_conn conn, uchar_t msgtype, char isUI, uchar_t * data, ushort_t len)
phone_sendback (conn, MT_N1_CONN_ACK, NULL);
pr_setstate (conn, 10);
break;
case MT_N1_INFO:{
case MT_N1_INFO:
{
QD_INIT (data, len) break;
report_n1_info (conn, data, len);
QD {
QD_CASE (0, PT_N0_netSpecFac):{
QD_CASE (0, PT_N0_netSpecFac):
{
char nlen;
uchar_t facility;
@ -1153,9 +1155,11 @@ recv (isdn3_conn conn, uchar_t msgtype, char isUI, uchar_t * data, ushort_t len)
if (facility != N1_FAC_Forward1 && facility != N1_FAC_Forward2) {
pr_setstate (conn, 3);
}
} break;
}
break;
}
} break;
}
break;
case MT_N1_REL:
/* send REL up */
phone_sendback (conn, MT_N1_REL, NULL);
@ -1801,7 +1805,7 @@ recv (isdn3_conn conn, uchar_t msgtype, char isUI, uchar_t * data, ushort_t len)
static int
chstate (isdn3_conn conn, uchar_t ind, short add)
{
printf ("PHONE state for card %d says %d:%o\n", conn->card->nr, ind, add);
if(0)printf ("PHONE state for card %d says %d:%o\n", conn->card->nr, ind, add);
if(conn->p_data == NULL) {
if((conn->p_data = malloc(sizeof(struct t_info))) == NULL) {
return -ENOMEM;
@ -1976,16 +1980,18 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
case ARG_SPV:
svc = 1;
break;
case ARG_LNUMBER:{
case ARG_LNUMBER:
{
char nbuf[MAXNR];
m_getskip (data);
if (data->b_rptr > data->b_wptr+2) {
data->b_rptr = oldpos;
if ((err = m_getstr (data, nbuf, MAXNR)) != 0) {
printf("GetX EAZ: ");
conn->lockit--;
return -EINVAL;
return err;
}
((struct t_info *)conn->p_data)->eaz = data->b_rptr[1];
} break;
((struct t_info *)conn->p_data)->eaz = nbuf[strlen(nbuf)-1];
}
break;
case ARG_NUMBER:
m_getskip (data);
if ((err = m_getstr (data, (char *) ((struct t_info *)conn->p_data)->nr, MAXNR)) != 0) {
@ -2164,16 +2170,18 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
return err;
}
break;
case ARG_LNUMBER:{
case ARG_LNUMBER:
{
char nbuf[MAXNR];
m_getskip (data);
if (data->b_rptr > data->b_wptr-2) {
data->b_rptr = oldpos;
printf("GetEAZAns ");
if ((err = m_getstr (data, nbuf, MAXNR)) != 0) {
printf("GetX EAZans: ");
conn->lockit--;
return -EINVAL;
return err;
}
((struct t_info *)conn->p_data)->eaz = data->b_rptr[1];
} break;
((struct t_info *)conn->p_data)->eaz = nbuf[strlen(nbuf)-1];
}
break;
}
}
{

View File

@ -983,8 +983,10 @@ Xreport_ET_terminate (isdn3_conn conn, uchar_t * data, int len, int deb_line)
int err = 0;
mblk_t *mb = allocb (256, BPRI_MED);
extern int log_34;
printf("\nET Terminate at %d.\n",deb_line);
if(log_34 & 2)
printf("\nET Terminate at %d.\n",deb_line);
if (mb == NULL) {
pr_setstate (conn, 0);
return;
@ -2120,7 +2122,7 @@ printf (" ET: Recv %x in state %d\n", msgtype, conn->state);
static int
chstate (isdn3_conn conn, uchar_t ind, short add)
{
printf ("PHONE state for card %d says %d:%o\n", conn->card->nr, ind, add);
if(0)printf ("PHONE state for card %d says %d:%o\n", conn->card->nr, ind, add);
switch (ind) {
case DL_ESTABLISH_IND:
case DL_ESTABLISH_CONF:

View File

@ -438,9 +438,7 @@ read_args (void *nix)
}
}
if(nexttime == 0)
nexttime = 60;
else if(nexttime > 32767/HZ/60)
if((nexttime == 0) || (nexttime > 32767/HZ/60))
nexttime = 32767/HZ/60;
#ifdef NEW_TIMEOUT
classtimer =

View File

@ -73,7 +73,7 @@ Xsetconnref(const char *deb_file, unsigned int deb_line, conninfo conn, int conn
/* Print the text foo onto all ATL/ channels. */
void
connreport(char *foo, char *card)
connreport(char *foo, char *card, int minor)
{
conninfo conn;
mblk_t xx;
@ -92,6 +92,8 @@ connreport(char *foo, char *card)
continue;
if(!wildmatch(conn->cardname,card))
continue;
if(minor != 0 && conn->minor != minor)
continue;
if(conn->lastMsg != NULL && !strcmp(conn->lastMsg,foo))
continue;
if(conn->lastMsg != NULL)
@ -116,14 +118,16 @@ connreport(char *foo, char *card)
/* Print the state of this connection with connreport(). */
void
ReportConn(conninfo conn)
ReportOneConn(conninfo conn, int minor)
{
char sp[200], *spf = sp;
spf += sprintf(spf,"%s%d:%d %s %s %s %d %s/%s %ld %ld %s",
char is1[10]="",sp[200], *spf = sp;
if(conn->state == c_off)
sprintf(is1,".%d",conn->retiming);
spf += sprintf(spf,"%s%d:%d %s %s %s %d %s%s/%s %ld %ld %s",
conn->ignore?"!":"", conn->minor,
conn->seqnum, conn->cg ? conn->cg->site : "-",
conn->cg ? conn->cg->protocol : "-", conn->cg ? conn->cg->cclass : "-",
conn->pid, state2str(conn->state),
conn->pid, state2str(conn->state), is1,
conn->cg ? conn->cg->card : (conn->cardname ? conn->cardname : "-"),
conn->charge, conn->ccharge, FlagInfo(conn->flags));
if(conn->cg != NULL && (conn->cg->flags ^ conn->flags) != 0) {
@ -143,7 +147,20 @@ ReportConn(conninfo conn)
else if(conn->cg != NULL && conn->cg->oldlnr != NULL)
spf += sprintf(spf, ";%s",conn->cg->oldlnr);
spf += sprintf(spf," %s", CauseInfo(conn->cause, conn->causeInfo));
connreport(sp,(conn->cg ? conn->cg->card : "*"));
connreport(sp,(conn->cg ? conn->cg->card : "*"),minor);
}
int retimeout(conninfo conn)
{
/* Exponential backoff. Sorry but this is necessary. */
if(conn->charge != 0)
return 5*60*(1<<++conn->retiming);
else if (conn->cause == ID_priv_Busy)
return 5*(1<<(++conn->retiming/6));
else if(conn->flags & F_FASTREDIAL)
return 2+(1<<(++conn->retiming/4));
else
return 5+(1<<(++conn->retiming/2));
}
/* Sets the state of a connection; does all the housekeeping associated
@ -157,11 +174,11 @@ Xsetconnstate(const char *deb_file, unsigned int deb_line,conninfo conn, CState
printf(" -> %s\n",state2str(state));
else
printf("\n");
if(conn->timer_reconn && (state == c_offdown || (state >= c_going_up
if(conn->timer_reconn && (state == c_off || state == c_offdown || (state >= c_going_up
&& conn->state < c_going_up))) {
conn->timer_reconn = 0;
untimeout(time_reconn,conn);
} else if(!conn->timer_reconn && state < c_going_up && conn->state >= c_going_up) {
} else if(!conn->timer_reconn && state != c_off && state < c_going_up && conn->state >= c_going_up) {
if(conn->want_fast_reconn) {
conn->want_fast_reconn = 0;
} else {
@ -253,7 +270,7 @@ Xsetconnstate(const char *deb_file, unsigned int deb_line,conninfo conn, CState
}
if((state == c_off) && !conn->retime && (conn->flags & F_PERMANENT)) {
conn->retime = 1;
timeout(retime,conn,((conn->charge != 0) ? 5*60*++conn->retiming : (conn->cause == ID_priv_Busy) ? 5 : (conn->flags & F_FASTREDIAL) ? 2 : 5)*HZ);
timeout(retime,conn,retimeout(conn)*HZ);
} else if((state != c_off) && conn->retime) {
conn->retime = 0;
untimeout(retime,conn);
@ -269,10 +286,10 @@ Xdropconn (struct conninfo *conn, const char *deb_file, unsigned int deb_line)
{
chkone(conn);
if(conn->locked) {
if(1)printf ("DropConn %s:%d: LOCK %d/%d/%ld\n", deb_file,deb_line, conn->minor, conn->fminor, conn->connref);
if(log_34 & 2)printf ("DropConn %s:%d: LOCK %d/%d/%ld\n", deb_file,deb_line, conn->minor, conn->fminor, conn->connref);
return;
}
if(1)printf ("DropConn %s:%d: %d/%d/%ld\n", deb_file,deb_line, conn->minor, conn->fminor, conn->connref);
if(log_34 & 2)printf ("DropConn %s:%d: %d/%d/%ld\n", deb_file,deb_line, conn->minor, conn->fminor, conn->connref);
if(!conn->ignore) {
conn->ignore=1;
setconnstate(conn,c_forceoff);
@ -314,7 +331,7 @@ Xdropconn (struct conninfo *conn, const char *deb_file, unsigned int deb_line)
{ /* Say that we forgot the thing. */
char xs[10];
sprintf(xs,"-%d",conn->seqnum);
connreport(xs,conn->cg ? conn->cg->card : "*");
connreport(xs,conn->cg ? conn->cg->card : "*",0);
}
dropgrab(conn->cg);
if(conn->lastMsg != NULL)
@ -404,10 +421,8 @@ try_reconn(struct conninfo *conn)
cg->lnr = NULL; cg->lnrsuf = NULL;
cg->card = conn->cardname ? conn->cardname : "*";
cg->cclass = conn->classname ? conn->classname : "*";
cg->flags &=~(F_MOVEFLAGS|F_INCOMING|F_OUTCOMPLETE|F_LNRCOMPLETE);
cg->flags &=~(F_MASKFLAGS|F_INCOMING|F_OUTCOMPLETE|F_LNRCOMPLETE);
cg->flags |= F_OUTGOING;
if((cg->flags & (F_PERMANENT|F_LEASED)) == F_PERMANENT)
cg->flags |= F_DIALUP;
if(cg->par_out != NULL)
freemsg(cg->par_out);
if((cg->par_out = allocb(256,BPRI_LO)) == NULL) {

View File

@ -246,7 +246,7 @@ find_conn(void)
if(conn == NULL)
conn = xconn;
if(conn != NULL) {
printf("Found Conn %d/%d, cref %ld\n",conn->minor,conn->fminor,conn->connref);
if(0)printf("Found Conn %d/%d, cref %ld\n",conn->minor,conn->fminor,conn->connref);
}
if (conn != NULL && ind != IND_OPEN) {
if (conn->minor == 0 && minor != 0) {
@ -312,9 +312,11 @@ init_vars (void)
*(ulong_t *) crd = 0;
crd[4] = '\0';
printf ("HL R ");
dumpascii (data, len);
printf ("\n");
if(log_34 & 1) {
printf ("HL R ");
dumpascii (data, len);
printf ("\n");
}
data[len] = '\0';
xx.b_rptr = data;
xx.b_wptr = data + len;
@ -406,7 +408,7 @@ do_card(void)
io[0].iov_len = xlen;
len = 1;
if(dl->args != NULL) {
printf ("+ ");
if(log_34 & 1)printf ("+ ");
io[len].iov_base = ":: ";
io[len].iov_len = 3;
len++;
@ -514,7 +516,7 @@ do_cardproto(void)
xx.b_rptr = xx.b_wptr = ans;
db.db_base = ans;
db.db_lim = ans + sizeof (ans);
if(1)printf("Dis10 ");
if(log_34 & 2)printf("Dis10 ");
m_putid (&xx, CMD_OFF);
if(minor > 0) {
m_putsx (&xx, ARG_MINOR);
@ -549,7 +551,7 @@ do_cardproto(void)
xx.b_rptr = xx.b_wptr = ans;
db.db_base = ans;
db.db_lim = ans + sizeof (ans);
if(1)printf("Dis11 ");
if(log_34 & 2)printf("Dis11 ");
m_putid (&xx, CMD_OFF);
if(minor > 0) {
m_putsx (&xx, ARG_MINOR);
@ -667,7 +669,7 @@ do_incoming(void)
incomplete = 0;
goto inc_err;
}
cg->flags = F_INCOMING|F_DIALUP|F_PERMANENT|F_NRCOMPLETE|F_LNRCOMPLETE;
cg->flags = F_INCOMING|F_MULTIDIALUP|F_DIALUP|F_PERMANENT|F_NRCOMPLETE|F_LNRCOMPLETE;
cinf = allocb(len,BPRI_LO);
if(cinf == NULL) {
resp = "OutOfMemFoo";
@ -696,12 +698,13 @@ do_incoming(void)
}
{
char *sit = NULL,*pro = NULL,*car = NULL,*cla = NULL; /* GCC */
long flg;
ulong_t sub = 0;
if(0)printf("Hunt for %s/%s/%s/%s/%o\n",cg->site,cg->protocol,cg->card,cg->cclass,cg->flags);
/* Figure out which program to run. */
for (cfr = cf_R; cfr != NULL; cfr = cfr->next) {
if(cfr->got_err) continue;
if (!matchflag(cg->flags,cfr->type)) continue;
if ((flg = matchflag (cg->flags,cfr->type)) == 0) continue;
if ((sit = wildmatch (cg->site, cfr->site)) == NULL) continue;
if ((pro = wildmatch (cg->protocol, cfr->protocol)) == NULL) continue;
if ((car = wildmatch (cg->card, cfr->card)) == NULL) continue;
@ -735,7 +738,7 @@ do_incoming(void)
mz = allocb(40,BPRI_HI); if(mz == NULL) goto cont;
if(*resp != '+') { /* Throw away the incoming call */
if(1)printf("Dis1 ");
if(log_34 & 2)printf("Dis1 ");
m_putid (mz, CMD_OFF);
m_putsx (mz, ARG_NODISC);
m_putsx (mz, ARG_FORCE);
@ -784,7 +787,7 @@ do_incoming(void)
}
resp = NULL;
} else { /* Throw away the outgoing call */
if(1)printf("Dis2 ");
if(log_34 & 2)printf("Dis2 ");
m_putid (mz, CMD_OFF);
m_putsx (mz, ARG_NODISC);
m_putsx (mz, ID_N0_cause);
@ -869,7 +872,7 @@ do_incoming(void)
db.db_base = ans;
db.db_lim = ans + sizeof (ans);
if(1)printf("Dis3 ");
if(log_34 & 2)printf("Dis3 ");
m_putid (&xx, CMD_OFF);
if(connref != 0) {
m_putsx (&xx, ARG_CONNREF);
@ -1118,7 +1121,7 @@ do_disc(void)
xx.b_rptr = xx.b_wptr = ans;
db.db_base = ans;
db.db_lim = ans + sizeof (ans);
if(1)printf("Dis4d ");
if(log_34 & 2)printf("Dis4d ");
m_putid (&xx, CMD_CLOSE);
m_putsx (&xx, ARG_MINOR);
m_puti (&xx, minor);
@ -1189,7 +1192,7 @@ do_disc(void)
xx.b_rptr = xx.b_wptr = ans;
db.db_base = ans;
db.db_lim = ans + sizeof (ans);
if(1)printf("Dis4 ");
if(log_34 & 2)printf("Dis4 ");
m_putid (&xx, CMD_OFF);
m_putsx (&xx, ARG_MINOR);
m_puti (&xx, minor);
@ -1222,7 +1225,7 @@ do_close(void)
if (conn->pid == 0)
dropconn (conn);
else {
printf("PID still %d\n",conn->pid);
if(log_34 & 2)printf("PID still %d\n",conn->pid);
kill(conn->pid,SIGHUP);
}
}
@ -1239,7 +1242,7 @@ do_close(void)
if (conn->pid == 0)
dropconn (conn);
else {
printf("PID still %d\n",conn->pid);
if(log_34 & 2)printf("PID still %d\n",conn->pid);
kill(conn->pid,SIGHUP);
}
}
@ -1378,7 +1381,7 @@ do_hasconnected(void)
{
if (conn != NULL) {
if (conn->cg != NULL)
conn->flags |= conn->cg->flags & F_MOVEFLAGS;
conn->flags = (conn->flags &~ F_MASKFLAGS) | (conn->cg->flags & F_MOVEFLAGS);
setconnstate(conn,c_up);
}
resp = "CONNECT";
@ -1438,7 +1441,7 @@ do_disconnect(void)
xx.b_rptr = xx.b_wptr = ans;
db.db_base = ans;
db.db_lim = ans + sizeof (ans);
if(1)printf("Dis5 ");
if(log_34 & 2)printf("Dis5 ");
m_putid (&xx, CMD_OFF);
m_putsx (&xx, ARG_MINOR);
m_puti (&xx, minor);
@ -1465,7 +1468,7 @@ do_hasdisconnect(void)
m_putid (&xx, PROTO_MODULE);
m_putsx (&xx, PROTO_MODULE);
m_putsz (&xx, (uchar_t *) "proto");
printf("On4 %p %d\n",conn,dialin);
if(log_34 & 2)printf("On4 %p %d\n",conn,dialin);
m_putsx (&xx, ((conn != NULL) || (dialin > 0)) ? PROTO_ONLINE : PROTO_OFFLINE);
xlen = xx.b_wptr - xx.b_rptr;
DUMPW (xx.b_rptr, xlen);
@ -1476,7 +1479,7 @@ do_hasdisconnect(void)
xx.b_rptr = xx.b_wptr = ans;
db.db_base = ans;
db.db_lim = ans + sizeof (ans);
if(1)printf("Dis6 ");
if(log_34 & 2)printf("Dis6 ");
m_putid (&xx, CMD_OFF);
m_putsx (&xx, ARG_MINOR);
m_puti (&xx, minor);
@ -1555,7 +1558,7 @@ do_wantconnect(void)
xx.b_rptr = xx.b_wptr = ans;
db.db_base = ans;
db.db_lim = ans + sizeof (ans);
if(1)printf("Dis7 ");
if(log_34 & 2)printf("Dis7 ");
m_putid (&xx, CMD_OFF);
m_putsx (&xx, ARG_MINOR);
m_puti (&xx, minor);
@ -1715,7 +1718,7 @@ do_atcmd(void)
setconnstate(conn, c_forceoff);
else
setconnstate(conn, c_down);
if(1)printf("Dis8 ");
if(log_34 & 2)printf("Dis8 ");
if(mb != NULL) {
{
@ -1755,12 +1758,8 @@ do_atcmd(void)
case 'L': /* List connections and state changes. */
{
struct conninfo *fconn;
char *sp;
msgbuf = malloc(10240);
if(msgbuf == NULL) {
resp = "NO MEMORY.6";
return 1;
}
char buf[30];
conn = malloc(sizeof(*conn));
if(conn == NULL) {
free(msgbuf);
@ -1791,29 +1790,22 @@ do_atcmd(void)
} else
conn->cardname = "*";
}
sp = resp = msgbuf;
sp += sprintf(sp,"#:ref id site protocol class pid state/card cost total flags,rem.nr;loc.nr cause\r\n");
conn->seqnum = ++connseq;
conn->ignore = 3;
conn->minor = minor;
conn->next = isdn4_conn; isdn4_conn = conn;
connreport("#:ref id site protocol class pid state/card cost total flags,remNr;locNr cause\r\n","*",minor);
for(fconn = isdn4_conn; fconn != NULL; fconn = fconn->next) {
if(fconn->ignore >= 3)
continue;
if((fconn->cg != NULL) && (fconn->cg->card != NULL))
if(!wildmatch(fconn->cg->card,conn->cardname))
continue;
sp += sprintf(sp,"%s%d:%d %s %s %s %d %s/%s %ld %ld %s %s\r\n",
fconn->ignore?"!":"", fconn->minor, fconn->seqnum,
(fconn->cg && fconn->cg->site) ? fconn->cg->site : "-",
(fconn->cg && fconn->cg->protocol) ? fconn->cg->protocol : "-",
(fconn->cg && fconn->cg->cclass) ? fconn->cg->cclass : "-",
fconn->pid, state2str(fconn->state),
(fconn->cg && fconn->cg->card) ? fconn->cg->card : (fconn->cardname ? fconn->cardname : "-"),
fconn->charge, fconn->ccharge, FlagInfo(fconn->flags),
CauseInfo(fconn->cause, fconn->causeInfo));
ReportOneConn(fconn,minor);
}
conn->seqnum = ++connseq;
conn->ignore = 3;
conn->minor = minor;
conn->next = isdn4_conn; isdn4_conn = conn;
sp += sprintf(sp,"# Waiting %s...",conn->cardname);
sprintf(buf,"# Waiting %s...",conn->cardname);
resp = str_enter(buf);
return 1;
}
@ -1970,7 +1962,7 @@ do_atcmd(void)
m_putid (&yy, PROTO_MODULE);
m_putsx (&yy, PROTO_MODULE);
m_putsz (&yy, (uchar_t *) "proto");
printf("On5\n");
if(log_34 & 2)printf("On5\n");
m_putsx (&yy, PROTO_ONLINE);
xlen = yy.b_wptr - yy.b_rptr;
DUMPW (yy.b_rptr, xlen);
@ -1988,7 +1980,7 @@ do_atcmd(void)
yy.b_rptr = yy.b_wptr = ans;
dbb.db_base = ans;
dbb.db_lim = ans + sizeof (ans);
if(1)printf("Dis9 ");
if(log_34 & 2)printf("Dis9 ");
m_putid (&yy, CMD_OFF);
m_putsx (&yy, ARG_MINOR);
m_puti (&yy, minor);
@ -2095,14 +2087,14 @@ do_atcmd(void)
}
if(conn != NULL) {
setconnref(conn,connrefs);
connrefs += 2;
setconnref(conn,isdn4_connref);
isdn4_connref += 2;
cg->refs++;
dropgrab(conn->cg);
conn->cg = cg;
}
cg->flags = F_OUTGOING|F_DIALUP;
cg->flags = F_OUTGOING|F_MULTIDIALUP|F_DIALUP;
if(m3 != NULL)
cg->card = str_enter(m3);
else
@ -2225,7 +2217,7 @@ printf("GotAnError: Minor %ld, connref %ld, hdr %s\n",minor,connref,HdrName(hdrv
cf cfr;
for (cfr = cf_R; cfr != NULL; cfr = cfr->next) {
if (!matchflag(conn->cg->flags,cfr->type)) continue;
if (matchflag (conn->cg->flags,cfr->type) == 0) continue;
if (wildmatch (conn->cg->site, cfr->site) == NULL) continue;
if (wildmatch (conn->cg->protocol, cfr->protocol) == NULL) continue;
if (wildmatch (conn->cg->card, cfr->card) == NULL) continue;
@ -2259,7 +2251,7 @@ printf("GotAnError: Minor %ld, connref %ld, hdr %s\n",minor,connref,HdrName(hdrv
db.db_lim = ans + sizeof (ans);
*xx.b_wptr++ = PREF_NOERR;
if(1)printf("DisA ");
if(log_34 & 2)printf("DisA ");
m_putid (&xx, CMD_OFF);
m_putsx(&xx,ARG_FORCE);
if(minor > 0) {

View File

@ -37,12 +37,18 @@ main (int argc, char *argv[])
else
progname++;
while ((x = getopt (argc, argv, "iIf:dlLwWqQ"))!= EOF) {
while ((x = getopt (argc, argv, "iIf:dlLwWqQmM"))!= EOF) {
switch (x) {
/*
* Logging. Small letters are usermode, capitals log in the kernel.
* 'l' is raw data, 'w' is interpreted data, 'q' is queue info.
*/
case 'm':
log_34 |= 1;
break;
case 'M':
log_34 |= 2;
break;
case 'l':
pushlog |= 1;
break;
@ -124,6 +130,12 @@ main (int argc, char *argv[])
#ifdef HAVE_SETPGRP_0
setpgrp();
#endif
}
{ /* Switch stdout and stderr */
int fd = dup(1);
dup2(2,1);
dup2(fd,2);
close(fd);
}
#ifdef linux
@ -166,7 +178,7 @@ main (int argc, char *argv[])
mknod (idevname (i), S_IFCHR | S_IRUSR | S_IWUSR, MKDEV(isdnstd,i));
chmod (idevname (i), S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
}
syslog(LOG_DEBUG,"ISDN: isdn/XX: major number %d",isdnstd);
if(0)syslog(LOG_DEBUG,"ISDN: isdn/XX: major number %d",isdnstd);
}
if(isdnterm == 0)
@ -175,7 +187,7 @@ main (int argc, char *argv[])
int i;
for(i=1;i<NPORT;i++)
unlink(devname(i));
syslog(LOG_DEBUG,"ISDN: ttyiXX: major number %d",isdnterm);
if(0)syslog(LOG_DEBUG,"ISDN: ttyiXX: major number %d",isdnterm);
}
}
}

View File

@ -9,10 +9,9 @@
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "f_signal.h"
#include "kernel.h"
#include <sys/wait.h>
#include <strings.h>
#include <syslog.h>
#include "streams.h"
#include "sioctl.h"
@ -29,8 +28,7 @@
#include "f_ioctl.h"
#include "f_termio.h"
#include <sys/sysmacros.h>
#include <sys/stropts.h>
#include "f_signal.h"
#include "stropts.h"
#include <sys/wait.h>
#include "f_strings.h"
#include <syslog.h>
@ -41,10 +39,7 @@
#include <ctype.h>
#include <malloc.h>
#include <fcntl.h>
#include "streams.h"
#include "sioctl.h"
#include "streamlib.h"
#include "isdn_34.h"
#include "phone_1TR6.h"
#include "phone_ETSI.h"
#include "isdn_proto.h"
@ -57,8 +52,6 @@
#include "isdn_23.h"
#endif
#include "isdn_limits.h"
#include "dump.h"
#include "timeout.h"
#include "x75.h"
#include "proto.h"
@ -155,10 +148,11 @@ EXTERN uid_t user[NMINOR];
/* Unique refnum, always incremented by two */
/* The lower level also has one of these, but with the low bit set */
EXTERN long connrefs INIT(2);
EXTERN long isdn4_connref INIT(2);
EXTERN int fd_mon; /* the lower/layer connection */
EXTERN char *progname;
EXTERN int log_34 INIT(0);
EXTERN int testonly INIT(0); /* set if fd_mon is not actually connected */
EXTERN int igstdin INIT(1); /* Ignore stdin */
EXTERN int in_boot INIT(1); /* We're still coming up */
@ -182,7 +176,7 @@ EXTERN int connseq INIT(0);
EXTERN struct xstream *xs_mon; /* Pseudo-stream for the L3 engine */
#define DUMPW(s,l) do { printf("HL W "); dumpascii((uchar_t *)(s),(l)); printf("\n"); } while(0)
#define DUMPW(s,l) do { if(!(log_34 & 1)) break; printf("HL W "); dumpascii((uchar_t *)(s),(l)); printf("\n"); } while(0)
/* String database. Should probably be an AVL tree or a hash but I'm lazy. */
/** The purpose of this thing is to be able not to bother with keeping track
@ -307,25 +301,27 @@ typedef struct conninfo {
#define F_INTERRUPT 01 /* interrupt, don't disconnect */
#define F_PREFOUT 02 /* drop incoming connection on call collision */
#define F_FORCEOUT 04 /* always drop incoming connection */
#define F_IGNORELIMIT 010 /* override card limit */
#define F_IGNORELIMIT 010 /* override connection limit */
#define F_FASTDROP 020 /* immediate connection reject */
#define F_FASTREDIAL 040 /* don't delay as much when a dialup attempt fails */
#define F_PERMANENT 0100 /* connection doesn't really die */
#define F_LEASED 0200 /* leased line */
#define F_PERMANENT 0100 /* dialup connection which doesn't really die */
#define F_LEASED 0200 /* connection on leased line */
#define F_CHANBUSY 0400 /* busy if no free channel */
#define F_NRCOMPLETE 01000 /* remote number is complete */
#define F_LNRCOMPLETE 02000 /* local number is complete */
#define F_INCOMING 04000 /* incoming call */
#define F_OUTGOING 010000 /* outgoing call */
#define F_DIALUP 020000 /* dialup line */
#define F_IGNORELIMIT2 040000 /* override card limit */
#define F_DIALUP 020000 /* dialup connection */
#define F_MULTIDIALUP 040000 /* dialup connection, independent */
#define F_OUTCOMPLETE 0100000 /* outgoing call info complete */
#define F_SETINITIAL 0200000 /* initial connection setup */
#define F_SETLATER 0400000 /* later re-setup */
#define F_NOREJECT 01000000 /* don't cause "temp unavailable" messages */
#define F_BACKCALL 02000000 /* callback on B if incoming call on A busy */
#define F_FOOBAR 04000000 /* dummy flag to return TRUE */
#define F_MOVEFLAGS (F_IGNORELIMIT|F_IGNORELIMIT2)
#define F_MOVEFLAGS (F_IGNORELIMIT|F_PERMANENT|F_DIALUP|F_MULTIDIALUP|F_LEASED)
#define F_MASKFLAGS (F_PERMANENT|F_DIALUP|F_MULTIDIALUP)
/* FLags we set on start of a connection from the conngrab */
/*
@ -363,11 +359,12 @@ void do_quitnow(void *nix);
#define setconnref(a,b) Xsetconnref(__FILE__,__LINE__,(a),(b))
void Xsetconnref(const char *deb_file,unsigned int deb_line, conninfo conn, int connref);
void connreport(char *foo, char *card);
void connreport(char *foo, char *card, int minor);
/* Changing a connection status, and things to do */
const char *CauseInfo(int cause, char *pri);
void ReportConn(conninfo conn);
void ReportOneConn(conninfo conn, int minor);
#define ReportConn(a) ReportOneConn((a),0)
#define setconnstate(a,b) Xsetconnstate(__FILE__,__LINE__,(a),(b))
void Xsetconnstate(const char *deb_file, unsigned int deb_line,conninfo conn, CState state);
@ -462,7 +459,7 @@ void Xdropconn (struct conninfo *conn, const char *deb_file, unsigned int deb_li
void rdropconn (struct conninfo *conn, int deb_line);
void deadkid (void);
int matchflag(long flags, char *ts);
long matchflag(long flags, char *ts);
cf getcards(conngrab cg, cf list);
void Xbreak(void);

View File

@ -10,18 +10,19 @@
/* Verify that the connection mode matches the stated flags. */
int
long
matchflag(long flags, char *ts)
{
char inc,outg,leas,prep,dial,ini,aft;
char inc,outg,leas,perm,dial,mdial,ini,aft;
ini = (strchr(ts,'u') != NULL);
aft = (strchr(ts,'a') != NULL);
inc = (strchr(ts,'i') != NULL);
outg= (strchr(ts,'o') != NULL);
leas= (strchr(ts,'f') != NULL);
prep= (strchr(ts,'p') != NULL);
perm= (strchr(ts,'p') != NULL);
dial= (strchr(ts,'d') != NULL);
mdial=(strchr(ts,'m') != NULL);
if(flags & F_SETINITIAL) { if (aft && !ini) return 0; }
if(flags & F_SETLATER) { if (!aft && ini) return 0; }
@ -29,12 +30,23 @@ matchflag(long flags, char *ts)
if(flags & F_OUTGOING) { if (inc && !outg) return 0; }
if(flags & F_INCOMING) { if (!inc && outg) return 0; }
if(!(flags & (F_LEASED|F_PERMANENT|F_DIALUP))) return 1;
if(!(leas || dial || prep)) return 1;
if((flags & F_LEASED) && leas) return 1;
if((flags & F_PERMANENT)&& prep) return 1;
if((flags & F_DIALUP) && dial) return 1;
if(!(leas || dial || perm)) goto set;
if(!(flags & (F_LEASED|F_PERMANENT|F_MULTIDIALUP|F_DIALUP))) goto set;
if((flags & F_LEASED) && leas) goto set;
if((flags & F_PERMANENT) && perm) goto set;
if((flags & F_DIALUP) && dial) goto set;
if((flags & F_MULTIDIALUP) && mdial) goto set;
return 0;
set:
if(ini) flags |= F_SETINITIAL;
if(aft) flags |= F_SETLATER;
if(inc) flags |= F_INCOMING;
if(outg) flags |= F_OUTGOING;
if(leas) flags |= F_LEASED;
if(perm) flags |= F_PERMANENT;
if(dial) flags |= F_DIALUP;
if(mdial)flags |= F_MULTIDIALUP;
return flags | F_FOOBAR;
}
/* Check if this P-line matches a connection request */
@ -42,6 +54,7 @@ char *
pmatch1 (cf prot, conngrab *cgm)
{
char *sit, *pro, *cla, *car;
long flg;
ulong_t sub;
char first = 1;
conngrab cg = *cgm;
@ -71,7 +84,7 @@ pmatch1 (cf prot, conngrab *cgm)
mblk_t *cand = NULL;
streamchar *mbs_in = NULL, *mbs_out = NULL;
if(!matchflag(cg->flags,prot->type)) { if(first) { dropgrab(cg); return "5ERR BadFlag"; } else continue;}
if((flg = matchflag(cg->flags,prot->type)) == 0) { if(first) { dropgrab(cg); return "5ERR BadFlag"; } else continue;}
if (first) {
if (strchr (prot->type, 'M')) { /* First Match not allowed. */
dropgrab(cg);
@ -96,7 +109,7 @@ pmatch1 (cf prot, conngrab *cgm)
}
if(!first) {
cgc->site = sit; cgc->protocol = pro; cgc->card = car; cgc->cclass = cla;
cgc->mask = sub;
cgc->mask = sub; cgc->flags = flg;
}
if(cgc->par_out == NULL) { /* No outgoing parameter list? Yet! */
if ((cgc->par_out = allocb(256,BPRI_LO)) == NULL) {
@ -286,8 +299,8 @@ pmatch1 (cf prot, conngrab *cgm)
break;
if ((nrt & ARG_IN) && (cgc->flags & F_INCOMING)) {
if (cgc->nrsuf != NULL) {
if(1)printf("MatchSuffix %s and %s\n",cgc->nrsuf,yy);
if(match_suffix(cgc->nrsuf,yy) <= 0) DG("2WrongNrSuffix 2");
if(0)printf("MatchSuffix %s and %s\n",cgc->nrsuf,yy);
if(match_suffix(cgc->nrsuf,yy) <= 0) DG("3WrongNrSuffix 2");
} else
cgc->nrsuf = str_enter(yy);
}
@ -322,7 +335,7 @@ pmatch1 (cf prot, conngrab *cgm)
if(cgc->lnrsuf != NULL) {
if(1)printf("MatchLSuffix %s and %s\n",cgc->lnrsuf,yy);
if((suf = match_suffix(cgc->lnrsuf,yy)) <= 0)
DG(suf ? "3LNrIncompSuffix 2" : "3WrongLNrSuffix 2");
DG(suf ? "1LNrIncompSuffix 2" : "2WrongLNrSuffix 2");
} else
DG("4LNrIncompSuffix 3");
}
@ -342,9 +355,9 @@ pmatch1 (cf prot, conngrab *cgm)
cgc->flags |= F_LNRCOMPLETE;
} else {
if((cgc->lnrsuf != 0) && (match_suffix(cgc->lnrsuf,yy) < 0))
DG("3LNrIncompSuffix 4");
DG("2LNrIncompSuffix 4");
else
DG("3WrongLNrSuffix 4");
DG("2WrongLNrSuffix 4");
}
}
}
@ -489,6 +502,7 @@ if(0)printf("%s.%s.!.",cg->site,cg->card); /* I hate debugging. */
char *matcar;
char *matpro;
ulong_t matsub;
long matflg;
if(d == NULL) { /* Restart at the beginning */
numwrap = 0;
@ -500,20 +514,23 @@ if(0)printf("%s.%s.!.",cg->site,cg->card); /* I hate debugging. */
continue; /* scan and skip */
else if(numwrap == 0)
numwrap = -1;
if(!(cg->flags & F_INCOMING))
numidx++; /* Check this; check the next number next time. */
if(!(cg->flags & F_INCOMING)) {
numidx++;
if((strchr(d->type,'B') != NULL) && (numwrap > 0))
continue; /* THIS DOES NOT WORK YET */
}
/* Yes, we did increment the refcount, above. */
dropgrab(cg);
cg = *foo;
cg->refs++;
if((matflg = matchflag(cg->flags,d->type)) == 0) continue;
if((matsit = wildmatch(cg->site,d->site)) == NULL) continue;
if((matpro = wildmatch(cg->protocol,d->protocol)) == NULL) continue;
if((matcar = wildmatch(matcrd,d->card)) == NULL) continue;
if((matcla = classmatch(matclass,d->cclass)) == NULL) continue;
if((matsub = maskmatch(cg->mask,d->mask)) == 0) continue;
if(!matchflag(cg->flags,d->type)) continue;
/* Preliminary match OK, remember the data so far. */
dropgrab(cg);
@ -522,7 +539,7 @@ if(0)printf("%s.%s.!.",cg->site,cg->card); /* I hate debugging. */
cg->site = matsit; cg->cclass = matcla;
cg->card = matcar; cg->protocol = matpro;
cg->mask = matsub;
cg->mask = matsub; cg->flags = matflg;
if(!(cg->flags & F_LEASED)) {
/* Now figure out the numbers... */

View File

@ -99,8 +99,12 @@ char *match_nr (char *extnr, char *locnr, char *locpref)
return NULL;
extpos++; locpos++;
}
if(*locpos != '\0')
if(*locpos != '\0') {
if(*locpos == '/' || *locpos == '.')
if(wildmat("",locpos+1))
return str_enter(locpos);
return NULL;
}
return "";
}

View File

@ -57,6 +57,12 @@ char *FlagInfo(int flag)
static char fbuf[30];
fbuf[0]='\0';
if (flag & F_INCOMING) strcat(fbuf, ":in");
if (flag & F_OUTGOING) strcat(fbuf, ":ou");
if (flag & F_PERMANENT) strcat(fbuf, ":dP");
if (flag & F_LEASED) strcat(fbuf, ":dL");
if (flag & F_MULTIDIALUP) strcat(fbuf, ":dM");
if (flag & F_DIALUP) strcat(fbuf, ":dD");
if (flag & F_INTERRUPT) strcat(fbuf, ":is");
if (flag & F_PREFOUT) strcat(fbuf, ":xi");
if (flag & F_FORCEOUT) strcat(fbuf, ":yi");
@ -64,15 +70,9 @@ char *FlagInfo(int flag)
if (flag & F_IGNORELIMIT) strcat(fbuf, ":il");
if (flag & F_FASTDROP) strcat(fbuf, ":fX");
if (flag & F_FASTREDIAL) strcat(fbuf, ":fr");
if (flag & F_PERMANENT) strcat(fbuf, ":dP");
if (flag & F_LEASED) strcat(fbuf, ":dL");
if (flag & F_CHANBUSY) strcat(fbuf, ":ib");
if (flag & F_NRCOMPLETE) strcat(fbuf, ":nc");
if (flag & F_LNRCOMPLETE) strcat(fbuf, ":lc");
if (flag & F_INCOMING) strcat(fbuf, ":in");
if (flag & F_OUTGOING) strcat(fbuf, ":ou");
if (flag & F_DIALUP) strcat(fbuf, ":dD");
if (flag & F_IGNORELIMIT2) strcat(fbuf, ":iL");
if (flag & F_OUTCOMPLETE) strcat(fbuf, ":oc");
if (flag & F_SETINITIAL) strcat(fbuf, ":si");
if (flag & F_SETLATER) strcat(fbuf, ":sl");
@ -91,6 +91,7 @@ const char *CauseInfo(int cause, char *pri)
case 0: return "OK";
case ID_priv_Busy: return "Local Busy";
case ID_priv_Print: if(isdigit(*pri)) return pri+1; else return pri;
case CHAR2('?','?'): return "-unknown-";
#ifdef _capi_
case ID_E_REGISTER: return "application registration";

View File

@ -16,7 +16,8 @@ deadkid (void)
struct conninfo *conn;
while((pid = wait4 (-1,&val,WNOHANG,NULL)) > 0) {
printf ("\n* PID %d died, %x\n", pid, val);
if(log_34 & 2)
printf ("\n* PID %d died, %x\n", pid, val);
chkall();
for (conn = isdn4_conn; conn != NULL; conn = conn ? conn->next : NULL) {
@ -78,7 +79,7 @@ pushprot (conngrab cg, int minor, int connref, char update)
char *mods = NULL;
for (prot = cf_ML; prot != NULL; prot = prot->next) {
if(!matchflag(cg->flags,prot->type)) continue;
if (!matchflag (cg->flags,prot->type)) continue;
if (!wildmatch (cg->site, prot->site)) continue;
if (!wildmatch (cg->protocol, prot->protocol)) continue;
if (!wildmatch (cg->card, prot->card)) continue;
@ -151,7 +152,7 @@ pushprot (conngrab cg, int minor, int connref, char update)
streamchar *newlim = NULL;
mblk_t *mz = NULL;
if(!matchflag(cg->flags,cm->type)) continue;
if (!matchflag (cg->flags,cm->type)) continue;
if (!wildmatch (cg->site, cm->site)) continue;
if (!wildmatch (cg->protocol, cm->protocol)) continue;
if (!wildmatch (cg->card, cm->card)) continue;
@ -212,7 +213,8 @@ pushprot (conngrab cg, int minor, int connref, char update)
io[1].iov_base = mi->b_rptr;
io[1].iov_len = mi->b_wptr - mi->b_rptr;
DUMPW (mj->b_rptr, io[0].iov_len);
printf ("+ ");
if(log_34 & 1)
printf ("+ ");
DUMPW (mi->b_rptr, io[1].iov_len);
(void) strwritev (xs_mon, io, 2, 1);
freeb (mj);
@ -258,7 +260,7 @@ pushcardprot (conngrab cg, int minor, int connref)
if(card == NULL)
return -ENOENT;
for (prot = cf_ML; prot != NULL; prot = prot->next) {
if(!matchflag(cg->flags,prot->type)) continue;
if (!matchflag (cg->flags,prot->type)) continue;
if (!wildmatch (cg->site, prot->site)) continue;
if (!wildmatch (cg->protocol, prot->protocol)) continue;
if (!wildmatch (cg->card, prot->card)) continue;
@ -351,7 +353,7 @@ startconn(conngrab cg, int fminor, int connref, char **ret, conngrab *retcg)
if(conn->cg == cg)
break;
}
if(conn == NULL) {
if(conn == NULL && (cg->flags & (F_PERMANENT|F_MULTIDIALUP|F_DIALUP))) {
for(conn = isdn4_conn; conn != NULL; conn = conn->next) {
char *sit,*pro,*car,*cla;
ulong_t sub;
@ -360,7 +362,7 @@ startconn(conngrab cg, int fminor, int connref, char **ret, conngrab *retcg)
continue;
if(conn->pid == 0 || conn->minor == 0)
continue;
if(!(conn->flags & F_PERMANENT))
if(!(conn->flags & (F_PERMANENT|F_DIALUP)))
continue;
if(conn->cg == NULL)
continue;
@ -374,7 +376,7 @@ startconn(conngrab cg, int fminor, int connref, char **ret, conngrab *retcg)
break;
}
}
if(conn == NULL) {
if(conn == NULL && (cg->flags & (F_PERMANENT|F_MULTIDIALUP|F_DIALUP))) {
for(conn = isdn4_conn; conn != NULL; conn = conn->next) {
char *sit,*pro;
@ -382,7 +384,7 @@ startconn(conngrab cg, int fminor, int connref, char **ret, conngrab *retcg)
continue;
if(conn->pid == 0 || conn->minor == 0)
continue;
if(!(conn->flags & F_PERMANENT))
if(!(conn->flags & (F_PERMANENT|F_DIALUP)))
continue;
if(conn->cg == NULL)
continue;
@ -399,6 +401,8 @@ startconn(conngrab cg, int fminor, int connref, char **ret, conngrab *retcg)
}
/* Returning "+" in the first position means keep the new connection. */
/* Return "-" to keep the old connection. */
/* Return "=" to call back. */
if(conn->state == c_forceoff) {
dropgrab(cg);
@ -407,15 +411,15 @@ startconn(conngrab cg, int fminor, int connref, char **ret, conngrab *retcg)
}
if(conn->state == c_going_down) {
dropgrab(cg);
*ret = "-COLLISION 1b";
*ret = "+COLLISION 1b";
return conn;
}
if(conn->state > c_going_down) {
*ret = "+COLLISION 1b";
*ret = "-COLLISION 1b";
if((conn->state == c_going_up) && (cg->flags & F_PREFOUT))
**ret = '-';
**ret = '+';
if((conn->state == c_up) && (cg->flags & (F_PREFOUT | F_FORCEOUT)))
**ret = '-';
**ret = '+';
dropgrab(cg);
return conn;
}
@ -425,7 +429,8 @@ startconn(conngrab cg, int fminor, int connref, char **ret, conngrab *retcg)
return conn;
}
printf("Start: %s:%s #%s...",cg->site,cg->protocol,cg->nr);
if(log_34 & 2)
printf("Start: %s:%s #%s...",cg->site,cg->protocol,cg->nr);
if(((*ret) = findit (&cg,0)) != NULL) {
*retcg = cg;
dropgrab(rcg);
@ -452,8 +457,8 @@ printf("Start: %s:%s #%s...",cg->site,cg->protocol,cg->nr);
m_puti (&yy, cg->delay);
if(cg->flags & F_OUTGOING) {
m_putsx(&yy,ARG_NOCONN);
setconnref(conn,connrefs);
connrefs += 2;
setconnref(conn,isdn4_connref);
isdn4_connref += 2;
} else if(connref != 0) {
if(conn->connref != 0 && conn->state == c_up) {
*ret = "COLLISION 2";
@ -483,10 +488,12 @@ printf("Start: %s:%s #%s...",cg->site,cg->protocol,cg->nr);
if (cg->lnr != NULL) {
char *s = strip_nr(cg->lnr,1);
printf("Strip3 %s -> %s\n",cg->lnr,s);
if(log_34 & 2)
printf("Strip3 %s -> %s\n",cg->lnr,s);
if(s == NULL && cg->lnrsuf != NULL) {
s = append_nr(cg->lnr,cg->lnrsuf);
printf("Append3 %s,%s -> %s\n",cg->lnr,cg->lnrsuf,s);
if(log_34 & 2)
printf("Append3 %s,%s -> %s\n",cg->lnr,cg->lnrsuf,s);
}
if(s != NULL) {
m_putsx (&yy, ARG_LNUMBER);
@ -495,10 +502,12 @@ printf("Start: %s:%s #%s...",cg->site,cg->protocol,cg->nr);
}
if (cg->nr != NULL) {
char *s = strip_nr(cg->nr,0);
printf("Strip3 %s -> %s\n",cg->nr,s);
if(log_34 & 2)
printf("Strip3 %s -> %s\n",cg->nr,s);
if(s == NULL && cg->nrsuf != NULL) {
s = append_nr(cg->nr,cg->nrsuf);
printf("Append3 %s,%s -> %s\n",cg->nr,cg->nrsuf,s);
if(log_34 & 2)
printf("Append3 %s,%s -> %s\n",cg->nr,cg->nrsuf,s);
}
if(s != NULL) {
m_putsx (&yy, ARG_NUMBER);
@ -541,10 +550,12 @@ printf("Start: %s:%s #%s...",cg->site,cg->protocol,cg->nr);
#endif
DUMPW (yy.b_rptr, io[0].iov_len);
if (iovlen > 1) {
printf ("+ ");
if(log_34 & 1)
printf ("+ ");
DUMPW (xx->b_rptr, io[1].iov_len);
if(iovlen > 2) {
printf ("+ ");
if(log_34 & 1)
printf ("+ ");
DUMPW (cg->par_out->b_rptr, io[2].iov_len);
}
}
@ -658,6 +669,18 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo)
conn->pid = (pid_t)~0;
ReportConn(conn);
}
{
int flags = 0;
if (strchr(cfr->type,'m') != NULL)
flags |= F_MULTIDIALUP;
if (strchr(cfr->type,'d') != NULL)
flags |= F_DIALUP;
if (strchr(cfr->type,'p') != NULL)
flags |= F_PERMANENT;
if (strchr(cfr->type,'f') != NULL)
flags |= F_LEASED;
cg->flags = (cg->flags &~ (F_MULTIDIALUP|F_DIALUP|F_PERMANENT|F_LEASED)) | flags;
}
} else {
if(conn != NULL) {
int id = 0; char *ids = strchr(cfr->type,'/');
@ -982,8 +1005,8 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo)
#endif
close (pip[0]);
}
syslog (LOG_INFO, "exec %x:%x %d %s/%s %s", dev, dev2, pid, cfr->site,cfr->protocol, cfr->args);
printf ("* PID %d\n", pid);
syslog (LOG_INFO, "exec %d:%d %d %s/%s %s", dev, dev2, pid, cfr->site,cfr->protocol, cfr->args);
if(0)printf ("* PID %d\n", pid);
if(prog != NULL) {
prog->next = conn->run;

View File

@ -8,7 +8,7 @@
#include "f_malloc.h"
#include <sys/param.h>
#include <sys/sysmacros.h>
#include <sys/stropts.h>
#include "stropts.h"
#ifdef DONT_ADDERROR
#include "f_user.h"
#endif

View File

@ -7,7 +7,7 @@
#include "f_signal.h"
#include "f_malloc.h"
#include <sys/sysmacros.h>
#include <sys/stropts.h>
#include "stropts.h"
#ifdef DO_ADDUSER
#include "f_user.h"
#endif

View File

@ -8,7 +8,7 @@
#include "f_malloc.h"
#include <sys/sysmacros.h>
#include "streams.h"
#include <sys/stropts.h>
#include "stropts.h"
#include "streamlib.h"
#include "isdn_23.h"
#include "kernel.h"

View File

@ -8,7 +8,7 @@
#include "f_signal.h"
#include <sys/param.h>
#include <sys/sysmacros.h>
#include <sys/stropts.h>
#include "stropts.h"
#include "f_user.h"
#include <sys/errno.h>
#include <f_termio.h>
@ -902,7 +902,6 @@ if(!realq)printf("%sFromDel %p\n",KERN_DEBUG, &proto->write_delay);
if(0)printf("%sProto IOC %x\n",KERN_DEBUG,iocb->ioc_cmd);
switch (iocb->ioc_cmd) {
#if 1 /* ndef linux */
#ifdef TCGETA
case TCGETA:
{
@ -926,18 +925,15 @@ if(!realq)printf("%sFromDel %p\n",KERN_DEBUG, &proto->write_delay);
#else
memcpy(tty->c_cc,proto->tty.c_cc,NCCS);
#endif
goto iocack;
goto iocackn;
}
#endif
#endif
#ifdef TCFLSH
case TCFLSH:
{
goto iocack; /* We don't flush */
goto iocackn; /* We don't flush */
}
#endif
#if 1 /* ndef linux */
#ifdef TCGETS
case TCGETS:
{
@ -951,10 +947,9 @@ if(!realq)printf("%sFromDel %p\n",KERN_DEBUG, &proto->write_delay);
mp->b_cont = m0;
*((struct termios *) m0->b_wptr)++ = proto->tty;
goto iocack;
goto iocackn;
}
#endif
#endif
#ifdef UIOCTTSTAT
case UIOCTTSTAT:
{
@ -973,7 +968,6 @@ if(!realq)printf("%sFromDel %p\n",KERN_DEBUG, &proto->write_delay);
goto iocack;
}
#endif
#if 1 /* ndef linux */
#ifdef TCSETA
case TCSETA:
case TCSETAW:
@ -1027,12 +1021,10 @@ if(!realq)printf("%sFromDel %p\n",KERN_DEBUG, &proto->write_delay);
/* bzero(proto->tty.c_cc,NCC); */
#endif
splx (ms);
goto iocack;
goto iocackn;
}
#endif
#endif
#if 1 /* ndef linux */
#ifdef TCSETS
case TCSETS:
case TCSETSW:
@ -1078,11 +1070,10 @@ if(!realq)printf("%sFromDel %p\n",KERN_DEBUG, &proto->write_delay);
/* bzero(proto->tty.c_cc,NCC); */
#endif
splx (ms);
goto iocack;
goto iocackn;
}
#endif
#endif
#ifdef TCSBRK
case TCSBRK:
#endif
@ -1174,6 +1165,7 @@ if(!realq)printf("%sFromDel %p\n",KERN_DEBUG, &proto->write_delay);
#ifdef UIOCNOFLOW
case UIOCNOFLOW:
#endif
iocack:
DATA_TYPE(mp) = M_IOCACK;
qreply (q, mp);
@ -1181,11 +1173,13 @@ if(!realq)printf("%sFromDel %p\n",KERN_DEBUG, &proto->write_delay);
default:
putnext (q, mp);
break;
#ifdef linux /* This is handled by the line discipline. */
iocackn:
error = -ENOIOCTLCMD; /* special code */
#endif
iocnak:
DATA_TYPE(mp) = M_IOCNAK;
if(error < 0)
error = -error;
iocb->ioc_error = error;
iocb->ioc_error = (error < 0) ? -error : error;
qreply (q, mp);
}
break;

View File

@ -8,7 +8,7 @@
#include "f_malloc.h"
#include <sys/sysmacros.h>
#include "streams.h"
#include <sys/stropts.h>
#include "stropts.h"
#include "f_user.h"
#include <sys/errno.h>
#include "streamlib.h"

View File

@ -8,7 +8,7 @@
#include <sys/param.h>
#include <sys/sysmacros.h>
#include "streams.h"
#include <sys/stropts.h>
#include "stropts.h"
#include "f_user.h"
#include "f_malloc.h"
#include <sys/errno.h>

View File

@ -11,7 +11,7 @@
#include <sys/param.h>
#include <sys/sysmacros.h>
#include "streams.h"
#include <sys/stropts.h>
#include "stropts.h"
#ifdef DONT_ADDERROR
#include "f_user.h"
#endif

View File

@ -11,7 +11,7 @@
#include <sys/param.h>
#include <sys/sysmacros.h>
#include "streams.h"
#include <sys/stropts.h>
#include "stropts.h"
#ifdef DONT_ADDERROR
#include "f_user.h"
#endif

View File

@ -20,7 +20,7 @@
#define NSTR 8
#include "streams.h"
#include <sys/stropts.h>
#include "stropts.h"
#ifdef M_UNIX
#include <sys/socket.h>
#endif

View File

@ -25,7 +25,7 @@
#include "primitives.h"
#include "streams.h"
#include <sys/stropts.h>
#include "stropts.h"
#ifdef M_UNIX
#include <sys/socket.h>
#endif

View File

@ -32,7 +32,7 @@
#include "primitives.h"
#include "streams.h"
#include <sys/stropts.h>
#include "stropts.h"
#include <sys/socket.h>
#if LINUX_VERSION_CODE >= 66324 /* 1.3.20 ??? */
#include <linux/if_arp.h>
@ -42,7 +42,6 @@
#ifdef DONT_ADDERROR
#include "f_user.h"
#endif
#include <linux/syscompat.h>
#include <sys/socket.h>
#include <sys/errno.h>
#include "f_ioctl.h"

View File

@ -5,7 +5,7 @@
#include <sys/time.h>
#include "f_signal.h"
#include <sys/sysmacros.h>
#include <sys/stropts.h>
#include "stropts.h"
#ifdef DO_ADDUSER
#include "f_user.h"
#endif

View File

@ -5,7 +5,7 @@
#include <sys/time.h>
#include "f_signal.h"
#include <sys/sysmacros.h>
#include <sys/stropts.h>
#include "stropts.h"
#ifdef DO_ADDUSER
#include "f_user.h"
#endif

View File

@ -18,7 +18,7 @@
#include "f_ioctl.h"
#include "f_ip.h"
#include <sys/sysmacros.h>
#include <sys/stropts.h>
#include "stropts.h"
#include "f_termio.h"
#include <sys/signal.h>
#include <sys/socket.h>

View File

@ -1,16 +1,9 @@
all::
depend::
rm -f sys linux
ln -s . linux
ln -s . sys
KERNEL=1
OBJ = streams.o
TOPDIR=..
include $(TOPDIR)/Make.rules
clean::
rm -f sys linux

View File

@ -3,8 +3,8 @@
#include <linux/config.h>
#include <linux/types.h>
#include <linux/syscompat.h>
#include <linux/stropts.h>
#include "compat.h"
#include "stropts.h"
#ifdef __KERNEL__
#include <linux/fs.h>
#include <linux/major.h>

View File

@ -11,8 +11,9 @@
#include "f_module.h"
#undef F_NOCODE
#endif
#include "kernel.h"
#include <linux/types.h>
#include <linux/stream.h>
#include "stream.h"
#include <linux/mm.h>
#include <linux/fs.h>
#include <linux/errno.h>
@ -27,8 +28,6 @@
#include <linux/tqueue.h>
#include <linux/syscompat.h>
#define WAIT_READ 1
#define WAIT_WRITE 2
#define WAIT_NOINTR 4
@ -982,7 +981,11 @@ static int xstream_write(struct stream_header *p_stream, int fromuser, const cha
}
static int
streams_write (struct inode *inode, struct file *file, const char *buf, int count)
streams_write (struct inode *inode, struct file *file,
#if LINUX_VERSION_CODE > 66304 /* 1.3.0 ?? */
const
#endif
char *buf, int count)
{
struct stream_header *p_stream;
unsigned long s;
@ -1286,7 +1289,7 @@ xstreams_ioctl (struct stream_header *p_stream, unsigned int cmd, unsigned long
case TCSETSF:
strioc.ic_len = sizeof(struct termios);
cmd |= IOC_IN;
goto doit;
goto do_strioctl;
#endif
#ifdef TCSETA
case TCSETA:
@ -1294,30 +1297,28 @@ xstreams_ioctl (struct stream_header *p_stream, unsigned int cmd, unsigned long
case TCSETAF:
strioc.ic_len = sizeof(struct termio);
cmd |= IOC_IN;
goto doit;
goto do_strioctl;
#endif
#ifdef TCGETS
case TCGETS:
strioc.ic_len = sizeof(struct termios);
cmd |= IOC_OUT;
goto doit;
goto do_strioctl;
#endif
#ifdef TCGETA
case TCGETA:
strioc.ic_len = sizeof(struct termio);
cmd |= IOC_OUT;
goto doit;
goto do_strioctl;
#endif
#ifdef UIOCTTSTAT
case UIOCTTSTAT:
strioc.ic_len = 3;
cmd |= IOC_OUT;
goto doit;
goto do_strioctl;
#endif
default:
strioc.ic_len = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT;
doit:
goto do_strioctl;
case I_STR:
@ -1667,7 +1668,10 @@ static void tstreams_close(struct tty_struct * tty, struct file * file)
}
static int tstreams_write(struct tty_struct * tty, int fromuser,
const unsigned char *buf, int count)
#if LINUX_VERSION_CODE >= 66304 /* 1.3.0 ?? */
const
#endif
unsigned char *buf, int count)
{
struct stream_header *p_stream = (struct stream_header *)tty->driver_data;
@ -1749,12 +1753,10 @@ static int tstreams_ioctl(struct tty_struct *tty, struct file * file,
int err;
struct stream_header *p_stream = (struct stream_header *)tty->driver_data;
if(p_stream == NULL)
if(p_stream == NULL)
return 0;
err = xstreams_ioctl(p_stream,cmd,arg);
if(err == -EINVAL)
err = -ENOIOCTLCMD;
return err;
}

View File

@ -13,9 +13,10 @@
#ifdef MODULE
#include "f_module.h"
#endif
#include "kernel.h"
#include <linux/types.h>
#include <linux/stream.h>
#include "stream.h"
#include <linux/errno.h>
#ifdef __KERNEL__
#include <linux/mm.h>
@ -28,13 +29,11 @@
#else
unsigned long bh_mask;
#endif
#include "kernel.h"
#ifdef linux
#ifdef __KERNEL__
#include <linux/interrupt.h>
#endif
#include <linux/syscompat.h>
#ifdef SK_STREAM
#include <linux/skbuff.h>
#endif
@ -439,7 +438,7 @@ freemsg(mblk_t *p_msg)
if(p_msg == NULL) {
#ifdef CONFIG_DEBUG_STREAMS
printf("%sFreeing NULL msg at %s:%d\n",KERN_ERR ,deb_file,deb_line);
printf("%sFreeing NULL msg at %s:%d\n",KERN_ERR , deb_file,deb_line);
#endif
return;
}

View File

@ -10,7 +10,7 @@
#include <sys/param.h>
#include <sys/sysmacros.h>
#include "streams.h"
#include <sys/stropts.h>
#include "stropts.h"
/* #include <sys/user.h> */
#include <sys/errno.h>
#include "streamlib.h"

View File

@ -1,6 +1,6 @@
#include "primitives.h"
#include "f_ioctl.h"
#include <sys/stropts.h>
#include "stropts.h"
#include <sys/errno.h>
#ifdef linux
#include <linux/ioctl.h>

View File

@ -3,7 +3,7 @@
#include <sys/file.h>
#include <sys/errno.h>
#include "f_signal.h"
#include <sys/stropts.h>
#include "stropts.h"
#include "f_termio.h"
#include "f_user.h"
#include <sys/uio.h>

View File

@ -11,7 +11,7 @@
#include <sys/param.h>
#include <sys/sysmacros.h>
#include "streams.h"
#include <sys/stropts.h>
#include "stropts.h"
#ifdef DONT_ADDERROR
#include "f_user.h"
#endif

View File

@ -11,7 +11,7 @@
#include <sys/param.h>
#include <sys/sysmacros.h>
#include "streams.h"
#include <sys/stropts.h>
#include "stropts.h"
#ifdef DONT_ADDERROR
#include "f_user.h"
#endif

View File

@ -7,7 +7,7 @@
# Sample answering machine.
# It answers on EAZ 2 (1TR6) bzw. MSN ...2 (Euro).
R phone * * * <username> RM.3 catfone
R phone * * * <username> mRM.3 catfone
## This number ---^ is the delay before the answerer answers.
## Warning: You have to adapt the catfone script to your requirements.
@ -20,7 +20,7 @@ ML phone * * * - transalaw alaw
# Sample remote login.
# Logins from "somebody" are only accepted if their number ends in 8.
R login * * * root TSRUDi /bin/login
R login * * * root mTSRUDi /bin/login
P login somebody * * R :nr .8
P login * * * MFX :lr /1 :vB 8890 :sv 0700

View File

@ -20,9 +20,6 @@ cd bin-$(uname -r) || cd bin
set +e
while : ; do
master -wdi /etc/isdn.conf >>/tmp/isdn.log 2>>/var/log/isdn
master -wdi /etc/isdn.conf 2>>/tmp/isdn.log >>/var/log/isdn
sleep 15
done &
if test -x /etc/isdn.route ; then
/etc/isdn.route
fi

View File

@ -15,7 +15,7 @@
#include <sys/param.h>
#include <sys/sysmacros.h>
#include "streams.h"
#include <sys/stropts.h>
#include "stropts.h"
#ifdef DONT_ADDERROR
#include "f_user.h"
#endif

View File

@ -11,7 +11,7 @@
#include <sys/param.h>
#include <sys/sysmacros.h>
#include "streams.h"
#include <sys/stropts.h>
#include "stropts.h"
#ifdef DONT_ADDERROR
#include "f_user.h"
#endif

View File

@ -18,7 +18,6 @@
#include <sys/sysmacros.h>
#include "streams.h"
#include <sys/errno.h>
/* #include <sys/stropts.h> */
#ifdef DONT_ADDERROR
#include "f_user.h"
#endif