isdn-14
reconstructed by extracting isdn-18.tar.gz and reverse applying the various diffs back to isdn-14.
This commit is contained in:
parent
219e6bdd9b
commit
3bab9ab140
175
DOKU
175
DOKU
|
@ -16,6 +16,9 @@ unter der GPL bzw. ihrem deutschen
|
|||
Achtung:
|
||||
=======
|
||||
|
||||
Version 14: Die CL- und DL-Zeilen haben sich geändert (erweitert um
|
||||
<Key>-Parameter). Intelligente Karten funktionieren NOCH NICHT.
|
||||
|
||||
In der Version 11 lagen noch ein paar .depend-Dateien und anderer Kram rum,
|
||||
die den Buildprozeß gestört haben. Abhilfe: "make clean".
|
||||
|
||||
|
@ -226,6 +229,7 @@ done
|
|||
# Danach:
|
||||
|
||||
vi config/config.data
|
||||
# Zeile "PROTOCOLS" und "SUBPROTOCOLS" ansehen. Siehe unten "DL-Zeile".
|
||||
make.isdn
|
||||
# Als Superuser:
|
||||
make.isdn
|
||||
|
@ -346,6 +350,7 @@ AT/Q
|
|||
Programmende. Kann nur vom Superuser ausgeführt werden.
|
||||
AT/R
|
||||
Reload der Konfigdatei. Kann nur vom Superuser ausgeführt werden.
|
||||
Alle wegen eines Fehlers deaktivierten Programme werden wieder aufgeweckt.
|
||||
AT/Xn
|
||||
Abbruch der Verbindung <n>. Kann nur vom Superuser ausgeführt werden.
|
||||
ATD/sys/proto
|
||||
|
@ -404,6 +409,16 @@ nicht ohne weiteres beobachten lassen.) Zum Gl
|
|||
"normale" Betriebsarten herauskristallisiert, an die sich die meisten
|
||||
Systeme halten.
|
||||
|
||||
Paketformate
|
||||
------------
|
||||
Im einfachsten Fall werden IP-Pakete direkt auf die Leitung geschickt. Wer
|
||||
zusätzlich noch Appletalk oder IPX oder so machen will, kann diese entweder
|
||||
in IP einpacken (Overhead, kein Kernelsupport unter Linux) oder ein paar
|
||||
Bytes vor die Daten stellen, die angeben, um was für Daten es sich handelt.
|
||||
|
||||
Die Bytes können entweder genauso aussehen wie im Ethernet, oder so wie der
|
||||
Pakettyp von PPP. Wer PPP macht, braucht offensichtlich letzteres (PPP
|
||||
selber wird auch bald kommen...); normale Leute nehmen die Ethernet-Codes.
|
||||
|
||||
Noch ein Einschub: TCP-IP-Routing
|
||||
=================================
|
||||
|
@ -523,12 +538,23 @@ Alle Zeilentypen:
|
|||
Zeilen in der Konfigdatei müssen zueinander passende Keys haben, d.h.
|
||||
mindestens ein Zeichen muß in allen Keys übereinstimmen. "*" paßt zu
|
||||
allen anderen Zeichen.
|
||||
Der resultierende String ist also die Schnittmenge aller Zeichen in
|
||||
den <Key>-Parametern aller verwendeter Konfigurationszeilen.
|
||||
<Key>-Zeilen mit einem Pluszeichen an erster Stelle werden nur auf
|
||||
Vorhandensein eines Zeichens geprüft, aber die Menge wird nicht
|
||||
eingeschränkt. Beispiel:
|
||||
"ab" "cd" -> leere Menge
|
||||
"ab" "xay" -> "a"
|
||||
"ab" "+x" -> leere Menge
|
||||
"ab" "+bx" -> "b"
|
||||
"ab" "+bx" "a" -> leere Menge
|
||||
Damit läßt sich sehr flexibel einstellen, wer auf welcher Leitung /
|
||||
Nummer mit welchen Parametern anrufen kann.
|
||||
<Mod> sind einzelne Buchstaben, der der betreffenden Zeile eine Sonder-
|
||||
behandlung verpassen.
|
||||
<Parameter...> ist eine Folge von einem oder mehr Parameter-Wert-Angaben.
|
||||
(Manche Parameter haben keine Wertangabe.)
|
||||
Merke: Zeilen ohne Parameter sind im allgemeinen nicht sinnvoll
|
||||
und führen (momentan noch) zu Fehlverhalten des Treibers.
|
||||
Merke: Zeilen ohne Parameter sind nicht besonders sinnvoll.
|
||||
|
||||
|
||||
P-Zeile ("Protokoll")
|
||||
|
@ -547,33 +573,37 @@ Parameter:
|
|||
Verbindungen wird das handhabende Programm nicht unterbrochen.
|
||||
Ein "reconn"-Streamsmodul stellt sicher, daß das Programm davon nichts
|
||||
mitbekommt, außer wenn der Wiederaufbau der Verbindung nicht klappt.
|
||||
:cd Karte. Welche ISDN-Leitung verwendet werden soll. (Wichtig für SPVs.)
|
||||
Bei Festverbindungen wird dieser Parameter nicht benötigt.
|
||||
:bc Zu verwendender B-Kanal, 1 oder 2. Nur für Festverbindungen
|
||||
interessant; im normalen ISDN managt die Vermittlung B-Kanäle für uns.
|
||||
:nj Kann der Ruf nicht angenommen werden, wird BUSY statt CallRejected
|
||||
gesendet.
|
||||
:xi Wenn ankommende und abgehende Anrufe kollidieren, soll der an-
|
||||
kommende abgewiesen werden. (Default: Der abgehende Ruf wird
|
||||
abgebrochen.) (Nicht allzu gut getestet.)
|
||||
abgebrochen.)
|
||||
:yi Bei einem ankommeden Ruf wird automatisch ein abgehender gestartet und
|
||||
der ankommende wird abgewiesen. (Ungetestet.)
|
||||
der ankommende wird abgewiesen.
|
||||
:bi Bei einem ankommenden Ruf, der nicht angenommen werden kann (belegt?),
|
||||
wird automatisch hoffentlich auf einer anderen Leitung zurückgerufen.
|
||||
wird automatisch auf einer anderen Leitung zurückgerufen.
|
||||
:fr ebenfalls zu setzen ist meist sinnvoll.
|
||||
:il Die CL-Zeile wird ignoriert.
|
||||
:fX Ankommende Anrufe, die (zB wegen besetzt) abgewiesen werden, werden
|
||||
"schnell" abgelehnt. (Andere Geräte am Bus können nicht abheben.)
|
||||
"schnell" abgelehnt. (Andere Geräte am Bus können nicht abheben, da die
|
||||
Vermittlung nicht abwartet, ob sich noch jemand meldet.)
|
||||
:fr Abgehende Anrufe, die nicht durchkommen, werden "sofort" und "oft"
|
||||
wiederholt.
|
||||
:ib Wenn ankommend kein B-Kanal mitgeliefert wird, wird die Verbindung
|
||||
abgewiesen. (zB wenn man dich den Anschluß mit einem anderen gerät
|
||||
teilt.) Fehlt :ib, hört die Gegenseite in diesem Fall ein normales
|
||||
Rufzeichen ("Anklopfen"); die Verbindung wird nach 40 Sekunden
|
||||
ausgelöst, wenn bis dahin kein B-Kanal frei wird..
|
||||
|
||||
Logischerweise darf :xi oder :yi nicht auf beiden Seiten angegeben
|
||||
sein..!
|
||||
|
||||
Spezifisch für 1TR6:
|
||||
Spezifisch für 1TR6 und CAPI:
|
||||
:sv Dienstkennung; zwei Bytes in Hex. Telefon ist 0101 und 0102; DFÜ ist
|
||||
07xx (xx ist üblicherweise 00).
|
||||
:pv Semipermanente Verbindung bei abgehenden Rufen.
|
||||
:pv Semipermanente Verbindung bei abgehenden Rufen. (Noch nicht bei CAPI.)
|
||||
Ankommend werden SPVs automatisch unterstützt.
|
||||
|
||||
Spezifisch für Euro-ISDN:
|
||||
|
@ -611,10 +641,11 @@ f f
|
|||
d für Wählverbindungen
|
||||
p für Verbindungsaufbau nach Bedarf
|
||||
|
||||
Der Suchalgorithmus findet zunächst eine zur Verbindung passende R-Zeile
|
||||
und hängt an deren Parameterliste dann alle ebenfalls passenden M-Zeilen
|
||||
an (dabei werden bereits angegebene Werte beibehalten, die spezifischen
|
||||
Einträge also nach oben!), bis er auf eine X-Zeile trifft.
|
||||
Der Suchalgorithmus findet zunächst eine zur Verbindung passende Zeile mit
|
||||
R-Flag und hängt an deren Parameterliste alle ebenfalls passenden Zeilen
|
||||
mit M-Flag an (dabei werden bereits angegebene Werte beibehalten, die
|
||||
spezifischen Einträge also nach oben!), bis er auf eine Zeile mit X-Flag
|
||||
trifft.
|
||||
|
||||
|
||||
ML-Zeile ("Modulliste")
|
||||
|
@ -704,32 +735,39 @@ DL-Zeile ("Dial Local")
|
|||
--------
|
||||
|
||||
Form:
|
||||
DL <Karte> <Nummer> <Protokolle>
|
||||
DL <Key> <Karte> <Nummer> <Protokolle>
|
||||
|
||||
Beispiel:
|
||||
DL Tel? +49=911-995962. :pr 0 :sp 65 :pr 63
|
||||
DL * Tel? +49=911-995962. :pr 0 :sp 65 :pr 63
|
||||
|
||||
Eigene Telefonnummer. Im Beispiel sind alle Karten, auf die "Tel?"
|
||||
paßt, an einer ISDN-Leitung mit dieser Nummer angeschlossen.
|
||||
|
||||
Diese Zeile wird verwendet, um die kürzestmögliche Rufnummer für
|
||||
abgehende Verbindungen zu finden und um die verwendeten Protokolle zu
|
||||
spezifizieren.
|
||||
spezifizieren. Hat eine Karte mehrere Rufnummern (MSNs), werden die
|
||||
Protokolle nur in der ersten DL-Zeile angegeben.
|
||||
|
||||
Beispiel 1TR6:
|
||||
DL Tel0 +49=911-23456. :pr 0 :sp 65 :pr 63
|
||||
Zusätzlich werden in der DL-Zeile die Protokolle beschrieben, mit denen der
|
||||
ISDN-Treiber mit der Karte redet. Diese Protokolle müssen natürlich auch in
|
||||
den Treiber eingebaut werden, und zwar in der Datei config/config.data,
|
||||
Eintrag PROTOCOLS (spitze Klammer) und SUBPROTOCOLS (eckige Klammer).
|
||||
|
||||
Beispiel Euro-ISDN:
|
||||
DL Tel0 +49=911-34567. :pr 0 :sp 8 :pr 63
|
||||
Beispiel 1TR6: <phone tei> [german]
|
||||
DL * Tel0 +49=911-23456. :pr 0 :sp 65 :pr 63
|
||||
|
||||
Beispiel Festverbindung:
|
||||
DL Tel2 - :pr 64
|
||||
Beispiel Euro-ISDN: <phone tei> [euro]
|
||||
DL * Tel0 +49=911-34567. :pr 0 :sp 8 :pr 63
|
||||
|
||||
Beispiel intelligente Karte mit CAPI:
|
||||
DL Bin0 +49=911-45678. :pr 65
|
||||
Beispiel Festverbindung: <fixed>
|
||||
DL * Tel2 - :pr 64
|
||||
|
||||
Beispiel intelligente Karte mit CAPI: <capi> [bintec]
|
||||
DL * Bin0 +49=911-45678. :pr 65 :sp 0
|
||||
|
||||
Bedeutung der Spezialzeichen in der Nummer: Siehe "DP" unten.
|
||||
|
||||
|
||||
Protokolle und Flags in der DL-Zeile:
|
||||
--------------------
|
||||
|
||||
|
@ -751,7 +789,7 @@ Die Reihenfolge ist wichtig.
|
|||
|
||||
:pr 0 Normaler ISDN-D-Kanal, angeschlossen am Netz oder an einer
|
||||
Telefonanlage. Darf nur zusammen mit TEI-Handler (:pr 63)
|
||||
verwendet werden.
|
||||
verwendet werden. <phone>
|
||||
:kl Level-2-Verbindung zur Vermittlung nicht trennen. Bei Punkt-
|
||||
zu-Punkt-Verbindungen und bei entsprechend konfigurierten
|
||||
ISDN-Anschlüssen ("Dauerüberwachung oder sowas ähnliches")
|
||||
|
@ -759,8 +797,8 @@ Die Reihenfolge ist wichtig.
|
|||
:cl Level-2-Verbindung zur Vermittlung trennen, wenn keine
|
||||
Verbindung besteht. Default.
|
||||
|
||||
:sp 8 DSS1, Euro-ISDN.
|
||||
:sp 65 1TR6, deutscher Standard.
|
||||
:sp 8 DSS1, Euro-ISDN. [euro]
|
||||
:sp 65 1TR6, deutscher Standard. [german]
|
||||
Entweder :sp 8 oder :sp 65 muß angegeben werden, NICHT beides!
|
||||
|
||||
:ai Ankommenden Anruf mit dem ISDN-Äquivalent von "RINGING"
|
||||
|
@ -768,13 +806,24 @@ Die Reihenfolge ist wichtig.
|
|||
Notwendig bei langsamen Rechnern.
|
||||
:ad Ankommende Anrufe erst prüfen, dann annehmen (oder auch nicht).
|
||||
Default.
|
||||
:pr 63 TEI-Handler (Transport Endpoint Identifier).
|
||||
:pr 63 TEI-Handler (Transport Endpoint Identifier). <tei>
|
||||
:ti TEI sofort zuordnen lassen. Notwendig bei langsamen / sehr
|
||||
beschäftigten Rechnern und bei manchen Telefonanlagen.
|
||||
:td TEI beim ersten Verbindungsaufbau zuordnen lassen. Default.
|
||||
:pr 64 Festverbindung: kein D-Kanal.
|
||||
:pr 65 Intelligente Karte mit CAPI 1.x-Schnittstelle.
|
||||
(Noch nicht implementiert.)
|
||||
:pr 64 Festverbindung: kein D-Kanal. <fixed>
|
||||
:pr 65 Intelligente Karte mit CAPI-1.x-Schnittstelle. (Noch nicht!)
|
||||
In der Konfiguration verhält sich eine CAPI-Karte ansonsten wie
|
||||
der 1TR6-Treiber, und zwar AUCH DANN WENN DAS TEIl AM EURO-ISDN
|
||||
HÄNGT. <capi>
|
||||
:sp 0 Bintec-Karte. [bintec]
|
||||
Auf diese Karte muß zunächst boot.68k und dann entweder bri.68k,
|
||||
bri_4.68k oder pmx.68k geladen werden.
|
||||
:lp X X X CAPI-Bitmasken für EAZ, Service, Infos. Hexadezimal.
|
||||
Default: 3FFF FFFF 003F.
|
||||
:st XXXXX Protokollstack XXXXX laden. Siehe Handbuch zur Karte.
|
||||
Default ist u_dss1_pmp.
|
||||
:ea N NNN EAZ N auf (lokale) Endnummer NNN mappen.
|
||||
Default ist die letzte Ziffer der Nummer.
|
||||
|
||||
|
||||
DP-Zeile ("Dial Prefix")
|
||||
|
@ -844,6 +893,7 @@ Mod:
|
|||
implementiert)
|
||||
$ Die Befehlszeile wird nicht direkt ausgeführt, sondern der Shell übergeben.
|
||||
E Beim Auftreten eines Fehlers wird dieses Programm deaktiviert.
|
||||
(Reaktivieren: AT/R.)
|
||||
D /dev/ttyiXX wird angelegt und nach Programmende gelöscht.
|
||||
F Das Programm wird sofort gestartet, und die Verbindung wird aufgebaut.
|
||||
Interessant insbesondere bei Festverbindungen und SPVs.
|
||||
|
@ -910,10 +960,10 @@ framelo ... oder die unteren Bits. Sinnvoll dann, wenn jemand den Daten-
|
|||
CL-Zeile ("Card Limit")
|
||||
--------
|
||||
|
||||
Form: CL <Karte> <Zahl> <Modus>
|
||||
Form: CL <Karte> <Key> <Zahl>
|
||||
|
||||
Beispiel>
|
||||
CM Tel? 2
|
||||
CM Tel? * 2
|
||||
Begrenzt die Zahl der verwendbaren B-Kanäle einer Karte.
|
||||
Ueber das Limit hinausgehende Anrufe werden mit BUSY abgelehnt, es sei denn
|
||||
in der entsprechenden P-Zeile steht der entsprechende Parameter.
|
||||
|
@ -925,7 +975,8 @@ LF-Zeile ("Load File")
|
|||
Form: LF <Karte> <Segmentgröße> <Dateiname>
|
||||
|
||||
Lädt die Datei auf die (aktive) Karte. Mehrere LF-Zeilen können angegeben
|
||||
werden.
|
||||
werden (in der richtigen Reihenfolge!). Die maximal mögliche Segmentgröße
|
||||
ist 4096.
|
||||
|
||||
|
||||
RP-Zeile ("Run Program")
|
||||
|
@ -1030,6 +1081,10 @@ Paketformat:
|
|||
:.N TCP/IP (Default).
|
||||
:.E Ethernet-Paketheader.
|
||||
:.P PPP-Paketheader.
|
||||
:eT xxxx xxxx: hexadezimal. Angabe des übertragenen Pakettyps (:.N).
|
||||
TCP/IP ist 0800 (Default). Damit können zB statt
|
||||
"nackter" IP-Pakete ebensolche Appletalk-Pakete
|
||||
übertragen werden.
|
||||
|
||||
ioctl(x,SIOCGETU,int) ioctl-Aufruf zur Uebertragung der Unit-Nummer ("strX",
|
||||
0 <= X <= 15) an ein Anwenderprogramm. Das Programm kann damit die IP-
|
||||
|
@ -1394,3 +1449,53 @@ Beispiel:
|
|||
Ansonsten: Sich von der Gegenstelle anrufen zu lassen und die betreffenden
|
||||
Daten einfach einzutragen ist wohl die einfachste Methode.
|
||||
|
||||
|
||||
Karten mit CAPI: Die CAPI ist doof...
|
||||
===============
|
||||
|
||||
Im Internet heißt es in so gut wie jedem RFC, daß reservierte Bits beim
|
||||
Senden auf Null zu setzen und beim Empfangen zu ignorieren sind. Nicht so
|
||||
in der CAPI 1.1, dort sind gesetzte reservierte Bits ein Grund für eine
|
||||
Fehlermeldung. Da aber nirgends definiert oder abfragbar ist, welche Bits
|
||||
eigentlich erlaubt sind, ist es so gut wie unmöglich, ohne Ratespiel neue
|
||||
Features zu unterstützen...
|
||||
|
||||
Wie dem auch sei, die Infobits haben folgende Bedeutung:
|
||||
00000001 Gebühreneinheiten
|
||||
00000002 Datum
|
||||
00000004 Display
|
||||
00000008 User-User Info
|
||||
00000010 Cause
|
||||
00000020 Status des gerufenen Teilnehmers
|
||||
00000040...
|
||||
80000000 reserviert
|
||||
|
||||
Die EAZ-Bits:
|
||||
0001 Null ("Global Call", wird aber nicht besonders behandelt)
|
||||
0002 Eins ...
|
||||
0200 Neun
|
||||
0400...
|
||||
8000 reserviert
|
||||
|
||||
Die Dienstkennungen, entsprechend :sv 00xx ... 0Fxx:
|
||||
0001 Bildtelefon
|
||||
0002 Telefonie
|
||||
0004 a/b-Dienste
|
||||
0008 X.21-Dienste
|
||||
0010 Telefax Gruppe 4
|
||||
0020 BTX, 64 KBit/sec
|
||||
0040 ?
|
||||
0080 DFÜ
|
||||
0100 X.25
|
||||
0200 Teletext
|
||||
0400 Mixed Mode
|
||||
0800 ?
|
||||
1000 ?
|
||||
2000 Fernwirken
|
||||
4000 Grafiktelefon
|
||||
8000 BTX (CEPT-Standard)
|
||||
|
||||
Ankommende Rufe, die zu diesen EAZs und Diensten passen, werden
|
||||
durchgereicht (und die angeforderten Informationen werden gemeldet, wenn
|
||||
die Vermittlung sie sendet(!)); andere Rufe werden ignoriert.
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
.PHONY: dummy
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
## =()<CARDS = @<CARDS>@>()=
|
||||
CARDS = teles
|
||||
## =()<PROTOCOLS = @<PROTOCOLS>@>()=
|
||||
PROTOCOLS = phone tei
|
||||
## =()<SUBPROTOCOLS = @<SUBPROTOCOLS>@>()=
|
||||
SUBPROTOCOLS = euro german
|
||||
|
||||
## =()<KERNELSRC := @<KERNELSRC>@>()=
|
||||
KERNELSRC := /usr/src/linux
|
||||
|
||||
ifdef KERNEL
|
||||
## =()<CC = @<CC>@>()=
|
||||
CC = gcc
|
||||
## =()<CFLAGS = @<CFLAGS>@ >()=
|
||||
CFLAGS = -g -O2 -Wall -fomit-frame-pointer -DKERNEL -D__KERNEL__ -DMODULE
|
||||
|
||||
else
|
||||
|
||||
## =()<CC = @<HOSTCC>@>()=
|
||||
CC = gcc
|
||||
## =()<CFLAGS = @<HOSTCFLAGS>@ >()=
|
||||
CFLAGS = -g -O2 -Wall
|
||||
## =()<LIBS = @<LIBS>@>()=
|
||||
LIBS = -lbsd
|
||||
endif
|
||||
|
||||
|
||||
## =()<DESTDIR = @<DESTDIR>@>()=
|
||||
DESTDIR = /usr/local/isdn
|
||||
## =()<LD = @<LD>@>()=
|
||||
LD = ld
|
||||
## =()<LDFLAGS = @<LDFLAGS>@>()=
|
||||
LDFLAGS =
|
||||
## =()<RANLIB = @<RANLIB>@>()=
|
||||
RANLIB = echo
|
||||
## =()<STR_IF = str_@<STR_IF>@>()=
|
||||
STR_IF = str_linux
|
||||
## =()<SYS = @<SYS>@>()=
|
||||
SYS = linux
|
||||
|
||||
|
|
@ -0,0 +1,241 @@
|
|||
# This Makefile is chaotic. Sorry.
|
||||
# It gets (most of) the job done and that's what counts.
|
||||
#
|
||||
|
||||
all:: first_rule
|
||||
|
||||
unexport KERNEL
|
||||
unexport PROGRAM
|
||||
unexport PROGRAMS
|
||||
unexport CC
|
||||
unexport CFLAGS
|
||||
unexport SOURCES
|
||||
unexport HEADERS
|
||||
unexport LIB
|
||||
unexport LIBS
|
||||
unexport OBJ
|
||||
unexport OBJS
|
||||
unexport DOCARDS
|
||||
unexport WHAT
|
||||
unexport REALSOURCE
|
||||
unexport DOSRC
|
||||
|
||||
ifneq ($(strip $(DOCARDS)),)
|
||||
KERNEL=1
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/Make.config
|
||||
|
||||
export KERNELSRC
|
||||
export TOPDIR
|
||||
|
||||
VERSION := $(shell $(TOPDIR)/tools/getversion $(KERNELSRC))
|
||||
|
||||
.PHONY: dummy
|
||||
|
||||
ifeq ($(strip $(HEADERS)),)
|
||||
HEADERS := $(wildcard *.h)
|
||||
endif
|
||||
|
||||
DOSRC:=1
|
||||
ifneq ($(strip $(REALSOURCE)),)
|
||||
DOSRC:=0
|
||||
endif
|
||||
ifneq ($(strip $(DOCARDS)),)
|
||||
DOSRC:=1
|
||||
endif
|
||||
|
||||
ifeq ($(DOSRC),1)
|
||||
ifneq ($(strip $(KERNEL)),)
|
||||
ifeq ($(strip $(SOURCES)),)
|
||||
SOURCES := $(wildcard *.c)
|
||||
endif
|
||||
else
|
||||
ifeq ($(strip $(PSOURCES)),)
|
||||
PSOURCES := $(wildcard *.c)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(strip $(DOCARDS)),)
|
||||
OLDSOURCES := $(SOURCES)
|
||||
SOURCES := $(filter $(addsuffix .c,$(CARDS)),$(SOURCES))
|
||||
endif
|
||||
|
||||
|
||||
INCLUDES = -I$(TOPDIR)/include -I$(TOPDIR)/compat -I$(TOPDIR)/streams -I$(KERNELSRC)/include $(EXTRA_INCLUDES)
|
||||
|
||||
first_rule:: libs programs modules
|
||||
|
||||
|
||||
all depend indent clean install::
|
||||
ifneq ($(strip $(SUBDIRS)),)
|
||||
$(MAKE) WHAT=$@ subdirs
|
||||
|
||||
subdirs::
|
||||
set -e; for i in $(SUBDIRS); do $(MAKE) TOPDIR=../$(TOPDIR) -C $$i $(WHAT); done
|
||||
endif
|
||||
|
||||
depend::
|
||||
|
||||
ifneq ($(strip $(SOURCES)),)
|
||||
OBJS = $(addsuffix .o, $(basename $(SOURCES)))
|
||||
endif
|
||||
ifneq ($(strip $(PSOURCES)),)
|
||||
POBJS = $(addsuffix .o, $(basename $(PSOURCES)))
|
||||
ifeq ($(strip $(PROGRAM)),)
|
||||
ifeq ($(strip $(PROGRAMS)),)
|
||||
ifeq ($(strip $(LIB)),)
|
||||
PROGRAMS = $(basename $(PSOURCES))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(strip $(REALSOURCE)),)
|
||||
$(OBJS): $(REALSOURCE)
|
||||
$(CC) $(CFLAGS) $(INCLUDES) $(EXTRA_CFLAGS) -DREALNAME=$(basename $@) -D_$(basename $@)_ -c -o $@ $<
|
||||
else
|
||||
ifeq ($(DOCARDS),1)
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $(INCLUDES) $(EXTRA_CFLAGS) -DREALNAME=$(basename $@) -D_$(basename $@)_ -c -o $@ $<
|
||||
else
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $(INCLUDES) $(EXTRA_CFLAGS) -c -o $@ $<
|
||||
endif
|
||||
endif
|
||||
|
||||
clean::
|
||||
rm -f .depend core
|
||||
rm -f *.vi?
|
||||
ifneq ($(strip $(TARGET)),)
|
||||
rm -f $(TARGET)
|
||||
endif
|
||||
ifneq ($(strip $(POBJS)),)
|
||||
rm -f $(POBJS)
|
||||
endif
|
||||
ifneq ($(strip $(OBJ)),)
|
||||
rm -f $(OBJ)
|
||||
endif
|
||||
ifneq ($(strip $(OBJS)),)
|
||||
rm -f $(OBJS)
|
||||
endif
|
||||
ifneq ($(strip $(PROGRAM)),)
|
||||
rm -f $(PROGRAM)
|
||||
endif
|
||||
ifneq ($(strip $(filter-out $(NOCLEAN),$(PROGRAMS))),)
|
||||
rm -f $(filter-out $(NOCLEAN),$(PROGRAMS))
|
||||
endif
|
||||
ifneq ($(strip $(LIB)),)
|
||||
rm -f $(LIB)
|
||||
endif
|
||||
|
||||
ifneq ($(strip $(PROGRAM)),)
|
||||
programs:: $(PROGRAM)
|
||||
$(PROGRAM): $(POBJS) $(filter %.a,$(LIBS) $(EXTRA_LIBS))
|
||||
$(CC) -o $@ $(POBJS) $(EXTRA_LIBS) $(LIBS)
|
||||
else
|
||||
ifneq ($(strip $(PROGRAMS)),)
|
||||
programs:: $(PROGRAMS)
|
||||
|
||||
%: %.o $(filter %.a,$(LIBS) $(EXTRA_LIBS))
|
||||
$(CC) $(LDFLAGS) -o $@ $< $(EXTRA_LIBS) $(LIBS)
|
||||
else
|
||||
programs::
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(strip $(PROGRAMS)),)
|
||||
programs:: $(PROGRAMS)
|
||||
|
||||
else
|
||||
programs::
|
||||
|
||||
endif
|
||||
|
||||
ifneq ($(strip $(LIB)),)
|
||||
libs: $(LIB)
|
||||
|
||||
$(LIB): $(POBJS)
|
||||
rm -f $@
|
||||
$(AR) rcs $@ $^
|
||||
else
|
||||
libs:
|
||||
endif
|
||||
|
||||
|
||||
lib::
|
||||
ifneq ($(strip $(P_LIB)),)
|
||||
$(MAKE) $(P_OBJ)
|
||||
endif
|
||||
|
||||
ifneq ($(strip $(OBJS)),)
|
||||
ifeq ($(strip $(OBJ)),)
|
||||
modules: $(OBJS)
|
||||
else
|
||||
modules: $(OBJ)
|
||||
|
||||
$(OBJ): $(OBJS)
|
||||
$(LD) -r -o $@ $^
|
||||
endif
|
||||
|
||||
else
|
||||
modules:
|
||||
|
||||
endif
|
||||
|
||||
install::
|
||||
ifeq ($(strip $(KERNEL)),1)
|
||||
ifneq ($(strip $(OBJ)),)
|
||||
$(TOPDIR)/tools/insmod $(OBJ)
|
||||
else
|
||||
ifeq ($(strip $(DOCARDS)),1)
|
||||
$(foreach OBJ,$(OBJS),$(TOPDIR)/tools/d_insmod $(OBJ); )
|
||||
else
|
||||
$(foreach OBJ,$(OBJS),$(TOPDIR)/tools/insmod $(OBJ); )
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifneq ($(strip $(PROGRAM)),)
|
||||
install $(PROGRAM) $(DESTDIR)/bin-$(VERSION)
|
||||
endif
|
||||
ifneq ($(strip $(PROGRAMS)),)
|
||||
install $(PROGRAMS) $(DESTDIR)/bin-$(VERSION)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
indent::
|
||||
ifneq ($(strip $(PSOURCES)),)
|
||||
$(TOPDIR)/tools/indent.sh $(PSOURCES)
|
||||
endif
|
||||
ifneq ($(strip $(SOURCES)),)
|
||||
$(TOPDIR)/tools/indent.sh $(SOURCES)
|
||||
endif
|
||||
ifneq ($(strip $(HEADERS)),)
|
||||
$(TOPDIR)/tools/indent.sh $(HEADERS)
|
||||
endif
|
||||
|
||||
ifeq (.depend,$(wildcard .depend))
|
||||
include .depend
|
||||
endif
|
||||
|
||||
depend::
|
||||
rm -f .depend
|
||||
|
||||
ifneq ($(strip $(PSOURCES)),)
|
||||
depend:: Makefile $(PSOURCES) $(HEADERS)
|
||||
$(CC) -M $(CFLAGS) $(INCLUDES) $(EXTRA_CFLAGS) $(PSOURCES) >> .depend
|
||||
endif
|
||||
|
||||
ifneq ($(strip $(SOURCES)),)
|
||||
ifneq ($(strip $(REALSOURCE)),)
|
||||
depend:: Makefile $(REALSOURCE) $(HEADERS)
|
||||
$(foreach SOURCE,$(SOURCES), $(CC) -M $(CFLAGS) $(INCLUDES) $(EXTRA_CFLAGS) $(REALSOURCE) -D_$(SOURCE:.c=)_ | sed -e s/$(REALSOURCE:.c=.o)/$(SOURCE:.c=.o)/ >> .depend ; )
|
||||
else
|
||||
depend:: Makefile $(SOURCES) $(HEADERS)
|
||||
$(CC) -M $(CFLAGS) $(INCLUDES) $(EXTRA_CFLAGS) $(SOURCES) >> .depend
|
||||
endif
|
||||
endif
|
||||
|
59
Makefile
59
Makefile
|
@ -1,48 +1,19 @@
|
|||
# config and include are first, tools is next
|
||||
SUBDIRS = config include tools compat streams support isdn_3 isdn_4 \
|
||||
ksupport isdn_2 str_if cards x75 alaw tools van_j strslip \
|
||||
v110 pr_on strslip fakeh t70 rate timer reconnect ip_mon
|
||||
|
||||
# config and include are first, final is last
|
||||
DIRS = config compat streams include bin support isdn_3 isdn_4 \
|
||||
ksupport isdn_2 str_if cards x75 alaw \
|
||||
v110 pr_on strslip fakeh t70 rate timer reconnect ip_mon final
|
||||
ADIRS = config include bin support isdn_3 isdn_4 str_if ip_mon alaw tools
|
||||
KDIRS = config compat streams include ksupport isdn_2 str_if cards x75 \
|
||||
alaw v110 pr_on strslip fakeh t70 rate timer reconnect ip_mon final
|
||||
# dumbmgr portman port_m
|
||||
|
||||
SYSTEMS = linux
|
||||
#SYSTEMS = aux sco svr4 linux
|
||||
|
||||
all prog:: .depend
|
||||
|
||||
.depend:
|
||||
@$(MAKE) $(MAKEFLAGS) depend
|
||||
@touch .depend
|
||||
|
||||
all update load::
|
||||
set -e;for i in $(KDIRS);do echo -n "$$i: "; $(MAKE) $(MAKEFLAGS) -C $$i $@ ; done
|
||||
|
||||
prog::
|
||||
set -e;for i in $(ADIRS);do echo -n "$$i: "; $(MAKE) $(MAKEFLAGS) -C $$i $@ ; done
|
||||
|
||||
depend clean indent::
|
||||
set -e;for i in $(DIRS);do echo -n "$$i: "; $(MAKE) $(MAKEFLAGS) -C $$i $@ ; done
|
||||
|
||||
install: all
|
||||
$(MAKE) $(MAKEFLAGS) -C final doinstall
|
||||
|
||||
conf:
|
||||
cd config ; $(MAKE) $(MAKEFLAGS)
|
||||
|
||||
clean::
|
||||
for i in $(ALLDIRS) ; do ( cd $$i; \
|
||||
for j in $(SYSTEMS) ; do echo $$i/$$j ; \
|
||||
sh ../iftrue.sh "-d $$j" "cd $$j ; $(MAKE) $(MAKEFLAGS) clean" ; done \
|
||||
) ; done
|
||||
find . -name .depend -print|xargs rm -f
|
||||
rm -f .toldem
|
||||
|
||||
iprog:
|
||||
cd final && $(MAKE) $(MAKEFLAGS) install.bin
|
||||
|
||||
.PHONY: depend
|
||||
|
||||
all:: .diddepend
|
||||
dep: depend
|
||||
|
||||
TOPDIR=.
|
||||
include Make.rules
|
||||
|
||||
.diddepend:: Makefile
|
||||
$(MAKE) depend
|
||||
touch .diddepend
|
||||
|
||||
clean::
|
||||
rm -f .toldem .diddepend
|
||||
|
|
40
README
40
README
|
@ -4,6 +4,46 @@ Die Anleitung und der ganze Kram findet sich in der Datei DOKU, oder
|
|||
README.isdn in den Kernelsourcen.
|
||||
|
||||
|
||||
*** 1995-10-21
|
||||
|
||||
Release 14.
|
||||
|
||||
Mit dem RP-Zeilen gibt es anscheinend Probleme. Wäre nett, wenn das jemand
|
||||
anders debuggen könnte, sonst dauert das nämlich bis Version 16 oder so.
|
||||
|
||||
Wer kennt sich mit tcl/tk oder tclperl oder wish oder was-auch-immer aus?
|
||||
Gebraucht wird ein vernünftiges Frontend für die Konfigdatei...
|
||||
|
||||
Login und Kermit, nächster Versuch...
|
||||
|
||||
Aktive Karten (momentan: Bintec) tun NOCH NICHT, aber ich arbeite dran.
|
||||
|
||||
Mehr Kommentare im Source. (Immer noch zuwenige, ich weiß. Working.)
|
||||
|
||||
Fehler bereinigt. Insbesondere sollte der Treiber nun ca. eine Sekunde
|
||||
schneller sein beim Verbindungsaufbau, wenn gerade keine andere Verbindung
|
||||
offen ist. Grr...
|
||||
|
||||
Debugmeldungen schreiben nun das Intervall (in Jiffies, also normalerweise
|
||||
Hundertstelsekunden) seit der letzten Debugmeldung mit.
|
||||
|
||||
ACHTUNG, leichte Änderungen im Format der Konfigdatei (DL- und CL-Zeile:
|
||||
<Key>-Parameter ist dazugekommen); siehe Doku.
|
||||
|
||||
Kann jemand aus Taylor-UUCP (oder sonstwoher) den Code "ist die aktuelle
|
||||
Zeit in dem durch diesen String angegebenen Zeitfenster" klauen und um die
|
||||
Angabe der Anzahl Sekunden bis zum Verlassen des Zeitfensters erweitern?
|
||||
Beispiel: wenn es jetzt Sonntag 23:00:01 Uhr ist:
|
||||
- isintime("Mon") => 0
|
||||
- isintime("Sun") => 3599
|
||||
Sonst muß ich das machen und dafür habe ich keine Zeit. Das Ganze wird
|
||||
benötigt, um zB Logins nur abends zu erlauben oder den Zeittakt
|
||||
umzustellen. Momentan braucht es dazu ein per cron aufgerufenes externes
|
||||
Programm, das /etc/isdn.conf.times von isdn.conf.times.day nach
|
||||
isdn.conf.times.night umlinkt und AT/R anstößt; geht, aber ist nicht
|
||||
besonders schön.
|
||||
|
||||
|
||||
*** 1995-09-31
|
||||
|
||||
Release 13.
|
||||
|
|
|
@ -1,66 +1,7 @@
|
|||
SHELL = /bin/sh
|
||||
MAKE = make
|
||||
## =()<P = @<P>@>()=
|
||||
P =
|
||||
|
||||
## =()<CCU = @<CCU>@>()=
|
||||
CCU = gcc
|
||||
## =()<CC = @<CC>@>()=
|
||||
CC = gcc
|
||||
## =()<DEFS = @<DEFKERNEL>@ @<KERNEL>@ -I../include >()=
|
||||
DEFS = -I../streams -I../compat -I/usr/src/linux/include -fomit-frame-pointer -DKERNEL -D__KERNEL__ -DMODULE -DCONFIG_MODVERSIONS -I../include
|
||||
## =()<CFLAGS = @<CFLAGS>@ $(DEFS)>()=
|
||||
CFLAGS = -O2 -Wall $(DEFS)
|
||||
## =()<DEFSN = @<DEFS>@ >()=
|
||||
DEFSN = -I../streams -I../compat -I/usr/src/linux/include -I/usr/include/bsd
|
||||
## =()<NCFLAGS = @<CFLAGS>@ $(DEFSN)>()=
|
||||
NCFLAGS = -O2 -Wall $(DEFSN)
|
||||
## =()<LIBS = @<LIBS>@>()=
|
||||
LIBS = -lbsd
|
||||
## =()<LDFLAGS = @<LDFLAGS>@>()=
|
||||
LDFLAGS = -v
|
||||
KERNEL=1
|
||||
SUBDIRS=tools
|
||||
|
||||
## =()<SYS = @<SYS>@>()=
|
||||
SYS = linux
|
||||
|
||||
SOURCES = alaw.c
|
||||
OBJ = alaw.o tosnd.o toalaw.o
|
||||
ALL = tosnd toalaw
|
||||
|
||||
all: alaw.o
|
||||
prog: tosnd toalaw
|
||||
|
||||
toalaw: toalaw.o
|
||||
${CCU} ${LDFLAGS} -o $@ toalaw.o ${LIBS}
|
||||
tosnd: tosnd.o
|
||||
${CCU} ${LDFLAGS} -o $@ tosnd.o ${LIBS}
|
||||
toalaw.o: toalaw.c
|
||||
${CCU} ${NCFLAGS} -c toalaw.c
|
||||
tosnd.o: tosnd.c
|
||||
${CCU} ${NCFLAGS} -c tosnd.c
|
||||
|
||||
lib:
|
||||
|
||||
install: all
|
||||
@sh ../iftrue.sh "-d $(SYS)" "cd $(SYS); make"
|
||||
|
||||
update: all
|
||||
@sh ../iftrue.sh "-d $(SYS)" "cd $(SYS); make update"
|
||||
|
||||
indent:
|
||||
../indent.sh $(SOURCES)
|
||||
|
||||
clean:
|
||||
rm -f $(ALL) $(OBJ)
|
||||
@sh ../iftrue.sh "-d $(SYS)" "cd $(SYS); make clean"
|
||||
|
||||
depend: Makefile $(SOURCES)
|
||||
$(CC) -M $(DEFS) $(SOURCES) > .depend
|
||||
|
||||
load:
|
||||
insmod alaw.o
|
||||
|
||||
ifeq (.depend,$(wildcard .depend))
|
||||
include .depend
|
||||
endif
|
||||
TOPDIR=..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
||||
|
|
|
@ -0,0 +1,251 @@
|
|||
/*
|
||||
Code to extract Touch-Tones from PCM Sample Data
|
||||
sample data is assumed to be signed 8 bit, sampled at 8000 HZ
|
||||
written by Johannes Deisenhofer 14.6.95
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#undef DEBUG
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
/* Our timebase, sampling frequency for ISDN */
|
||||
#define BUFFREQU 8000
|
||||
|
||||
/* We check samples of this length */
|
||||
/* min 128, max. 512 */
|
||||
#define CHUNKLEN 512
|
||||
|
||||
/* Soviele aufeinanderfolgende DTMF-Toene muessen uebereinstimmen, mind. 1 */
|
||||
#define PROOF 1
|
||||
|
||||
/* Mindestpegel fuer Erkennung eines Touchtones */
|
||||
#define MINPEGEL 20000
|
||||
|
||||
/* Minimaler Faktor, um den der Pegel eines Tones hoeher als der naechste */
|
||||
/* sein muss */
|
||||
#define MINDIFF 30
|
||||
|
||||
#define DATA_IS_SIGNED
|
||||
|
||||
|
||||
#ifdef DATA_IS_SIGNED
|
||||
#define DATAFORM signed
|
||||
#define SUB 0x0
|
||||
#else
|
||||
#define DATAFORM unsigned
|
||||
#define SUB 0x80
|
||||
#endif
|
||||
|
||||
|
||||
/* Touch-Tone Frequencies in Hz */
|
||||
/* from CCC Hackerbibel #1 */
|
||||
|
||||
int frequencies[] =
|
||||
{
|
||||
1209, 1336, 1477 , /* Rows */
|
||||
697 , /* 1 2 3 */
|
||||
770 , /* 4 5 6 */
|
||||
852 , /* 7 8 9 */
|
||||
941 /* * 0 # */
|
||||
};
|
||||
|
||||
/* Key mapping */
|
||||
static char taste[] =
|
||||
{ '1' , '2' , '3' ,
|
||||
'4' , '5' , '6' ,
|
||||
'7' , '8' , '9' ,
|
||||
'*' , '0' , '#' };
|
||||
|
||||
|
||||
/* sin/cos table, calculated for max.chunksize 512 */
|
||||
extern signed char dtmfpre[7][512*2];
|
||||
|
||||
#ifdef PRECALC
|
||||
/* initialize sine-table */
|
||||
int fillpre(void)
|
||||
{
|
||||
int k,x;
|
||||
for(k=0;k<7;k++)
|
||||
{
|
||||
char* cmpr=dtmfpre[k];
|
||||
for(x=0;x<CHUNKLEN;x++)
|
||||
{
|
||||
double rad= (double)x*frequencies[k]/BUFFREQU*2*M_PI;
|
||||
/* Sinus und Cosinus sind aufeinanderfolgend abgespeichert */
|
||||
*(cmpr++) = 127*sin(rad);
|
||||
*(cmpr++) = 127*cos(rad);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* generate sine-table for inclusion in c-code*/
|
||||
int generatepre(void)
|
||||
{
|
||||
int k,x;
|
||||
printf("{ ");
|
||||
for(k=0;k<7;k++)
|
||||
{
|
||||
char* cmpr=dtmfpre[k];
|
||||
printf(" {");
|
||||
for(x=0;x<CHUNKLEN;x++)
|
||||
{
|
||||
double rad= (double)x*frequencies[k]/BUFFREQU*2*M_PI;
|
||||
if (x%8==0) printf("\n ");
|
||||
/* Sinus und Cosinus sind aufeinanderfolgend abgespeichert */
|
||||
printf("%4d,",*(cmpr++) = 127*sin(rad));
|
||||
printf("%4d,",*(cmpr++) = 127*cos(rad));
|
||||
}
|
||||
printf("\n} , ");
|
||||
}
|
||||
printf(" }; ");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* calculate fourier-coefficient (sort of) from buffer buf
|
||||
/* at frequency with index number frequ_idx */
|
||||
int fk(DATAFORM char* buf, int frequ_idx, int len )
|
||||
{
|
||||
int koeff=0,koeff2=0,k;
|
||||
char* compare = dtmfpre[frequ_idx];
|
||||
|
||||
for (k=0;k<len;k+=8)
|
||||
{
|
||||
|
||||
register int it;
|
||||
it=(*buf++)-SUB;
|
||||
koeff +=it * (*compare++);
|
||||
koeff2+=it * (*compare++);
|
||||
it=(*buf++)-SUB;
|
||||
koeff +=it * (*compare++);
|
||||
koeff2+=it * (*compare++);
|
||||
it=(*buf++)-SUB;
|
||||
koeff +=it * (*compare++);
|
||||
koeff2+=it * (*compare++);
|
||||
it=(*buf++)-SUB;
|
||||
koeff +=it * (*compare++);
|
||||
koeff2+=it * (*compare++);
|
||||
it=(*buf++)-SUB;
|
||||
koeff +=it * (*compare++);
|
||||
koeff2+=it * (*compare++);
|
||||
it=(*buf++)-SUB;
|
||||
koeff +=it * (*compare++);
|
||||
koeff2+=it * (*compare++);
|
||||
it=(*buf++)-SUB;
|
||||
koeff +=it * (*compare++);
|
||||
koeff2+=it * (*compare++);
|
||||
it=(*buf++)-SUB;
|
||||
koeff +=it * (*compare++);
|
||||
koeff2+=it * (*compare++);
|
||||
}
|
||||
koeff/=len;
|
||||
koeff2/=len;
|
||||
/* Diese Wurzel muss noch raus! */
|
||||
return (koeff*koeff+koeff2*koeff2)/8;
|
||||
}
|
||||
|
||||
struct st { int num; int val; };
|
||||
|
||||
void swap(struct st* s1, struct st *s2)
|
||||
{
|
||||
struct st stx;
|
||||
if (s1->val<s2->val)
|
||||
{
|
||||
stx = *s2;
|
||||
*s2=*s1;
|
||||
*s1=stx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int checkchunk(char* buf, int len)
|
||||
{
|
||||
int row,col,k,valid;
|
||||
struct st tbl[7];
|
||||
for (k= 0; k<7;k++)
|
||||
{
|
||||
tbl[k].num = k;
|
||||
tbl[k].val = fk(buf,k,len);
|
||||
#ifdef DEBUG
|
||||
/* If you want to play with the heuristics below, you probably */
|
||||
/* need to know the koefficients. Uncomment this */
|
||||
fprintf(stderr,"%6d ",tbl[k].val);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Hard-coded bubble-Sort */
|
||||
/* First the rows */
|
||||
swap(tbl,tbl+1);
|
||||
swap(tbl+1,tbl+2);
|
||||
swap(tbl,tbl+1);
|
||||
|
||||
/* Then columns */
|
||||
swap(tbl+3,tbl+4);
|
||||
swap(tbl+4,tbl+5);
|
||||
swap(tbl+5,tbl+6);
|
||||
swap(tbl+3,tbl+4);
|
||||
swap(tbl+4,tbl+5);
|
||||
swap(tbl+3,tbl+4);
|
||||
|
||||
/* Highest Coeff. is row or col */
|
||||
row=tbl[0].num;
|
||||
col=tbl[3].num-3;
|
||||
|
||||
/* Diese (heuristische) Regel bestimmt, ob es sich um einen */
|
||||
/* DTMF-Ton handelt oder nicht. Abhaengig vom Pegel der Toene */
|
||||
/* Und der gewuenschten Erkennungssicherheit */
|
||||
|
||||
valid = (tbl[0].val>tbl[1].val*MINDIFF)
|
||||
&& (tbl[3].val>tbl[4].val*MINDIFF)
|
||||
&& (tbl[0].val>MINPEGEL)
|
||||
&& (tbl[3].val>MINPEGEL);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,"Taste: %c\n",valid?taste[row+col*3]:'?');
|
||||
#endif
|
||||
|
||||
if (!valid) return -1;
|
||||
else return row+col*3;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Main-Routine: von stdin lesen und auf DTMF testen,
|
||||
Erkannte Tasten nach stderr
|
||||
*/
|
||||
|
||||
char buffer[CHUNKLEN];
|
||||
|
||||
int main(int argc, char**argv)
|
||||
{
|
||||
int val, l1val=-1,same=0;
|
||||
int inbuf;
|
||||
int buflen;
|
||||
int count=0;
|
||||
do {
|
||||
/* Fill input buffer */
|
||||
inbuf=0;
|
||||
do {
|
||||
buflen=fread(buffer,1,sizeof(buffer)-inbuf,stdin);
|
||||
inbuf+=buflen;
|
||||
} while (!feof(stdin) && inbuf < sizeof(buffer) );
|
||||
if (inbuf>=CHUNKLEN )
|
||||
{
|
||||
val=checkchunk(buffer,CHUNKLEN);
|
||||
if (val==l1val ) same++;
|
||||
else same=0;
|
||||
if (same==(PROOF-1) && l1val!=-1)
|
||||
{
|
||||
fprintf(stderr,"Taste %c\n",taste[l1val]);
|
||||
}
|
||||
l1val=val;
|
||||
}
|
||||
} while(!feof(stdin));
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,459 @@
|
|||
signed char dtmfpre[7][512*2]
|
||||
=
|
||||
{ {
|
||||
0, 127, 103, 73, 120, -40, 36,-121, -77,-100,-126, 4, -70, 105, 45, 118,
|
||||
122, 32, 97, -81, -8,-126,-108, -66,-117, 49, -27, 123, 84, 94, 126, -13,
|
||||
62,-110, -53,-115,-124, -23, -91, 87, 17, 125, 112, 58, 113, -57, 19,-125,
|
||||
-90, -88,-125, 22, -54, 114, 61, 111, 126, 14, 85, -94, -26,-124,-116, -50,
|
||||
-108, 65, -10, 126, 96, 82, 123, -31, 46,-118, -69,-106,-126, -5, -78, 99,
|
||||
35, 121, 119, 42, 104, -72, 1,-126,-102, -74,-120, 39, -37, 121, 76, 101,
|
||||
126, -3, 71,-105, -43,-119,-122, -33, -98, 80, 7, 126, 107, 67, 117, -48,
|
||||
29,-123, -83, -95,-126, 12, -63, 109, 52, 115, 124, 24, 92, -86, -16,-125,
|
||||
-112, -59,-113, 56, -20, 125, 90, 89, 125, -21, 55,-114, -60,-111,-125, -16,
|
||||
-86, 93, 25, 124, 115, 51, 109, -64, 11,-126, -96, -83,-123, 29, -47, 117,
|
||||
68, 107, 126, 7, 79, -98, -34,-122,-119, -43,-104, 71, -2, 126, 101, 76,
|
||||
121, -38, 39,-120, -75,-102,-126, 1, -72, 104, 42, 119, 122, 34, 99, -79,
|
||||
-6,-126,-106, -68,-118, 46, -30, 123, 82, 96, 126, -10, 64,-109, -51,-116,
|
||||
-124, -26, -93, 85, 15, 126, 111, 60, 114, -55, 21,-125, -89, -90,-125, 19,
|
||||
-56, 113, 59, 112, 125, 17, 87, -92, -24,-124,-115, -52,-110, 63, -12, 126,
|
||||
95, 83, 123, -28, 48,-117, -66,-107,-126, -8, -80, 98, 32, 122, 118, 44,
|
||||
105, -70, 3,-126,-100, -77,-121, 37, -40, 120, 74, 102, 126, 0, 73,-103,
|
||||
-41,-120,-121, -36,-100, 77, 5, 126, 106, 69, 118, -45, 31,-122, -81, -97,
|
||||
-126, 9, -65, 108, 49, 116, 124, 27, 94, -84, -14,-126,-110, -62,-114, 53,
|
||||
-23, 124, 88, 91, 125, -18, 58,-112, -58,-112,-125, -18, -88, 91, 22, 124,
|
||||
114, 54, 110, -61, 14,-126, -94, -84,-124, 27, -49, 116, 65, 108, 126, 9,
|
||||
81, -97, -31,-122,-118, -45,-106, 69, -5, 126, 100, 78, 121, -36, 41,-119,
|
||||
-73,-103,-126, 0, -74, 102, 40, 120, 121, 37, 101, -76, -3,-126,-105, -70,
|
||||
-118, 44, -33, 122, 80, 98, 126, -8, 67,-107, -48,-117,-123, -28, -95, 83,
|
||||
12, 126, 110, 63, 115, -52, 24,-124, -87, -92,-125, 17, -59, 112, 56, 113,
|
||||
125, 19, 89, -90, -21,-125,-114, -55,-111, 60, -15, 126, 93, 85, 124, -26,
|
||||
51,-116, -64,-109,-126, -10, -82, 96, 30, 123, 117, 47, 106, -68, 6,-126,
|
||||
-99, -79,-122, 34, -42, 119, 72, 104, 126, 1, 75,-102, -39,-120,-120, -38,
|
||||
-101, 75, 2, 126, 104, 71, 119, -43, 34,-122, -79, -99,-126, 6, -68, 107,
|
||||
47, 117, 123, 29, 96, -82, -11,-126,-109, -64,-116, 51, -25, 124, 86, 93,
|
||||
125, -15, 60,-111, -55,-114,-125, -21, -90, 89, 20, 125, 113, 56, 112, -59,
|
||||
16,-125, -92, -86,-124, 24, -52, 115, 63, 109, 126, 12, 83, -95, -29,-123,
|
||||
-117, -48,-107, 67, -7, 126, 98, 80, 122, -33, 44,-119, -71,-105,-126, -3,
|
||||
-76, 101, 37, 121, 120, 39, 102, -74, -1,-126,-103, -72,-119, 42, -35, 121,
|
||||
78, 99, 126, -5, 69,-106, -46,-118,-123, -31, -97, 81, 10, 126, 108, 65,
|
||||
116, -50, 26,-124, -85, -94,-126, 14, -61, 111, 54, 114, 125, 22, 90, -88,
|
||||
-19,-125,-113, -57,-112, 58, -17, 125, 91, 87, 124, -23, 53,-115, -62,-110,
|
||||
-126, -13, -84, 94, 27, 123, 116, 49, 108, -66, 9,-126, -97, -81,-122, 32,
|
||||
-45, 118, 70, 105, 126, 4, 77,-100, -36,-121,-120, -41,-103, 73, 0, 126,
|
||||
103, 74, 120, -40, 36,-121, -77,-100,-126, 4, -70, 105, 45, 118, 122, 32,
|
||||
97, -80, -8,-126,-108, -66,-117, 49, -28, 123, 84, 94, 126, -13, 62,-110,
|
||||
-53,-115,-124, -23, -91, 87, 17, 125, 112, 58, 113, -57, 19,-125, -90, -88,
|
||||
-125, 22, -54, 114, 61, 111, 126, 14, 85, -93, -26,-124,-116, -50,-108, 65,
|
||||
-10, 126, 96, 82, 123, -31, 46,-118, -69,-106,-126, -5, -78, 99, 35, 121,
|
||||
119, 42, 104, -72, 1,-126,-102, -75,-120, 39, -38, 121, 76, 101, 126, -3,
|
||||
71,-105, -43,-119,-122, -33, -98, 79, 7, 126, 107, 67, 117, -48, 29,-123,
|
||||
-83, -95,-126, 12, -63, 109, 52, 115, 124, 24, 92, -86, -16,-125,-112, -59,
|
||||
-113, 56, -20, 125, 89, 89, 125, -20, 55,-114, -60,-111,-125, -16, -86, 93,
|
||||
25, 124, 115, 51, 109, -64, 11,-126, -96, -83,-123, 29, -47, 117, 67, 107,
|
||||
126, 7, 79, -98, -34,-122,-119, -43,-104, 71, -2, 126, 101, 76, 121, -38,
|
||||
39,-120, -75,-102,-126, 1, -72, 104, 42, 119, 122, 34, 99, -78, -6,-126,
|
||||
-106, -68,-118, 46, -30, 123, 82, 96, 126, -10, 64,-109, -50,-116,-124, -26,
|
||||
-93, 85, 15, 126, 111, 61, 114, -55, 21,-125, -89, -90,-125, 19, -57, 113,
|
||||
59, 112, 125, 17, 87, -92, -24,-124,-115, -52,-110, 63, -12, 126, 95, 84,
|
||||
123, -28, 48,-117, -66,-107,-126, -8, -80, 98, 32, 122, 118, 44, 105, -70,
|
||||
3,-126,-100, -77,-121, 37, -40, 120, 74, 102, 126, 0, 73,-103, -41,-120,
|
||||
-121, -36,-100, 77, 4, 126, 106, 69, 118, -45, 31,-122, -81, -97,-126, 9,
|
||||
-66, 108, 49, 116, 123, 27, 94, -84, -13,-126,-110, -62,-114, 53, -23, 124,
|
||||
88, 91, 125, -18, 58,-112, -57,-113,-125, -18, -88, 91, 22, 124, 114, 54,
|
||||
110, -61, 14,-126, -94, -85,-124, 27, -50, 116, 65, 108, 126, 9, 81, -97,
|
||||
-31,-123,-118, -45,-106, 69, -5, 126, 100, 78, 121, -35, 41,-119, -73,-103,
|
||||
-126, 0, -74, 102, 40, 120, 121, 37, 101, -76, -3,-126,-105, -70,-118, 44,
|
||||
-33, 122, 80, 98, 126, -8, 67,-107, -48,-117,-123, -28, -95, 83, 12, 126,
|
||||
110, 63, 115, -52, 24,-124, -87, -92,-125, 17, -59, 112, 56, 113, 125, 19,
|
||||
} , {
|
||||
0, 127, 110, 63, 109, -63, 0,-126,-110, -62,-109, 64, 1, 126, 110, 61,
|
||||
108, -65, -2,-126,-111, -61,-108, 66, 3, 126, 111, 60, 108, -66, -3,-126,
|
||||
-112, -59,-107, 67, 4, 126, 112, 59, 107, -68, -5,-126,-112, -58,-106, 68,
|
||||
6, 126, 113, 57, 106, -69, -7,-126,-113, -56,-105, 70, 7, 126, 113, 56,
|
||||
105, -70, -8,-126,-114, -55,-105, 71, 9, 126, 114, 54, 104, -72, -10,-126,
|
||||
-114, -54,-104, 72, 11, 126, 115, 53, 103, -73, -11,-126,-115, -52,-103, 74,
|
||||
12, 126, 115, 51, 102, -74, -13,-126,-116, -51,-102, 75, 14, 126, 116, 50,
|
||||
101, -75, -15,-126,-116, -49,-101, 76, 15, 125, 117, 48, 100, -77, -16,-125,
|
||||
-117, -48,-100, 77, 17, 125, 117, 47, 99, -78, -18,-125,-118, -46, -99, 79,
|
||||
19, 125, 118, 46, 98, -79, -19,-125,-118, -45, -98, 80, 20, 125, 118, 44,
|
||||
97, -80, -21,-125,-119, -43, -97, 81, 22, 125, 119, 43, 96, -82, -23,-124,
|
||||
-119, -42, -96, 82, 23, 124, 120, 41, 95, -83, -24,-124,-120, -40, -95, 83,
|
||||
25, 124, 120, 40, 94, -84, -26,-124,-120, -39, -94, 85, 26, 124, 121, 38,
|
||||
93, -85, -27,-123,-121, -37, -93, 86, 28, 123, 121, 36, 92, -86, -29,-123,
|
||||
-121, -36, -92, 87, 30, 123, 121, 35, 91, -88, -30,-123,-122, -34, -90, 88,
|
||||
31, 123, 122, 33, 90, -89, -32,-122,-122, -33, -89, 89, 33, 122, 122, 32,
|
||||
89, -90, -33,-122,-123, -31, -88, 90, 34, 122, 123, 30, 88, -91, -35,-121,
|
||||
-123, -30, -87, 92, 36, 121, 123, 29, 86, -92, -36,-121,-123, -28, -86, 93,
|
||||
37, 121, 123, 27, 85, -93, -38,-121,-124, -26, -85, 94, 39, 120, 124, 26,
|
||||
84, -94, -40,-120,-124, -25, -83, 95, 40, 120, 124, 24, 83, -95, -41,-120,
|
||||
-124, -23, -82, 96, 42, 119, 124, 23, 82, -96, -43,-119,-125, -22, -81, 97,
|
||||
43, 119, 125, 21, 80, -97, -44,-118,-125, -20, -80, 98, 45, 118, 125, 19,
|
||||
79, -98, -46,-118,-125, -19, -79, 99, 46, 118, 125, 18, 78, -99, -47,-117,
|
||||
-125, -17, -77, 100, 48, 117, 125, 16, 77,-100, -48,-117,-125, -15, -76, 101,
|
||||
49, 116, 126, 15, 75,-101, -50,-116,-126, -14, -75, 102, 51, 116, 126, 13,
|
||||
74,-102, -51,-115,-126, -12, -74, 103, 52, 115, 126, 11, 73,-103, -53,-115,
|
||||
-126, -11, -72, 104, 54, 114, 126, 10, 72,-104, -54,-114,-126, -9, -71, 105,
|
||||
55, 114, 126, 8, 70,-105, -56,-113,-126, -7, -70, 105, 56, 113, 126, 7,
|
||||
69,-106, -57,-113,-126, -6, -68, 106, 58, 112, 126, 5, 68,-107, -59,-112,
|
||||
-126, -4, -67, 107, 59, 112, 126, 3, 66,-108, -60,-111,-126, -3, -66, 108,
|
||||
61, 111, 126, 2, 65,-108, -61,-110,-126, -1, -64, 109, 62, 110, 126, 0,
|
||||
63,-109, -63,-110,-127, 0, -63, 110, 63, 109, 126, 0, 62,-110, -64,-109,
|
||||
-126, 1, -61, 110, 65, 108, 126, -2, 61,-111, -66,-108,-126, 3, -60, 111,
|
||||
66, 108, 126, -3, 59,-112, -67,-107,-126, 4, -59, 112, 68, 107, 126, -5,
|
||||
58,-112, -68,-106,-126, 6, -57, 113, 69, 106, 126, -7, 56,-113, -70,-105,
|
||||
-126, 7, -56, 113, 70, 105, 126, -8, 55,-114, -71,-105,-126, 9, -54, 114,
|
||||
72, 104, 126, -10, 54,-114, -72,-104,-126, 11, -53, 115, 73, 103, 126, -11,
|
||||
52,-115, -74,-103,-126, 12, -51, 115, 74, 102, 126, -13, 51,-116, -75,-102,
|
||||
-126, 14, -50, 116, 75, 101, 126, -15, 49,-116, -76,-101,-125, 15, -48, 117,
|
||||
77, 100, 125, -16, 48,-117, -77,-100,-125, 17, -47, 117, 78, 99, 125, -18,
|
||||
46,-118, -79, -99,-125, 19, -46, 118, 79, 98, 125, -19, 45,-118, -80, -98,
|
||||
-125, 20, -44, 118, 80, 97, 125, -21, 43,-119, -81, -97,-125, 22, -43, 119,
|
||||
82, 96, 124, -23, 42,-119, -82, -96,-124, 23, -41, 120, 83, 95, 124, -24,
|
||||
40,-120, -83, -95,-124, 25, -40, 120, 84, 94, 124, -26, 39,-120, -85, -94,
|
||||
-124, 26, -38, 121, 85, 93, 123, -27, 37,-121, -86, -93,-123, 28, -36, 121,
|
||||
86, 92, 123, -29, 36,-121, -87, -92,-123, 30, -35, 121, 88, 91, 123, -30,
|
||||
34,-122, -88, -90,-123, 31, -33, 122, 89, 90, 122, -32, 33,-122, -89, -89,
|
||||
-122, 33, -32, 122, 90, 89, 122, -33, 31,-123, -90, -88,-122, 34, -30, 123,
|
||||
91, 88, 121, -35, 30,-123, -92, -87,-121, 36, -29, 123, 92, 86, 121, -36,
|
||||
28,-123, -93, -86,-121, 37, -27, 123, 93, 85, 121, -38, 26,-124, -94, -85,
|
||||
-120, 39, -26, 124, 94, 84, 120, -40, 25,-124, -95, -83,-120, 40, -24, 124,
|
||||
95, 83, 120, -41, 23,-124, -96, -82,-119, 42, -23, 124, 96, 82, 119, -43,
|
||||
22,-125, -97, -81,-119, 43, -21, 125, 97, 80, 118, -44, 20,-125, -98, -80,
|
||||
-118, 45, -19, 125, 98, 79, 118, -46, 19,-125, -99, -79,-118, 46, -18, 125,
|
||||
99, 78, 117, -47, 17,-125,-100, -77,-117, 48, -16, 125, 100, 77, 117, -48,
|
||||
15,-125,-101, -76,-116, 49, -15, 126, 101, 75, 116, -50, 14,-126,-102, -75,
|
||||
-116, 51, -13, 126, 102, 74, 115, -51, 12,-126,-103, -74,-115, 52, -11, 126,
|
||||
103, 73, 115, -53, 11,-126,-104, -72,-114, 54, -10, 126, 104, 72, 114, -54,
|
||||
9,-126,-105, -71,-114, 55, -8, 126, 105, 70, 113, -56, 7,-126,-105, -70,
|
||||
-113, 56, -7, 126, 106, 69, 113, -57, 6,-126,-106, -68,-112, 58, -5, 126,
|
||||
107, 68, 112, -59, 4,-126,-107, -67,-112, 59, -3, 126, 108, 66, 111, -60,
|
||||
3,-126,-108, -66,-111, 61, -2, 126, 108, 65, 110, -61, 1,-126,-109, -64,
|
||||
-110, 62, 0, 126, 109, 63, 110, -63, 0,-127,-110, -63,-109, 63, 0, 126,
|
||||
110, 62, 109, -64, -1,-126,-110, -61,-108, 65, 2, 126, 111, 61, 108, -66,
|
||||
} , {
|
||||
0, 127, 116, 50, 92, -86, -42,-119,-126, -9, -58, 112, 79, 98, 122, -33,
|
||||
18,-125,-107, -66,-104, 72, 24, 124, 124, 27, 74,-102, -64,-109,-126, 15,
|
||||
-36, 121, 97, 81, 113, -56, -6,-126,-118, -44, -88, 90, 48, 117, 126, 2,
|
||||
53,-115, -84, -94,-120, 39, -12, 126, 111, 61, 100, -77, -30,-123,-125, -21,
|
||||
-69, 106, 69, 106, 125, -21, 30,-123,-101, -76,-110, 61, 12, 126, 120, 38,
|
||||
83, -95, -53,-115,-126, 3, -47, 117, 88, 90, 118, -45, 5,-126,-114, -55,
|
||||
-96, 82, 36, 121, 126, 14, 64,-109, -74,-102,-123, 27, -23, 124, 104, 71,
|
||||
107, -67, -18,-125,-122, -32, -79, 99, 59, 112, 126, -9, 41,-119, -93, -86,
|
||||
-116, 51, 0, 126, 116, 50, 92, -86, -42,-119,-126, -8, -58, 112, 79, 98,
|
||||
122, -33, 17,-125,-108, -66,-104, 72, 24, 124, 124, 26, 74,-103, -64,-109,
|
||||
-125, 15, -35, 121, 97, 81, 113, -56, -6,-126,-118, -44, -88, 91, 48, 117,
|
||||
126, 2, 52,-115, -84, -94,-120, 39, -11, 126, 111, 61, 100, -77, -31,-123,
|
||||
-125, -20, -68, 106, 70, 105, 125, -22, 29,-123,-101, -76,-110, 62, 13, 126,
|
||||
121, 38, 83, -95, -54,-114,-126, 3, -47, 117, 89, 90, 118, -45, 5,-126,
|
||||
-114, -55, -96, 82, 37, 121, 126, 14, 63,-109, -75,-102,-123, 28, -23, 124,
|
||||
105, 71, 107, -67, -19,-125,-122, -32, -78, 99, 59, 112, 126, -10, 41,-120,
|
||||
-93, -85,-116, 51, 0, 126, 116, 49, 92, -87, -43,-119,-126, -8, -58, 112,
|
||||
80, 98, 122, -34, 17,-125,-108, -66,-103, 73, 25, 124, 124, 26, 73,-103,
|
||||
-65,-108,-125, 16, -35, 122, 97, 81, 113, -57, -7,-126,-119, -43, -87, 91,
|
||||
48, 117, 126, 1, 52,-115, -85, -94,-120, 40, -11, 126, 111, 60, 100, -78,
|
||||
-31,-123,-125, -20, -68, 106, 70, 105, 124, -22, 29,-123,-101, -76,-110, 62,
|
||||
13, 126, 121, 38, 83, -95, -54,-114,-126, 4, -46, 118, 89, 89, 118, -46,
|
||||
4,-126,-114, -55, -96, 82, 37, 121, 126, 13, 63,-110, -75,-101,-123, 28,
|
||||
-23, 124, 105, 70, 107, -68, -19,-125,-122, -31, -78, 99, 60, 111, 126, -10,
|
||||
40,-120, -94, -85,-115, 52, 1, 126, 117, 49, 91, -87, -43,-119,-126, -7,
|
||||
-57, 113, 80, 98, 122, -34, 16,-125,-108, -65,-103, 73, 25, 124, 124, 25,
|
||||
73,-103, -65,-108,-125, 16, -34, 122, 98, 80, 113, -57, -7,-126,-119, -43,
|
||||
-87, 92, 49, 116, 126, 1, 51,-115, -85, -93,-120, 40, -10, 126, 111, 60,
|
||||
99, -78, -32,-122,-125, -19, -68, 107, 71, 105, 124, -23, 28,-123,-101, -75,
|
||||
-110, 63, 14, 126, 121, 37, 82, -96, -55,-114,-126, 4, -46, 118, 90, 89,
|
||||
118, -46, 4,-126,-114, -54, -95, 83, 38, 121, 126, 13, 62,-110, -76,-101,
|
||||
-123, 29, -22, 124, 105, 70, 106, -68, -20,-125,-123, -31, -77, 100, 60, 111,
|
||||
126, -11, 40,-120, -94, -85,-115, 52, 1, 126, 117, 48, 91, -87, -44,-119,
|
||||
-126, -7, -57, 113, 81, 97, 121, -35, 16,-125,-108, -65,-103, 73, 26, 124,
|
||||
124, 25, 72,-103, -66,-108,-125, 17, -34, 122, 98, 80, 112, -58, -8,-126,
|
||||
-119, -43, -87, 92, 49, 116, 126, 0, 51,-116, -85, -93,-120, 41, -10, 126,
|
||||
112, 59, 99, -78, -32,-122,-125, -19, -67, 107, 71, 104, 124, -23, 28,-123,
|
||||
-102, -75,-109, 63, 14, 126, 121, 37, 82, -96, -55,-114,-126, 5, -45, 118,
|
||||
90, 89, 117, -47, 3,-126,-114, -54, -95, 83, 38, 120, 126, 12, 62,-110,
|
||||
-76,-101,-123, 29, -22, 125, 105, 70, 106, -69, -20,-125,-123, -31, -77, 100,
|
||||
61, 111, 126, -11, 39,-120, -94, -84,-115, 52, 2, 126, 117, 48, 91, -88,
|
||||
-44,-118,-126, -6, -56, 113, 81, 97, 121, -35, 15,-126,-109, -64,-103, 74,
|
||||
26, 124, 124, 24, 72,-104, -66,-108,-125, 17, -33, 122, 98, 79, 112, -58,
|
||||
-8,-126,-119, -42, -86, 92, 50, 116, 126, 0, 51,-116, -86, -93,-119, 41,
|
||||
-9, 126, 112, 59, 99, -79, -33,-122,-125, -18, -67, 107, 71, 104, 124, -24,
|
||||
27,-123,-102, -74,-109, 64, 15, 126, 121, 36, 82, -96, -56,-113,-126, 5,
|
||||
-45, 118, 90, 88, 117, -47, 3,-126,-115, -53, -95, 84, 39, 120, 126, 12,
|
||||
61,-110, -76,-101,-123, 30, -21, 125, 106, 69, 106, -69, -21,-125,-123, -30,
|
||||
-77, 100, 61, 111, 126, -12, 39,-120, -94, -84,-115, 53, 2, 126, 117, 47,
|
||||
90, -88, -44,-118,-126, -6, -56, 113, 81, 97, 121, -36, 15,-126,-109, -64,
|
||||
-102, 74, 27, 124, 124, 24, 72,-104, -67,-107,-125, 18, -33, 122, 99, 79,
|
||||
112, -59, -9,-126,-119, -42, -86, 93, 50, 116, 126, 0, 50,-116, -86, -92,
|
||||
-119, 42, -9, 126, 112, 58, 98, -79, -33,-122,-125, -18, -66, 107, 72, 104,
|
||||
124, -24, 27,-124,-102, -74,-109, 64, 15, 126, 121, 36, 81, -97, -56,-113,
|
||||
-126, 6, -44, 118, 91, 88, 117, -48, 2,-126,-115, -53, -94, 84, 39, 120,
|
||||
126, 11, 61,-111, -77,-100,-123, 30, -21, 125, 106, 69, 106, -69, -21,-125,
|
||||
-123, -30, -76, 101, 62, 110, 126, -12, 38,-120, -95, -83,-114, 53, 3, 126,
|
||||
117, 47, 90, -89, -45,-118,-126, -5, -55, 114, 82, 96, 121, -36, 14,-126,
|
||||
-109, -63,-102, 75, 27, 123, 124, 23, 71,-104, -67,-107,-125, 18, -32, 122,
|
||||
99, 79, 112, -59, -9,-126,-119, -41, -86, 93, 51, 116, 126, 0, 50,-116,
|
||||
-86, -92,-119, 42, -8, 126, 112, 58, 98, -80, -33,-122,-125, -17, -66, 108,
|
||||
72, 104, 124, -25, 26,-124,-103, -74,-109, 64, 16, 125, 121, 35, 81, -97,
|
||||
-56,-113,-126, 6, -44, 119, 91, 88, 117, -48, 2,-126,-115, -52, -94, 84,
|
||||
40, 120, 126, 11, 61,-111, -77,-100,-123, 31, -20, 125, 106, 68, 105, -70,
|
||||
} , {
|
||||
0, 127, 66, 108, 112, 58, 126, -9, 103, -73, 49,-116, -18,-125, -80, -97,
|
||||
-120, -41,-124, 27, -91, 87, -32, 122, 35, 121, 94, 85, 124, 23, 118, -44,
|
||||
78, -99, 15,-126, -52,-115,-105, -71,-126, -5,-111, 60, -63, 110, 3, 126,
|
||||
68, 106, 114, 55, 126, -12, 101, -76, 47,-117, -21,-125, -83, -95,-120, -38,
|
||||
-123, 30, -89, 89, -29, 123, 38, 120, 96, 83, 125, 20, 117, -47, 76,-101,
|
||||
11,-126, -55,-114,-106, -68,-126, -2,-109, 63, -60, 111, 6, 126, 71, 105,
|
||||
115, 52, 126, -15, 99, -78, 44,-119, -24,-124, -85, -93,-121, -35,-122, 33,
|
||||
-87, 92, -26, 124, 41, 119, 98, 80, 125, 17, 116, -50, 73,-103, 8,-126,
|
||||
-58,-112,-108, -65,-126, 0,-108, 66, -58, 112, 9, 126, 73, 103, 116, 49,
|
||||
125, -18, 97, -81, 41,-120, -27,-124, -87, -91,-122, -32,-121, 36, -85, 94,
|
||||
-23, 124, 44, 118, 99, 78, 126, 14, 115, -52, 70,-105, 5,-126, -61,-111,
|
||||
-110, -63,-126, 3,-106, 68, -55, 114, 12, 126, 76, 101, 118, 46, 125, -21,
|
||||
95, -83, 38,-121, -30,-123, -90, -89,-123, -29,-120, 38, -82, 96, -20, 125,
|
||||
47, 117, 101, 75, 126, 11, 114, -55, 68,-107, 2,-126, -63,-109,-111, -60,
|
||||
-126, 6,-104, 71, -52, 115, 15, 126, 78, 99, 119, 44, 124, -24, 93, -85,
|
||||
35,-121, -33,-122, -92, -87,-124, -26,-119, 41, -80, 98, -17, 125, 50, 116,
|
||||
103, 73, 126, 8, 112, -58, 65,-108, 0,-126, -66,-108,-113, -57,-126, 9,
|
||||
-103, 74, -49, 116, 18, 125, 81, 97, 120, 41, 124, -27, 91, -87, 32,-122,
|
||||
-36,-121, -94, -85,-124, -23,-118, 44, -78, 100, -14, 126, 53, 115, 105, 70,
|
||||
126, 5, 111, -61, 63,-110, -3,-126, -69,-106,-114, -55,-126, 12,-101, 76,
|
||||
-46, 118, 21, 125, 83, 95, 121, 38, 123, -30, 89, -90, 29,-123, -39,-120,
|
||||
-96, -82,-125, -20,-117, 47, -75, 101, -11, 126, 55, 114, 107, 68, 126, 2,
|
||||
109, -63, 60,-111, -6,-126, -71,-104,-115, -52,-126, 15, -99, 78, -43, 119,
|
||||
24, 124, 85, 93, 122, 35, 122, -33, 87, -92, 26,-124, -42,-119, -98, -80,
|
||||
-125, -17,-116, 50, -73, 103, -8, 126, 58, 112, 108, 65, 126, 0, 108, -66,
|
||||
57,-113, -9,-126, -74,-103,-116, -49,-125, 18, -97, 81, -40, 120, 27, 123,
|
||||
88, 91, 122, 32, 121, -36, 84, -94, 23,-124, -44,-118,-100, -77,-126, -14,
|
||||
-115, 53, -70, 105, -5, 126, 61, 111, 110, 62, 126, -3, 106, -69, 54,-114,
|
||||
-12,-126, -76,-101,-118, -46,-125, 21, -95, 83, -38, 121, 30, 123, 90, 89,
|
||||
123, 29, 120, -39, 82, -96, 20,-125, -47,-117,-102, -75,-126, -11,-113, 56,
|
||||
-68, 107, -2, 126, 64, 109, 111, 60, 126, -6, 104, -71, 52,-115, -15,-126,
|
||||
-79, -99,-119, -43,-124, 24, -93, 85, -35, 122, 33, 122, 92, 87, 124, 26,
|
||||
119, -42, 80, -98, 17,-125, -50,-116,-103, -73,-126, -8,-112, 58, -65, 108,
|
||||
0, 126, 66, 108, 113, 57, 126, -9, 102, -74, 49,-117, -18,-125, -81, -97,
|
||||
-120, -40,-123, 27, -91, 88, -32, 122, 36, 121, 94, 84, 124, 23, 118, -45,
|
||||
77,-100, 14,-126, -53,-115,-105, -70,-126, -5,-111, 61, -62, 110, 3, 126,
|
||||
69, 106, 114, 54, 126, -12, 101, -76, 46,-118, -21,-125, -83, -95,-121, -37,
|
||||
-123, 30, -89, 90, -29, 123, 39, 120, 96, 82, 125, 20, 117, -48, 75,-102,
|
||||
11,-126, -56,-113,-107, -67,-126, -2,-109, 64, -60, 111, 6, 126, 71, 104,
|
||||
115, 51, 125, -16, 99, -79, 43,-119, -24,-124, -86, -93,-122, -34,-122, 33,
|
||||
-86, 92, -26, 124, 42, 119, 98, 80, 125, 17, 116, -50, 72,-104, 8,-126,
|
||||
-59,-112,-108, -65,-126, 0,-107, 66, -57, 113, 10, 126, 74, 102, 117, 49,
|
||||
125, -19, 97, -81, 40,-120, -27,-123, -88, -91,-122, -31,-121, 36, -84, 94,
|
||||
-23, 124, 45, 118, 100, 77, 126, 14, 115, -53, 70,-105, 4,-126, -61,-110,
|
||||
-110, -62,-126, 4,-106, 69, -54, 114, 13, 126, 76, 101, 118, 46, 125, -22,
|
||||
95, -83, 37,-121, -31,-123, -90, -89,-123, -28,-120, 39, -82, 96, -19, 125,
|
||||
48, 117, 102, 75, 126, 10, 113, -56, 67,-107, 1,-126, -64,-109,-112, -59,
|
||||
-126, 7,-104, 72, -51, 115, 16, 125, 79, 99, 119, 43, 124, -25, 93, -86,
|
||||
34,-122, -33,-122, -92, -86,-124, -25,-119, 42, -79, 98, -16, 125, 51, 116,
|
||||
104, 72, 126, 7, 112, -59, 65,-109, -1,-126, -67,-107,-113, -57,-126, 10,
|
||||
-102, 74, -48, 117, 19, 125, 81, 97, 120, 40, 123, -28, 91, -88, 31,-122,
|
||||
-36,-121, -94, -84,-124, -22,-118, 45, -77, 100, -13, 126, 53, 114, 105, 70,
|
||||
126, 4, 110, -61, 62,-110, -4,-126, -69,-106,-114, -54,-126, 13,-100, 77,
|
||||
-46, 118, 22, 125, 84, 95, 121, 37, 123, -31, 88, -90, 28,-123, -39,-120,
|
||||
-96, -82,-125, -19,-117, 48, -75, 102, -10, 126, 56, 113, 107, 67, 126, 1,
|
||||
109, -64, 59,-112, -7,-126, -72,-104,-116, -51,-125, 16, -98, 79, -43, 119,
|
||||
25, 124, 86, 93, 122, 34, 122, -34, 86, -92, 25,-124, -42,-119, -98, -79,
|
||||
-125, -16,-116, 51, -72, 104, -7, 126, 59, 112, 109, 64, 126, -1, 107, -67,
|
||||
56,-113, -10,-126, -74,-102,-117, -48,-125, 19, -97, 81, -40, 120, 28, 123,
|
||||
88, 90, 123, 31, 121, -37, 84, -94, 22,-124, -45,-118,-100, -77,-126, -13,
|
||||
-114, 54, -69, 105, -4, 126, 62, 110, 110, 62, 126, -4, 106, -69, 54,-114,
|
||||
-13,-126, -77,-100,-118, -45,-124, 22, -94, 84, -37, 121, 31, 123, 90, 88,
|
||||
123, 28, 120, -40, 82, -96, 19,-125, -48,-117,-102, -74,-126, -10,-113, 56,
|
||||
-67, 107, -1, 126, 64, 109, 112, 59, 126, -7, 104, -72, 51,-116, -16,-125,
|
||||
} , {
|
||||
0, 127, 72, 104, 118, 44, 123, -30, 83, -95, 14,-126, -59,-112,-112, -58,
|
||||
-125, 15, -94, 84, -29, 123, 45, 118, 105, 71, 126, 0, 103, -73, 43,-119,
|
||||
-31,-123, -95, -83,-126, -13,-111, 60, -57, 113, 16, 125, 85, 93, 123, 28,
|
||||
118, -46, 70,-105, -1,-126, -73,-103,-119, -43,-122, 32, -82, 96, -12, 126,
|
||||
61, 111, 113, 56, 125, -17, 93, -86, 27,-123, -47,-117,-106, -69,-126, 2,
|
||||
-102, 74, -42, 119, 33, 122, 97, 81, 126, 11, 110, -62, 55,-114, -18,-125,
|
||||
-86, -92,-124, -26,-117, 48, -68, 106, 3, 126, 75, 102, 120, 41, 122, -34,
|
||||
80, -97, 10,-126, -62,-110,-114, -54,-125, 19, -91, 87, -25, 124, 49, 116,
|
||||
107, 68, 126, -4, 101, -76, 40,-120, -35,-121, -98, -80,-126, -9,-109, 63,
|
||||
-54, 114, 20, 125, 88, 91, 124, 24, 116, -50, 67,-107, -5,-126, -77,-100,
|
||||
-120, -39,-121, 36, -79, 99, -8, 126, 64, 109, 115, 53, 125, -21, 90, -89,
|
||||
23,-124, -51,-116,-108, -66,-126, 6,-100, 77, -38, 121, 37, 121, 99, 78,
|
||||
126, 7, 108, -65, 52,-115, -22,-124, -89, -89,-124, -22,-115, 52, -65, 108,
|
||||
7, 126, 78, 99, 121, 37, 121, -38, 77,-100, 6,-126, -66,-108,-116, -51,
|
||||
-124, 23, -89, 90, -21, 125, 53, 115, 109, 64, 126, -8, 99, -79, 36,-121,
|
||||
-39,-120,-100, -77,-126, -5,-107, 67, -50, 116, 24, 124, 91, 88, 125, 20,
|
||||
114, -54, 63,-109, -9,-126, -80, -98,-121, -35,-120, 40, -76, 101, -4, 126,
|
||||
68, 107, 116, 49, 124, -25, 87, -91, 19,-125, -54,-114,-110, -62,-126, 10,
|
||||
-97, 80, -34, 122, 41, 120, 102, 75, 126, 3, 106, -68, 48,-117, -26,-124,
|
||||
-92, -86,-125, -18,-114, 55, -62, 110, 11, 126, 81, 97, 122, 33, 119, -42,
|
||||
74,-102, 2,-126, -69,-106,-117, -47,-123, 27, -86, 93, -17, 125, 56, 113,
|
||||
111, 61, 126, -12, 96, -82, 32,-122, -43,-119,-103, -73,-126, -1,-105, 70,
|
||||
-46, 118, 28, 123, 93, 85, 125, 16, 113, -57, 60,-111, -13,-126, -83, -95,
|
||||
-123, -31,-119, 43, -73, 103, 0, 126, 71, 105, 118, 45, 123, -29, 84, -94,
|
||||
15,-125, -58,-112,-112, -59,-126, 14, -95, 83, -30, 123, 44, 118, 104, 72,
|
||||
127, 0, 104, -72, 44,-118, -30,-123, -95, -83,-126, -14,-112, 59, -58, 112,
|
||||
15, 125, 84, 94, 123, 29, 118, -45, 71,-105, 0,-126, -73,-103,-119, -43,
|
||||
-123, 31, -83, 95, -13, 126, 60, 111, 113, 57, 125, -16, 93, -85, 28,-123,
|
||||
-46,-118,-105, -70,-126, 1,-103, 73, -43, 119, 32, 122, 96, 82, 126, 12,
|
||||
111, -61, 56,-113, -17,-125, -86, -93,-123, -27,-117, 47, -69, 106, 2, 126,
|
||||
74, 102, 119, 42, 122, -33, 81, -97, 11,-126, -62,-110,-114, -55,-125, 18,
|
||||
-92, 86, -26, 124, 48, 117, 106, 68, 126, -3, 102, -75, 41,-120, -34,-122,
|
||||
-97, -80,-126, -10,-110, 62, -54, 114, 19, 125, 87, 91, 124, 25, 116, -49,
|
||||
68,-107, -4,-126, -76,-101,-120, -40,-121, 35, -80, 98, -9, 126, 63, 109,
|
||||
114, 54, 125, -20, 91, -88, 24,-124, -50,-116,-107, -67,-126, 5,-100, 77,
|
||||
-39, 120, 36, 121, 99, 79, 126, 8, 109, -64, 53,-115, -21,-125, -89, -90,
|
||||
-124, -23,-116, 51, -66, 108, 6, 126, 77, 100, 121, 38, 121, -37, 78, -99,
|
||||
7,-126, -65,-108,-115, -52,-124, 22, -89, 89, -22, 124, 52, 115, 108, 65,
|
||||
126, -7, 99, -78, 37,-121, -38,-121,-100, -77,-126, -6,-108, 66, -51, 116,
|
||||
23, 124, 90, 89, 125, 21, 115, -53, 64,-109, -8,-126, -79, -99,-121, -36,
|
||||
-120, 39, -77, 100, -5, 126, 67, 107, 116, 50, 124, -24, 88, -91, 20,-125,
|
||||
-54,-114,-109, -63,-126, 9, -98, 80, -35, 121, 40, 120, 101, 76, 126, 4,
|
||||
107, -68, 49,-116, -25,-124, -91, -87,-125, -19,-114, 54, -62, 110, 10, 126,
|
||||
80, 97, 122, 34, 120, -41, 75,-102, 3,-126, -68,-106,-117, -48,-124, 26,
|
||||
-86, 92, -18, 125, 55, 114, 110, 62, 126, -11, 97, -81, 33,-122, -42,-119,
|
||||
-102, -74,-126, -2,-106, 69, -47, 117, 27, 123, 93, 86, 125, 17, 113, -56,
|
||||
61,-111, -12,-126, -82, -96,-122, -32,-119, 43, -73, 103, -1, 126, 70, 105,
|
||||
118, 46, 123, -28, 85, -93, 16,-125, -57,-113,-111, -60,-126, 13, -95, 83,
|
||||
-31, 123, 43, 119, 103, 73, 126, 0, 105, -71, 45,-118, -29,-123, -94, -84,
|
||||
-125, -15,-112, 58, -59, 112, 14, 126, 83, 95, 123, 30, 118, -44, 72,-104,
|
||||
0,-127, -72,-104,-118, -44,-123, 30, -83, 95, -14, 126, 59, 112, 112, 58,
|
||||
125, -15, 94, -84, 29,-123, -45,-118,-105, -71,-126, 0,-103, 73, -43, 119,
|
||||
31, 123, 95, 83, 126, 13, 111, -60, 57,-113, -16,-125, -85, -93,-123, -28,
|
||||
-118, 46, -70, 105, 1, 126, 73, 103, 119, 43, 122, -32, 82, -96, 12,-126,
|
||||
-61,-111,-113, -56,-125, 17, -93, 86, -27, 123, 47, 117, 106, 69, 126, -2,
|
||||
102, -74, 42,-119, -33,-122, -97, -81,-126, -11,-110, 62, -55, 114, 18, 125,
|
||||
86, 92, 124, 26, 117, -48, 68,-106, -3,-126, -75,-102,-120, -41,-122, 34,
|
||||
-80, 97, -10, 126, 62, 110, 114, 54, 125, -19, 91, -87, 25,-124, -49,-116,
|
||||
-107, -68,-126, 4,-101, 76, -40, 120, 35, 121, 98, 80, 126, 9, 109, -63,
|
||||
54,-114, -20,-125, -88, -91,-124, -24,-116, 50, -67, 107, 5, 126, 77, 100,
|
||||
120, 39, 121, -36, 79, -99, 8,-126, -64,-109,-115, -53,-125, 21, -90, 89,
|
||||
-23, 124, 51, 116, 108, 66, 126, -6, 100, -77, 38,-121, -37,-121, -99, -78,
|
||||
-126, -7,-108, 65, -52, 115, 22, 124, 89, 89, 124, 22, 115, -52, 65,-108,
|
||||
-7,-126, -78, -99,-121, -37,-121, 38, -77, 100, -6, 126, 66, 108, 116, 51,
|
||||
} , {
|
||||
0, 127, 78, 99, 123, 29, 115, -53, 56,-113, -25,-124, -97, -81,-126, -3,
|
||||
-101, 75, -32, 122, 50, 116, 111, 60, 125, -22, 84, -94, 7,-126, -73,-103,
|
||||
-121, -36,-117, 47, -63, 110, 18, 125, 92, 86, 126, 10, 105, -70, 39,-120,
|
||||
-43,-119,-108, -66,-126, 15, -89, 90, -14, 126, 67, 107, 119, 43, 120, -40,
|
||||
69,-106, -11,-126, -87, -92,-125, -17,-109, 63, -46, 118, 36, 121, 104, 72,
|
||||
126, -7, 94, -84, 21,-125, -60,-111,-116, -49,-122, 33, -75, 102, 4, 126,
|
||||
82, 96, 124, 24, 113, -57, 52,-115, -30,-123,-100, -78,-126, 0, -99, 79,
|
||||
-28, 123, 54, 114, 113, 56, 124, -26, 80, -97, 2,-126, -76,-101,-122, -31,
|
||||
-116, 51, -59, 112, 23, 124, 95, 83, 126, 6, 103, -73, 35,-121, -47,-117,
|
||||
-110, -62,-125, 19, -86, 93, -9, 126, 70, 105, 120, 38, 118, -44, 65,-108,
|
||||
-15,-125, -90, -88,-126, -13,-107, 67, -42, 119, 41, 120, 106, 68, 126, -12,
|
||||
91, -88, 17,-125, -64,-109,-118, -45,-121, 37, -71, 104, 8, 126, 85, 93,
|
||||
125, 20, 111, -61, 48,-117, -34,-122,-102, -74,-126, 5, -96, 82, -24, 124,
|
||||
58, 112, 115, 52, 123, -30, 77,-100, -1,-126, -80, -98,-123, -27,-114, 55,
|
||||
-55, 114, 27, 124, 98, 80, 126, 1, 100, -77, 31,-123, -51,-115,-112, -58,
|
||||
-124, 23, -83, 96, -5, 126, 74, 102, 122, 34, 117, -48, 61,-110, -20,-125,
|
||||
-93, -85,-126, -9,-105, 71, -38, 121, 45, 118, 109, 64, 125, -16, 88, -91,
|
||||
12,-126, -68,-107,-120, -41,-119, 41, -68, 107, 13, 126, 88, 90, 125, 16,
|
||||
108, -65, 44,-118, -38,-121,-105, -71,-126, 9, -93, 86, -19, 125, 62, 110,
|
||||
117, 48, 122, -35, 74,-103, -5,-126, -83, -95,-124, -23,-112, 59, -51, 116,
|
||||
31, 123, 101, 76, 126, -2, 98, -80, 26,-124, -55,-114,-114, -54,-123, 28,
|
||||
-79, 98, -1, 126, 77, 100, 123, 30, 115, -52, 58,-112, -24,-124, -96, -82,
|
||||
-126, -4,-102, 74, -33, 122, 49, 117, 111, 61, 125, -21, 85, -94, 8,-126,
|
||||
-72,-104,-121, -37,-118, 46, -64, 109, 17, 125, 91, 87, 126, 11, 106, -69,
|
||||
40,-120, -42,-119,-107, -67,-126, 13, -90, 89, -15, 126, 66, 108, 119, 44,
|
||||
120, -39, 70,-105, -10,-126, -86, -92,-125, -19,-110, 62, -47, 117, 35, 121,
|
||||
103, 73, 126, -6, 95, -83, 22,-124, -59,-112,-116, -50,-122, 32, -76, 101,
|
||||
3, 126, 81, 97, 124, 26, 113, -56, 54,-114, -28,-123, -99, -79,-126, 0,
|
||||
-99, 78, -29, 123, 53, 115, 113, 57, 124, -25, 81, -97, 3,-126, -75,-102,
|
||||
-122, -33,-116, 50, -60, 111, 21, 125, 94, 84, 126, 7, 104, -72, 36,-121,
|
||||
-46,-118,-109, -63,-125, 18, -87, 92, -11, 126, 69, 106, 120, 40, 119, -43,
|
||||
66,-108, -14,-126, -89, -89,-126, -14,-108, 66, -43, 119, 40, 120, 106, 69,
|
||||
126, -11, 92, -87, 18,-125, -63,-109,-118, -46,-121, 36, -72, 104, 7, 126,
|
||||
84, 94, 125, 21, 111, -60, 50,-116, -33,-122,-102, -75,-126, 3, -97, 81,
|
||||
-25, 124, 57, 113, 115, 53, 123, -29, 78, -99, 0,-126, -79, -99,-123, -28,
|
||||
-114, 54, -56, 113, 26, 124, 97, 81, 126, 3, 101, -76, 32,-122, -50,-116,
|
||||
-112, -59,-124, 22, -83, 95, -6, 126, 73, 103, 121, 35, 117, -47, 62,-110,
|
||||
-19,-125, -92, -86,-126, -10,-105, 70, -39, 120, 44, 119, 108, 66, 126, -15,
|
||||
89, -90, 13,-126, -67,-107,-119, -42,-120, 40, -69, 106, 11, 126, 87, 91,
|
||||
125, 17, 109, -64, 46,-118, -37,-121,-104, -72,-126, 8, -94, 85, -21, 125,
|
||||
61, 111, 117, 49, 122, -33, 74,-102, -4,-126, -82, -96,-124, -24,-112, 58,
|
||||
-52, 115, 30, 123, 100, 77, 126, -1, 98, -79, 28,-123, -54,-114,-114, -55,
|
||||
-124, 26, -80, 98, -2, 126, 76, 101, 123, 31, 116, -51, 59,-112, -23,-124,
|
||||
-95, -83,-126, -5,-103, 74, -35, 122, 48, 117, 110, 62, 125, -19, 86, -93,
|
||||
9,-126, -71,-105,-121, -38,-118, 44, -65, 108, 16, 125, 90, 88, 126, 13,
|
||||
107, -68, 41,-119, -41,-120,-107, -68,-126, 12, -91, 88, -16, 125, 64, 109,
|
||||
118, 45, 121, -38, 71,-105, -9,-126, -85, -93,-125, -20,-110, 61, -48, 117,
|
||||
34, 122, 102, 74, 126, -5, 96, -83, 23,-124, -58,-112,-115, -51,-123, 31,
|
||||
-77, 100, 1, 126, 80, 98, 124, 27, 114, -55, 55,-114, -27,-123, -98, -80,
|
||||
-126, -1,-100, 77, -30, 123, 52, 115, 112, 58, 124, -24, 82, -96, 5,-126,
|
||||
-74,-102,-122, -34,-117, 48, -61, 111, 20, 125, 93, 85, 126, 8, 104, -71,
|
||||
37,-121, -45,-118,-109, -64,-125, 17, -88, 91, -12, 126, 68, 106, 120, 41,
|
||||
119, -42, 67,-107, -13,-126, -88, -90,-125, -15,-108, 65, -44, 118, 38, 120,
|
||||
105, 70, 126, -9, 93, -86, 19,-125, -62,-110,-117, -47,-121, 35, -73, 103,
|
||||
6, 126, 83, 95, 124, 23, 112, -59, 51,-116, -31,-122,-101, -76,-126, 2,
|
||||
-97, 80, -26, 124, 56, 113, 114, 54, 123, -28, 79, -99, 0,-126, -78,-100,
|
||||
-123, -30,-115, 52, -57, 113, 24, 124, 96, 82, 126, 4, 102, -75, 33,-122,
|
||||
-49,-116,-111, -60,-125, 21, -84, 94, -7, 126, 72, 104, 121, 36, 118, -46,
|
||||
63,-109, -17,-125, -92, -87,-126, -11,-106, 69, -40, 120, 43, 119, 107, 67,
|
||||
126, -14, 90, -89, 15,-126, -66,-108,-119, -43,-120, 39, -70, 105, 10, 126,
|
||||
86, 92, 125, 18, 110, -63, 47,-117, -36,-121,-103, -73,-126, 7, -94, 84,
|
||||
-22, 125, 60, 111, 116, 50, 122, -32, 75,-101, -3,-126, -81, -97,-124, -25,
|
||||
-113, 56, -53, 115, 29, 123, 99, 78, 127, 0, 99, -78, 29,-123, -53,-115,
|
||||
-113, -56,-124, 25, -81, 97, -3, 126, 75, 101, 122, 32, 116, -50, 60,-111,
|
||||
} , {
|
||||
0, 127, 85, 93, 126, 11, 101, -76, 23,-124, -66,-108,-122, -34,-113, 56,
|
||||
-46, 118, 45, 118, 113, 56, 122, -34, 67,-107, -23,-124,-101, -76,-126, 11,
|
||||
-85, 93, 0, 126, 85, 94, 126, 12, 101, -76, 23,-124, -66,-108,-122, -35,
|
||||
-113, 56, -46, 118, 45, 118, 113, 57, 122, -34, 67,-107, -22,-124,-101, -76,
|
||||
-126, 11, -85, 93, 0, 126, 85, 94, 126, 12, 101, -76, 23,-124, -66,-108,
|
||||
-121, -35,-114, 55, -46, 118, 45, 118, 113, 57, 122, -33, 67,-107, -22,-124,
|
||||
-100, -77,-126, 10, -86, 93, 0, 126, 84, 94, 126, 12, 101, -75, 24,-124,
|
||||
-66,-108,-121, -35,-114, 55, -46, 118, 44, 118, 113, 57, 122, -33, 67,-107,
|
||||
-22,-125,-100, -77,-126, 10, -86, 93, -1, 126, 84, 94, 126, 12, 102, -75,
|
||||
24,-124, -65,-108,-121, -36,-114, 55, -47, 117, 44, 118, 113, 57, 122, -33,
|
||||
68,-107, -21,-125,-100, -77,-126, 10, -86, 92, -1, 126, 84, 94, 126, 13,
|
||||
102, -75, 24,-124, -65,-108,-121, -36,-114, 55, -47, 117, 44, 119, 112, 58,
|
||||
122, -33, 68,-107, -21,-125,-100, -77,-126, 9, -86, 92, -1, 126, 84, 95,
|
||||
126, 13, 102, -75, 25,-124, -65,-108,-121, -36,-114, 54, -47, 117, 44, 119,
|
||||
112, 58, 122, -32, 68,-106, -21,-125,-100, -78,-126, 9, -87, 92, -2, 126,
|
||||
83, 95, 126, 13, 102, -74, 25,-124, -64,-109,-121, -36,-114, 54, -47, 117,
|
||||
43, 119, 112, 58, 122, -32, 68,-106, -21,-125, -99, -78,-126, 9, -87, 92,
|
||||
-2, 126, 83, 95, 126, 14, 102, -74, 25,-124, -64,-109,-121, -37,-114, 54,
|
||||
-48, 117, 43, 119, 112, 58, 122, -32, 69,-106, -20,-125, -99, -78,-126, 9,
|
||||
-87, 92, -2, 126, 83, 95, 126, 14, 102, -74, 26,-124, -64,-109,-121, -37,
|
||||
-114, 54, -48, 117, 43, 119, 112, 59, 122, -31, 69,-106, -20,-125, -99, -78,
|
||||
-126, 8, -87, 91, -2, 126, 83, 95, 126, 14, 103, -74, 26,-124, -64,-109,
|
||||
-121, -37,-115, 53, -48, 117, 42, 119, 112, 59, 122, -31, 69,-106, -20,-125,
|
||||
-99, -79,-126, 8, -87, 91, -3, 126, 83, 96, 126, 15, 103, -73, 26,-124,
|
||||
-63,-109,-121, -38,-115, 53, -49, 117, 42, 119, 112, 59, 123, -31, 69,-106,
|
||||
-19,-125, -99, -79,-126, 8, -88, 91, -3, 126, 82, 96, 126, 15, 103, -73,
|
||||
26,-124, -63,-109,-121, -38,-115, 53, -49, 117, 42, 119, 111, 59, 123, -31,
|
||||
70,-105, -19,-125, -98, -79,-126, 7, -88, 91, -3, 126, 82, 96, 126, 15,
|
||||
103, -73, 27,-124, -63,-110,-120, -38,-115, 52, -49, 116, 42, 119, 111, 60,
|
||||
123, -30, 70,-105, -19,-125, -98, -79,-126, 7, -88, 90, -4, 126, 82, 96,
|
||||
125, 15, 103, -73, 27,-123, -63,-110,-120, -38,-115, 52, -49, 116, 41, 119,
|
||||
111, 60, 123, -30, 70,-105, -18,-125, -98, -80,-126, 7, -88, 90, -4, 126,
|
||||
82, 96, 125, 16, 104, -72, 27,-123, -62,-110,-120, -39,-115, 52, -50, 116,
|
||||
41, 120, 111, 60, 123, -30, 70,-105, -18,-125, -98, -80,-126, 6, -89, 90,
|
||||
-4, 126, 81, 97, 125, 16, 104, -72, 28,-123, -62,-110,-120, -39,-115, 52,
|
||||
-50, 116, 41, 120, 111, 61, 123, -29, 71,-105, -18,-125, -98, -80,-126, 6,
|
||||
-89, 90, -5, 126, 81, 97, 125, 16, 104, -72, 28,-123, -62,-110,-120, -39,
|
||||
-115, 51, -50, 116, 40, 120, 111, 61, 123, -29, 71,-105, -18,-125, -98, -80,
|
||||
-126, 6, -89, 90, -5, 126, 81, 97, 125, 17, 104, -72, 28,-123, -62,-110,
|
||||
-120, -40,-116, 51, -50, 116, 40, 120, 111, 61, 123, -29, 71,-104, -17,-125,
|
||||
-97, -80,-126, 6, -89, 89, -5, 126, 81, 97, 125, 17, 104, -71, 28,-123,
|
||||
-61,-110,-120, -40,-116, 51, -51, 116, 40, 120, 110, 61, 123, -29, 71,-104,
|
||||
-17,-125, -97, -81,-126, 5, -89, 89, -5, 126, 81, 97, 125, 17, 104, -71,
|
||||
29,-123, -61,-111,-120, -40,-116, 51, -51, 116, 40, 120, 110, 62, 123, -28,
|
||||
72,-104, -17,-125, -97, -81,-126, 5, -90, 89, -6, 126, 80, 97, 125, 17,
|
||||
105, -71, 29,-123, -61,-111,-120, -40,-116, 50, -51, 115, 39, 120, 110, 62,
|
||||
123, -28, 72,-104, -16,-125, -97, -81,-126, 5, -90, 89, -6, 126, 80, 98,
|
||||
125, 18, 105, -71, 29,-123, -61,-111,-120, -41,-116, 50, -52, 115, 39, 120,
|
||||
110, 62, 123, -28, 72,-104, -16,-125, -97, -81,-126, 4, -90, 89, -6, 126,
|
||||
80, 98, 125, 18, 105, -70, 30,-123, -60,-111,-120, -41,-116, 50, -52, 115,
|
||||
39, 120, 110, 62, 123, -27, 72,-104, -16,-125, -96, -82,-126, 4, -90, 88,
|
||||
-7, 126, 80, 98, 125, 18, 105, -70, 30,-123, -60,-111,-119, -41,-116, 49,
|
||||
-52, 115, 38, 120, 110, 63, 123, -27, 73,-103, -16,-125, -96, -82,-126, 4,
|
||||
-90, 88, -7, 126, 79, 98, 125, 19, 105, -70, 30,-123, -60,-111,-119, -41,
|
||||
-116, 49, -52, 115, 38, 120, 110, 63, 124, -27, 73,-103, -15,-126, -96, -82,
|
||||
-126, 3, -91, 88, -7, 126, 79, 98, 125, 19, 105, -70, 31,-123, -60,-111,
|
||||
-119, -42,-116, 49, -53, 115, 38, 121, 109, 63, 124, -27, 73,-103, -15,-126,
|
||||
-96, -82,-126, 3, -91, 88, -8, 126, 79, 99, 125, 19, 106, -69, 31,-123,
|
||||
-59,-112,-119, -42,-117, 49, -53, 115, 38, 121, 109, 63, 124, -26, 73,-103,
|
||||
-15,-126, -96, -83,-126, 3, -91, 88, -8, 126, 79, 99, 125, 20, 106, -69,
|
||||
31,-123, -59,-112,-119, -42,-117, 48, -53, 115, 37, 121, 109, 64, 124, -26,
|
||||
74,-103, -14,-126, -95, -83,-126, 3, -91, 87, -8, 126, 78, 99, 125, 20,
|
||||
106, -69, 31,-122, -59,-112,-119, -43,-117, 48, -53, 114, 37, 121, 109, 64,
|
||||
124, -26, 74,-103, -14,-126, -95, -83,-126, 2, -91, 87, -8, 126, 78, 99,
|
||||
}
|
||||
};
|
|
@ -1,28 +0,0 @@
|
|||
#!/usr/local/bin/perl
|
||||
|
||||
$shift = shift;
|
||||
$val[255] = 0;
|
||||
for $i(0..8) { $mx[$i] = 1 << ($i+4); }
|
||||
$mx[0] = 0;
|
||||
|
||||
$l = 0;
|
||||
for $i(0..127) {
|
||||
$z = $i<<$shift;
|
||||
$l++ if $z >= $mx[$l+1] && $l < 7;
|
||||
|
||||
$val = ($z-$mx[$l])>>($l==0 ?1:$l);
|
||||
$val = 15 if($val > 15);
|
||||
$val += $l<<4;
|
||||
|
||||
$val[128+$i] = $val;
|
||||
$val[127-$i] = - $val;
|
||||
print STDERR "$i:$val ";
|
||||
}
|
||||
print STDERR "\n";
|
||||
|
||||
while(<>) {
|
||||
for $i (0..length ($_)-1) {
|
||||
substr($_,$i,1) = sprintf("%c",$val[ord(substr($_,$i,1))]);
|
||||
}
|
||||
print;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
PROGRAMS = toalaw tosnd
|
||||
|
||||
TOPDIR=../..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
#!/usr/local/bin/perl
|
||||
|
||||
@mult = (2,2,4,8,16,32,64,128);
|
||||
@base = (1,33,66,132,264,528,1056,2112,4032);
|
||||
$shift = shift;
|
||||
$val[255] = 0;
|
||||
|
||||
for$i(0..7) {
|
||||
for $j (0..15) {
|
||||
$k = ($i<<4)+$j;
|
||||
$val = (($base[$i] + ($mult[$i] * $j)) >> $shift);
|
||||
$val = 127 if($val > 127);
|
||||
$val[$k] = 128 + $val;
|
||||
$val[255-$k] = 127 - $val;
|
||||
}
|
||||
}
|
||||
|
||||
print STDERR "\n";
|
||||
|
||||
while(<>) {
|
||||
$old = $_;
|
||||
s/\000-\377/pack("C",$val[ord($&)])/eg;
|
||||
for $i (0..length ($_)-1) {
|
||||
substr($_,$i,1) = sprintf("%c",$val[ord(substr($_,$i,1))]);
|
||||
}
|
||||
print;
|
||||
}
|
19
bin/Makefile
19
bin/Makefile
|
@ -1,19 +0,0 @@
|
|||
all prog:
|
||||
rm -f master; ln -s ../isdn_4/master .
|
||||
rm -f monitor; ln -s ../ip_mon/monitor .
|
||||
rm -f slipto; ln -s ../str_if/slipto .
|
||||
rm -f toalaw; ln -s ../alaw/toalaw .
|
||||
rm -f tosnd; ln -s ../alaw/tosnd .
|
||||
rm -f cardname; ln -s ../tools/cardname .
|
||||
|
||||
clean:
|
||||
rm -f master
|
||||
rm -f monitor
|
||||
rm -f slipto
|
||||
rm -f toalaw
|
||||
rm -f tosnd
|
||||
rm -f cardname
|
||||
|
||||
install update depend indent load:
|
||||
@echo "Nothing to be done."
|
||||
|
|
@ -1,5 +1,12 @@
|
|||
## =()<CARDS = @<CARDS>@>()=
|
||||
CARDS = dumb
|
||||
TOPDIR=..
|
||||
include $(TOPDIR)/Make.config
|
||||
|
||||
KERNEL=1
|
||||
REALSOURCE=loader.c
|
||||
OBJS=$(addsuffix .o,$(CARDS))
|
||||
EXTRA_CFLAGS= -DCARDTYPE=$(basename $@ .o)
|
||||
|
||||
SUBDIRS=capi dumb
|
||||
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
||||
all lib clean depend install update indent load:
|
||||
@set -e; for i in $(CARDS) ; do $(MAKE) $(MAKEFLAGS) -C $$i $@ ; done
|
||||
|
|
|
@ -1,43 +1,7 @@
|
|||
SHELL = /bin/sh
|
||||
MAKE = make
|
||||
## =()<P = @<P>@>()=
|
||||
P =
|
||||
all::
|
||||
|
||||
## =()<CC = @<CC>@>()=
|
||||
CC = gcc
|
||||
## =()<DEFS = @<DEFCARDS>@ @<KERNEL>@ -I../../include >()=
|
||||
DEFS = -I../../streams -I../../compat -fomit-frame-pointer -funroll-loops -DKERNEL -D__KERNEL__ -DMODULE -DCONFIG_MODVERSIONS -I../../include
|
||||
## =()<CFLAGS = @<CFLAGS>@ $(DEFS)>()=
|
||||
CFLAGS = -O2 -Wall $(DEFS)
|
||||
## =()<RANLIB = @<RANLIB>@>()=
|
||||
RANLIB = ranlib
|
||||
DOCARDS=1
|
||||
|
||||
## =()<SYS = @<SYS>@>()=
|
||||
SYS = linux
|
||||
|
||||
SOURCES = arnet.c
|
||||
|
||||
OBJ = arnet.o
|
||||
|
||||
all: $(OBJ)
|
||||
|
||||
install: all
|
||||
@sh ../iftrue.sh "-d $(SYS)" "cd $(SYS); make"
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(ALL)
|
||||
@sh ../iftrue.sh "-d $(SYS)" "cd $(SYS); make clean"
|
||||
|
||||
indent:
|
||||
../indent.sh $(SOURCES)
|
||||
|
||||
depend: Makefile $(SOURCES)
|
||||
$(CC) -M $(DEFS) $(SOURCES) > .depend
|
||||
|
||||
load:
|
||||
insmod arnet.o
|
||||
|
||||
ifeq (.depend,$(wildcard .depend))
|
||||
include .depend
|
||||
endif
|
||||
TOPDIR=../..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
Diese "arnet"-Karten sind keine ISDN-Karten, sondern Karten mit synchronen
|
||||
seriellen Ports und einem Haufen RAM, um on-board-DMA zu machen.
|
|
@ -0,0 +1,7 @@
|
|||
all::
|
||||
|
||||
DOCARDS=1
|
||||
|
||||
TOPDIR=../..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,73 @@
|
|||
#ifndef BINTEC_H
|
||||
#define BINTEC_H
|
||||
|
||||
#include "isdn_limits.h"
|
||||
#include "isdn_12.h"
|
||||
#include "smallq.h"
|
||||
#include <stream.h>
|
||||
#include "loader.h"
|
||||
|
||||
#include "bri.h"
|
||||
|
||||
#define DEBUG(_x) if((DEBUG_##_x) & bp->info.debug)
|
||||
#define DEBUG_memory 0x01
|
||||
#define DEBUG_uart 0x00
|
||||
/* #define DEBUG_isac 0x04 */
|
||||
#define DEBUG_capi 0x08
|
||||
#define DEBUG_capiout 0x02
|
||||
#define DEBUG_cpu 0x00
|
||||
#define DEBUG_check 0x20
|
||||
#define DEBUG_info 0x40
|
||||
#define DEBUG_main 0x80
|
||||
|
||||
typedef unsigned char Byte;
|
||||
typedef struct _hdlc_buf {
|
||||
struct _smallq q_in, q_out;
|
||||
ushort_t offset;
|
||||
ushort_t appID, PLCI, NCCI;
|
||||
uchar_t dblock; /* sent data block number, incremented, mostly ignored */
|
||||
uchar_t mode;
|
||||
uchar_t waitflow;
|
||||
} *hdlc_buf;
|
||||
|
||||
typedef struct _bintec {
|
||||
struct _isdn1_card card; /* must be first */
|
||||
struct cardinfo info,*infoptr;
|
||||
|
||||
struct _hdlc_buf chan[MAX_B+1];
|
||||
|
||||
#ifdef NEW_TIMEOUT
|
||||
long timer, timer_toss_unknown;
|
||||
#endif
|
||||
unsigned unknown_timer:1;
|
||||
struct _smallq q_unknown;
|
||||
|
||||
signed char polled; char lastout; int maxoffset;
|
||||
|
||||
int sndoffset; /* buffer position where we send */
|
||||
int sndbufsize; /* size of send buffer */
|
||||
int sndend; /* last byte of block, for count */
|
||||
int rcvoffset; /* buffer position at which to receive */
|
||||
int rcvbufsize; /* size of receive buffer */
|
||||
int rcvend; /* last byte of block, for flushing / count */
|
||||
|
||||
int msgnr; /* 0x0000-3FFF: Treiber; 4000-7FFF: CAPI;
|
||||
0x8000-FFFF: Board */
|
||||
int waitmsg; /* messages to skip before coming online */
|
||||
|
||||
volatile uchar_t *base; /* base address of shared memory */
|
||||
volatile uchar_t *state; /* state flag */
|
||||
volatile uchar_t *debugtext; /* debug output */
|
||||
volatile uchar_t *ctrl; /* address of control register */
|
||||
|
||||
intercom_t rcv; /* incoming buffer */
|
||||
intercom_t snd; /* outgoing buffer */
|
||||
int cflag; /* control flag */
|
||||
|
||||
unsigned long ctrlmask; /* controller bitmask */
|
||||
unsigned char type; /* board type */
|
||||
|
||||
struct _bintec *next;
|
||||
} *__bintec;
|
||||
|
||||
#endif /* BINTEC_H */
|
|
@ -0,0 +1,252 @@
|
|||
/************************************************************************/
|
||||
/* */
|
||||
/* (C) 1993 BinTec Computersysteme */
|
||||
/* All Rights Reserved */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#ifdef __linux__
|
||||
#define far
|
||||
#endif
|
||||
|
||||
/************************************************************************
|
||||
|
||||
|
||||
==================================================
|
||||
= BIANCA-BRI, BRI-4 ISDN adapter for AT-BUS =
|
||||
==================================================
|
||||
|
||||
memory layout,
|
||||
|
||||
all shorts are motorola format, and have to be swapped to intel format
|
||||
|
||||
16 KByte shared memory
|
||||
|
||||
+---------------+
|
||||
| 0x0008 | 8 KByte rcv buffer
|
||||
~ ~
|
||||
|---------------|
|
||||
| 0x2000 | 8 KByte snd buffer
|
||||
~ ~
|
||||
|---------------|
|
||||
| 0x3ff0 | size of rcv buffer
|
||||
| 0x3ff2 | write index rcv buffer
|
||||
| 0x3ff4 | read index rcv buffer
|
||||
|---------------|
|
||||
| 0x3ff6 | size of snd buffer
|
||||
| 0x3ff8 | write index snd buffer
|
||||
| 0x3ffa | read index snd buffer
|
||||
|---------------|
|
||||
| 0x3ffc | state register
|
||||
| 0x3ffd | debug register
|
||||
| 0x3ffe | control register
|
||||
+---------------+
|
||||
|
||||
|
||||
|
||||
state register (BRI, BRI-4)
|
||||
+-------+--------------------+----------------------------------+
|
||||
| BIT | READ | WRITE |
|
||||
+-------+--------------------+----------------------------------+
|
||||
| 0 | | 1 -> gen interrupt if 680x0 CPU |
|
||||
| | | has filled rcv buffer with |
|
||||
| | | data |
|
||||
+-------+--------------------+----------------------------------+
|
||||
| 1 | | 1 -> gen interrupt if 680x0 CPU |
|
||||
| | | has read data from snd |
|
||||
| | | buffer |
|
||||
+-------+--------------------+----------------------------------+
|
||||
| 7 | 1 -> hardware | |
|
||||
| | failure | |
|
||||
+-------+--------------------+----------------------------------+
|
||||
|
||||
control register (BRI, BRI-4)
|
||||
+-------+--------------------+----------------------------------+
|
||||
| BIT | READ | WRITE |
|
||||
+-------+--------------------+----------------------------------+
|
||||
| 0 | 1 -> interrupt to | 0 -> disable interrupts |
|
||||
| | host pending | 1 -> enable interrupts |
|
||||
+-------+--------------------+----------------------------------+
|
||||
| 1 | 0 -> CPU in reset | 0 -> reset CPU |
|
||||
+-------+--------------------+----------------------------------+
|
||||
| 2 | 0 -> CPU in halt | 0 -> halt CPU |
|
||||
| | 1 -> CPU run | 1 -> run CPU |
|
||||
+-------+--------------------+----------------------------------+
|
||||
| 3 | | 1 -> enable cpu cache |
|
||||
+-------+--------------------+----------------------------------+
|
||||
| 4 | | 1 -> interrupt to 680x0 to read |
|
||||
| | | shared memory |
|
||||
+-------+--------------------+----------------------------------+
|
||||
| 7-5 | 0 -> BRI-4 | |
|
||||
| | 1 -> X21 | |
|
||||
| | 2 -> BRI | |
|
||||
+-------+-------------------------------------------------------+
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
==================================================
|
||||
= BIANCA-PMX S2M ISDN adapter for AT-BUS =
|
||||
==================================================
|
||||
|
||||
memory layout,
|
||||
|
||||
all shorts are motorola format, and have to be swapped to intel format
|
||||
|
||||
64 KByte shared memory
|
||||
|
||||
+---------------+
|
||||
| 0x0008 | 8 KByte rcv buffer
|
||||
~ ~
|
||||
|---------------|
|
||||
| 0x2000 | 8 KByte snd buffer
|
||||
~ ~
|
||||
|---------------|
|
||||
| 0x3ff0 | size of rcv buffer
|
||||
| 0x3ff2 | write index rcv buffer
|
||||
| 0x3ff4 | read index rcv buffer
|
||||
|---------------|
|
||||
| 0x3ff6 | size of snd buffer
|
||||
| 0x3ff8 | write index snd buffer
|
||||
| 0x3ffa | read index snd buffer
|
||||
|---------------|
|
||||
| 0x3ffc | state register
|
||||
| 0x3ffd | debug register
|
||||
~ ~
|
||||
~ ~
|
||||
| 0xfffe | control register
|
||||
+---------------+
|
||||
|
||||
|
||||
|
||||
state register
|
||||
+-------+--------------------+----------------------------------+
|
||||
| BIT | READ | WRITE |
|
||||
+-------+--------------------+----------------------------------+
|
||||
| 0 | | 1 -> gen interrupt if 68040 CPU |
|
||||
| | | has filled rcv buffer with |
|
||||
| | | data |
|
||||
+-------+--------------------+----------------------------------+
|
||||
| 1 | | 1 -> gen interrupt if 68040 CPU |
|
||||
| | | has read data from snd |
|
||||
| | | buffer |
|
||||
+-------+--------------------+----------------------------------+
|
||||
| 7 | 1 -> hardware | |
|
||||
| | failure | |
|
||||
+-------+--------------------+----------------------------------+
|
||||
|
||||
control register
|
||||
+-------+--------------------+----------------------------------+
|
||||
| BIT | READ | WRITE |
|
||||
+-------+--------------------+----------------------------------+
|
||||
| 0 | | |
|
||||
| | | 1 -> run CPU |
|
||||
+-------+--------------------+----------------------------------+
|
||||
| 1 | | |
|
||||
| | | 1 -> run CPU |
|
||||
+-------+--------------------+----------------------------------+
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef __BRI_H
|
||||
#define __BRI_H
|
||||
/* static char _sccsid_bri_h[] = "@(#)bri.h 1.20"; */
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* MACRO-DEFINES */
|
||||
/*----------------------------------------------------------------------*/
|
||||
#define CTRL_ENABLE(bp) if ((bp)->type != BOARD_ID_PMX) \
|
||||
(*(bp)->ctrl = (bp)->cflag = 0xf)
|
||||
#define CTRL_DISABLE(bp) if ((bp)->type != BOARD_ID_PMX) \
|
||||
(*(bp)->ctrl = (bp)->cflag = 0xe)
|
||||
#define CTRL_SET(bp,val) (*(bp)->ctrl = (bp)->cflag = (val))
|
||||
#define STATE_SET(bp,val) (*(bp)->state = (val))
|
||||
#define CTRL_RESET(bp) reset_card(bp)
|
||||
|
||||
|
||||
|
||||
/* #define BOARD_TYPE(bp) (*(bp)->ctrl >> 5) */
|
||||
#define BOARD_TYPE(bp) ((bp)->type)
|
||||
|
||||
#define BOARD_ID_BRI4 0 /* Quattro 4 S0 */
|
||||
#define BOARD_ID_X21 1 /* X21 adapter */
|
||||
#define BOARD_ID_BRI 2 /* BRI */
|
||||
#define BOARD_ID_PMX 7 /* S2M */
|
||||
|
||||
#define BOARD_BOOTLOADER "BOOT.68K"
|
||||
#define BOARD_SYS_BRI4 "BRI_Q.68K"
|
||||
#define BOARD_SYS_BRI "BRI.68K"
|
||||
#define BOARD_SYS_X21 "X21.68K"
|
||||
#define BOARD_SYS_PMX "PMX.68K"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* GLOBAL DEFINES */
|
||||
/*----------------------------------------------------------------------*/
|
||||
#define IO_8259A_1 0x20 /* IO addr of first 8259A */
|
||||
#define IO_8259A_2 0xa0 /* IO addr of second 8259A */
|
||||
#define OCW2_8259_EOI 0x20 /* end of interrupt command */
|
||||
|
||||
#define APIINIT_IDENT "Here is what I'am searching for"
|
||||
#define API_BOSSCOM_ID 1
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* DATA STRUCTURES */
|
||||
/*----------------------------------------------------------------------*/
|
||||
typedef struct {
|
||||
unsigned short sz; /* size of buffer */
|
||||
unsigned short wi; /* write index */
|
||||
unsigned short ri; /* read index */
|
||||
} icinfo_t;
|
||||
|
||||
typedef struct {
|
||||
volatile unsigned char far *p; /* pointer to buffer */
|
||||
volatile icinfo_t far *d; /* buffer information */
|
||||
} intercom_t;
|
||||
|
||||
#if 0
|
||||
|
||||
typedef struct {
|
||||
unsigned addr; /* address of shared memory */
|
||||
unsigned char hwInt; /* intr */
|
||||
|
||||
volatile unsigned char far *base; /* base address of shared memory */
|
||||
volatile unsigned char far *state; /* state flag */
|
||||
volatile unsigned char far *debug; /* debug output */
|
||||
volatile unsigned char far *ctrl; /* address of control register */
|
||||
|
||||
intercom_t rcv; /* incoming intercom buffer */
|
||||
intercom_t snd; /* outgoing intercom buffer */
|
||||
int cflag; /* control flag */
|
||||
|
||||
unsigned long ctrlmask; /* controller bitmask */
|
||||
unsigned char type; /* board type */
|
||||
} board_t;
|
||||
|
||||
typedef struct {
|
||||
char section[512];
|
||||
char drvpath[512];
|
||||
char ctrl;
|
||||
char type;
|
||||
} bd_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned short board; /* board */
|
||||
unsigned short ctrl; /* controller number */
|
||||
|
||||
char profile[32]; /* profile to load */
|
||||
char bindaddr[32]; /* login ident */
|
||||
unsigned short tei; /* static TEI, or -1 if dynamic */
|
||||
unsigned short disc_d; /* time to hold d-channel layer 2 */
|
||||
unsigned short permlink; /* permanent hold d-channel lay 2 */
|
||||
unsigned long flags;
|
||||
char spid1[20]; /* service point identifier (NI-1) */
|
||||
char spid2[20]; /* service point identifier (NI-1) */
|
||||
char telno1[32]; /* own telno */
|
||||
char telno2[32]; /* own telno */
|
||||
} bdcfg_t;
|
||||
#endif
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,55 @@
|
|||
#include "f_module.h"
|
||||
#include "isdn_limits.h"
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef linux
|
||||
#include <linux/sched.h>
|
||||
#endif
|
||||
|
||||
#include "bintec.h"
|
||||
|
||||
#ifndef REALNAME
|
||||
#error "You have to define REALNAME 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(REALNAME,init)(struct _bintec *bp);
|
||||
extern void NAME(REALNAME,exit)(struct _bintec *bp);
|
||||
|
||||
struct _bintec bintec;
|
||||
|
||||
int irq = 0;
|
||||
int mem = 0;
|
||||
int io = 0;
|
||||
int name = 0;
|
||||
int debug = 0;
|
||||
|
||||
#ifdef MODULE
|
||||
static int do_init_module(void)
|
||||
{
|
||||
if(name == 0) {
|
||||
printf("You must name this card: insmod xxx.o name=$(cardname Foo0)\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
bintec.irq = irq;
|
||||
bintec.ipl = 5;
|
||||
bintec.ioaddr = io;
|
||||
bintec.memaddr = mem;
|
||||
bintec.ID = name;
|
||||
bintec.debug = debug;
|
||||
return NAME(REALNAME,init)(&bintec);
|
||||
}
|
||||
|
||||
static int do_exit_module(void)
|
||||
{
|
||||
NAME(REALNAME,exit)(&bintec);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#error "This can only be used as a module!"
|
||||
#endif
|
||||
|
|
@ -1,93 +1,9 @@
|
|||
all::
|
||||
|
||||
SHELL = /bin/sh
|
||||
MAKE = make
|
||||
## =()<P = @<P>@>()=
|
||||
P =
|
||||
DOCARDS=1
|
||||
REALSOURCE=shell.c
|
||||
SOURCES=avm.c ncp.c teles.c ncp16.c bsc.c
|
||||
|
||||
## =()<CC = @<CC>@>()=
|
||||
CC = gcc
|
||||
## =()<DEFS = @<DEFCARDS>@ @<KERNEL>@ -I../../include >()=
|
||||
DEFS = -I../../streams -I../../compat -fomit-frame-pointer -funroll-loops -DKERNEL -D__KERNEL__ -DMODULE -DCONFIG_MODVERSIONS -I../../include
|
||||
## =()<CFLAGS = @<CFLAGS>@ $(DEFS)>()=
|
||||
CFLAGS = -O2 -Wall $(DEFS)
|
||||
## =()<LD = @<LD>@>()=
|
||||
LD = ld
|
||||
## =()<DUMBCARDS = @<DUMBCARDS>@>()=
|
||||
DUMBCARDS = teles
|
||||
|
||||
## =()<SYS = @<SYS>@>()=
|
||||
SYS = linux
|
||||
|
||||
SOURCES = avm_io.c bsc_io.c teles_io.c ncp_io.c ncp16_io.c shell.c insert.c
|
||||
|
||||
OBJ =
|
||||
ALL = teles.o avm.o bsc.o ncp.o ncp16.o \
|
||||
d_teles.o d_avm.o d_bsc.o d_ncp.o d_ncp16.o
|
||||
|
||||
all: $(foreach c,${DUMBCARDS},$c.o) $(foreach c,${DUMBCARDS},d_$c.o)
|
||||
|
||||
load: $(foreach c,${DUMBCARDS},ins-$c)
|
||||
|
||||
|
||||
avm.o: insert.c
|
||||
$(CC) $(CFLAGS) -DCARDTYPE=avm -o avm.o -c insert.c
|
||||
bsc.o: insert.c
|
||||
$(CC) $(CFLAGS) -DCARDTYPE=bsc -o bsc.o -c insert.c
|
||||
ncp16.o: insert.c
|
||||
$(CC) $(CFLAGS) -DCARDTYPE=ncp16 -o ncp16.o -c insert.c
|
||||
ncp.o: insert.c
|
||||
$(CC) $(CFLAGS) -DCARDTYPE=ncp -o ncp.o -c insert.c
|
||||
teles.o: insert.c
|
||||
$(CC) $(CFLAGS) -DCARDTYPE=teles -o teles.o -c insert.c
|
||||
|
||||
d_avm.o: shell.c avm_io.c
|
||||
$(CC) $(CFLAGS) -D_avm_ -o d_avm.o -c shell.c
|
||||
d_bsc.o: shell.c bsc_io.c
|
||||
$(CC) $(CFLAGS) -D_bsc_ -o d_bsc.o -c shell.c
|
||||
d_ncp16.o: shell.c ncp16_io.c
|
||||
$(CC) $(CFLAGS) -D_ncp16_ -DWIDE -o d_ncp16.o -c shell.c
|
||||
d_ncp.o: shell.c ncp_io.c
|
||||
$(CC) $(CFLAGS) -D_ncp_ -o d_ncp.o -c shell.c
|
||||
d_teles.o: shell.c teles_io.c
|
||||
$(CC) $(CFLAGS) -D_teles_ -o d_teles.o -c shell.c
|
||||
|
||||
ins-avm:
|
||||
insmod d_avm.o
|
||||
insmod avm.o
|
||||
ins-bsc:
|
||||
insmod d_bsc.o
|
||||
insmod bsc.o
|
||||
ins-teles:
|
||||
insmod d_teles.o
|
||||
insmod teles.o
|
||||
ins-ncp:
|
||||
insmod d_ncp.o
|
||||
insmod ncp.o
|
||||
ins-ncp16:
|
||||
insmod d_ncp16.o
|
||||
insmod ncp16.o
|
||||
|
||||
lib:
|
||||
|
||||
indent:
|
||||
../../indent.sh $(SOURCES)
|
||||
|
||||
depend: Makefile $(SOURCES)
|
||||
cp /dev/null .depend
|
||||
for i in avm ncp teles bsc ; do $(CC) -D_$${i}_ -M $(DEFS) shell.c |\
|
||||
sed -e "s/shell\.o/X$${i}.o/" >> .depend ; done
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(ALL)
|
||||
|
||||
install: all
|
||||
@sh ../../iftrue.sh "-d $(SYS)" "cd $(SYS); make"
|
||||
|
||||
update: all
|
||||
@sh ../../iftrue.sh "-d $(SYS)" "cd $(SYS); make update"
|
||||
|
||||
|
||||
ifeq (.depend,$(wildcard .depend))
|
||||
include .depend
|
||||
endif
|
||||
TOPDIR=../..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
inline static Byte InISAC(struct _dumb * dumb, char offset) {
|
||||
if(offset >= 0x20)
|
||||
return ByteIn(dumb->ioaddr+0x1400-0x20+offset);
|
||||
return ByteIn(dumb->info.ioaddr+0x1400-0x20+offset);
|
||||
else
|
||||
return ByteIn(dumb->ioaddr+0x1000+offset); /* ?? */
|
||||
return ByteIn(dumb->info.ioaddr+0x1000+offset); /* ?? */
|
||||
}
|
||||
inline static void OutISAC(struct _dumb * dumb, char offset, Byte data) {
|
||||
if(offset >= 0x20)
|
||||
ByteOut(dumb->ioaddr+0x1400-0x20+offset,data);
|
||||
ByteOut(dumb->info.ioaddr+0x1400-0x20+offset,data);
|
||||
else
|
||||
ByteOut(dumb->ioaddr+0x1000+offset,data); /* ?? */
|
||||
ByteOut(dumb->info.ioaddr+0x1000+offset,data); /* ?? */
|
||||
}
|
||||
|
||||
inline static Byte InHSCX(struct _dumb * dumb, u_char hscx, char offset) {
|
||||
if(hscx&1) {
|
||||
if(offset >= 0x20)
|
||||
return ByteIn(dumb->ioaddr+0x400-0x20+offset);
|
||||
return ByteIn(dumb->info.ioaddr+0x400-0x20+offset);
|
||||
else
|
||||
return ByteIn(dumb->ioaddr+0x000+offset);
|
||||
return ByteIn(dumb->info.ioaddr+0x000+offset);
|
||||
} else {
|
||||
if(offset >= 0x20)
|
||||
return ByteIn(dumb->ioaddr+0xC00-0x20+offset);
|
||||
return ByteIn(dumb->info.ioaddr+0xC00-0x20+offset);
|
||||
else
|
||||
return ByteIn(dumb->ioaddr+0x800+offset);
|
||||
return ByteIn(dumb->info.ioaddr+0x800+offset);
|
||||
}
|
||||
}
|
||||
|
||||
inline static void OutHSCX(struct _dumb * dumb, u_char hscx, char offset, Byte data) {
|
||||
if(hscx&1) {
|
||||
if(offset >= 0x20)
|
||||
ByteOut(dumb->ioaddr+0x400-0x20+offset, data);
|
||||
ByteOut(dumb->info.ioaddr+0x400-0x20+offset, data);
|
||||
else
|
||||
ByteOut(dumb->ioaddr+0x000+offset, data);
|
||||
ByteOut(dumb->info.ioaddr+0x000+offset, data);
|
||||
} else {
|
||||
if(offset >= 0x20)
|
||||
ByteOut(dumb->ioaddr+0xC00-0x20+offset, data);
|
||||
ByteOut(dumb->info.ioaddr+0xC00-0x20+offset, data);
|
||||
else
|
||||
ByteOut(dumb->ioaddr+0x800+offset, data);
|
||||
ByteOut(dumb->info.ioaddr+0x800+offset, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,25 +50,25 @@ static int Init(struct _dumb * dumb) {
|
|||
Byte foo;
|
||||
unsigned int step = 0;
|
||||
|
||||
if(dumb->ioaddr == 0)
|
||||
if(dumb->info.ioaddr == 0)
|
||||
return -EINVAL;
|
||||
dumb->numHSCX = 2;
|
||||
save_flags(flags);
|
||||
sti();
|
||||
timout = jiffies+1;
|
||||
|
||||
ByteOut(dumb->ioaddr+0x1800,0x00); while(jiffies <= timout) ; timout = jiffies;
|
||||
ByteOut(dumb->ioaddr+0x1800,0x10); while(jiffies <= timout) ; timout = jiffies;
|
||||
ByteOut(dumb->ioaddr+0x1800,0x00); while(jiffies <= timout) ; timout = jiffies;
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x00); while(jiffies <= timout) ; timout = jiffies;
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x10); while(jiffies <= timout) ; timout = jiffies;
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x00); while(jiffies <= timout) ; timout = jiffies;
|
||||
|
||||
ByteOut(dumb->ioaddr+0x1800,0x00); while(jiffies <= timout) ; timout = jiffies;
|
||||
ByteOut(dumb->ioaddr+0x1800,0x01); while(jiffies <= timout) ; timout = jiffies;
|
||||
ByteOut(dumb->ioaddr+0x1800,0x00); while(jiffies <= timout) ;
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x00); while(jiffies <= timout) ; timout = jiffies;
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x01); while(jiffies <= timout) ; timout = jiffies;
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x00); while(jiffies <= timout) ;
|
||||
|
||||
timout = jiffies+(HZ/20);
|
||||
ByteOut(dumb->ioaddr+0x1800,0x01);
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x01);
|
||||
while(jiffies <= timout) ;
|
||||
ByteOut(dumb->ioaddr+0x1800,0x00);
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x00);
|
||||
timout = jiffies+(HZ/20);
|
||||
while(jiffies <= timout) ;
|
||||
restore_flags(flags);
|
||||
|
@ -76,8 +76,8 @@ static int Init(struct _dumb * dumb) {
|
|||
/* 1 2 3 4 5 6 7 8 9 */
|
||||
/* 17 07 13 03 17 07 13 03 */
|
||||
while(++step) {
|
||||
ByteOut(dumb->ioaddr+0x1800,(step&1)?0x10:0x00);
|
||||
switch((foo = ByteIn(dumb->ioaddr+0x1800)) & 0xFE) {
|
||||
ByteOut(dumb->info.ioaddr+0x1800,(step&1)?0x10:0x00);
|
||||
switch((foo = ByteIn(dumb->info.ioaddr+0x1800)) & 0xFE) {
|
||||
case 0x06:
|
||||
if(step & 1)
|
||||
goto def;
|
||||
|
@ -114,16 +114,16 @@ static int Init(struct _dumb * dumb) {
|
|||
|
||||
save_flags(flags);
|
||||
timout = jiffies+(HZ/20)+1;
|
||||
ByteOut(dumb->ioaddr+0x1800,0x01);
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x01);
|
||||
sti();
|
||||
while(jiffies <= timout) ;
|
||||
ByteOut(dumb->ioaddr+0x1800,0x00);
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x00);
|
||||
timout = jiffies+(HZ/20)+1;
|
||||
while(jiffies <= timout) ;
|
||||
restore_flags(flags);
|
||||
|
||||
ByteOut(dumb->ioaddr+0x1800,0x04);
|
||||
ByteOut(dumb->ioaddr+0x1800,0x08);
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x04);
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x08);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ static void InitHSCX_(struct _dumb * dumb, u_char hscx)
|
|||
|
||||
static void ISAC_mode(struct _dumb * dumb, Byte mode, Byte listen)
|
||||
{
|
||||
unsigned long ms = SetSPL(dumb->ipl);
|
||||
unsigned long ms = SetSPL(dumb->info.ipl);
|
||||
|
||||
if(dumb->chan[0].m_in != NULL) {
|
||||
freemsg(dumb->chan[0].m_in);
|
||||
|
@ -180,7 +180,7 @@ static void ISAC_mode(struct _dumb * dumb, Byte mode, Byte listen)
|
|||
|
||||
switch(mode) {
|
||||
case M_OFF:
|
||||
printk(KERN_DEBUG "CIX0 0x3F\n");
|
||||
printk("%sCIX0 0x3F\n",KERN_DEBUG );
|
||||
ByteOutISAC(dumb,CIX0,0x3F);
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,0);
|
||||
dumb->chan[0].mode = mode;
|
||||
|
@ -188,10 +188,10 @@ static void ISAC_mode(struct _dumb * dumb, Byte mode, Byte listen)
|
|||
case M_STANDBY:
|
||||
if(dumb->chan[0].mode != M_STANDBY) {
|
||||
ByteOutISAC(dumb,MODE,0xC9);
|
||||
printk(KERN_DEBUG "CIX0 0x03\n");
|
||||
printk("%sCIX0 0x03\n",KERN_DEBUG );
|
||||
ByteOutISAC(dumb,CIX0,0x03);
|
||||
}
|
||||
else printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
||||
else printk("%sNoCIX0 %d\n",KERN_DEBUG ,dumb->chan[0].mode);
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
dumb->chan[0].mode = mode;
|
||||
dumb->chan[0].listen = 1;
|
||||
|
@ -200,10 +200,10 @@ else printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
|||
ByteOutISAC(dumb,MODE,0xC9);
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
if(dumb->chan[0].mode != M_HDLC) {
|
||||
printk(KERN_DEBUG "CIX0 0x27\n");
|
||||
printk("%sCIX0 0x27\n",KERN_DEBUG );
|
||||
ByteOutISAC(dumb,CIX0,0x27);
|
||||
} else {
|
||||
printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
||||
printk("%sNoCIX0 %d\n",KERN_DEBUG ,dumb->chan[0].mode);
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,1);
|
||||
}
|
||||
#if 0
|
||||
|
@ -221,7 +221,7 @@ printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
|||
|
||||
static int HSCX_mode(struct _dumb * dumb, u_char hscx, Byte mode, Byte listen)
|
||||
{
|
||||
unsigned long ms = SetSPL(dumb->ipl);
|
||||
unsigned long ms = SetSPL(dumb->info.ipl);
|
||||
if(dumb->chan[hscx].m_in != NULL) {
|
||||
freemsg(dumb->chan[hscx].m_in);
|
||||
dumb->chan[hscx].m_in = dumb->chan[hscx].m_in_run = NULL;
|
||||
|
@ -301,20 +301,20 @@ static int HSCX_mode(struct _dumb * dumb, u_char hscx, Byte mode, Byte listen)
|
|||
|
||||
inline static void PostIRQ(struct _dumb * dumb)
|
||||
{
|
||||
Byte foo = ByteIn(dumb->ioaddr+0x1800);
|
||||
Byte foo = ByteIn(dumb->info.ioaddr+0x1800);
|
||||
unsigned int doagain=0;
|
||||
do {
|
||||
switch(foo) {
|
||||
case 0x07: return;
|
||||
case 0x03:
|
||||
if(doagain & 1) {
|
||||
ByteOut(dumb->ioaddr+0x1800,0x00);
|
||||
ByteOut(dumb->ioaddr+0x1800,0x10);
|
||||
ByteOut(dumb->ioaddr+0x1800,0x00);
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x00);
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x10);
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x00);
|
||||
} else {
|
||||
ByteOut(dumb->ioaddr+0x1800,0x04);
|
||||
ByteOut(dumb->ioaddr+0x1800,0x08);
|
||||
ByteOut(dumb->ioaddr+0x1800,0x00);
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x04);
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x08);
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x00);
|
||||
}
|
||||
printf(".");
|
||||
if(doagain < 10)
|
||||
|
|
|
@ -3,21 +3,21 @@ inline static void PostIRQ(struct _dumb * dumb)
|
|||
}
|
||||
|
||||
inline static Byte InISAC(struct _dumb * dumb, char offset) {
|
||||
ByteOut(dumb->ioaddr,offset);
|
||||
return ByteIn(dumb->ioaddr+1);
|
||||
ByteOut(dumb->info.ioaddr,offset);
|
||||
return ByteIn(dumb->info.ioaddr+1);
|
||||
}
|
||||
inline static void OutISAC(struct _dumb * dumb, char offset, Byte data) {
|
||||
ByteOut(dumb->ioaddr,offset);
|
||||
ByteOut(dumb->ioaddr+1,data);
|
||||
ByteOut(dumb->info.ioaddr,offset);
|
||||
ByteOut(dumb->info.ioaddr+1,data);
|
||||
}
|
||||
|
||||
inline static Byte InHSCX(struct _dumb * dumb, unsigned char hscx, char offset) {
|
||||
ByteOut(dumb->ioaddr,offset+((hscx&1)?0:0x40));
|
||||
return ByteIn(dumb->ioaddr+2);
|
||||
ByteOut(dumb->info.ioaddr,offset+((hscx&1)?0:0x40));
|
||||
return ByteIn(dumb->info.ioaddr+2);
|
||||
}
|
||||
inline static void OutHSCX(struct _dumb * dumb, unsigned char hscx, char offset, Byte what) {
|
||||
ByteOut(dumb->ioaddr,offset+((hscx&1)?0:0x40));
|
||||
ByteOut(dumb->ioaddr+2,what);
|
||||
ByteOut(dumb->info.ioaddr,offset+((hscx&1)?0:0x40));
|
||||
ByteOut(dumb->info.ioaddr+2,what);
|
||||
}
|
||||
inline static Byte Slot(struct _dumb * dumb, unsigned char hscx) {
|
||||
printf(" Slot %d: ",hscx);
|
||||
|
@ -28,15 +28,15 @@ static int Init(struct _dumb * dumb) {
|
|||
int timout;
|
||||
long flags;
|
||||
|
||||
if(dumb->ioaddr == 0)
|
||||
if(dumb->info.ioaddr == 0)
|
||||
return -EINVAL;
|
||||
dumb->numHSCX = 2;
|
||||
save_flags(flags);
|
||||
timout = jiffies+(HZ/20)+1;
|
||||
ByteOut(dumb->ioaddr,0x80);
|
||||
ByteOut(dumb->info.ioaddr,0x80);
|
||||
sti();
|
||||
while(jiffies <= timout) ;
|
||||
ByteOut(dumb->ioaddr,0x00);
|
||||
ByteOut(dumb->info.ioaddr,0x00);
|
||||
timout = jiffies+(HZ/20)+1;
|
||||
while(jiffies <= timout) ;
|
||||
restore_flags(flags);
|
||||
|
@ -81,7 +81,7 @@ static void InitHSCX_(struct _dumb * dumb, unsigned char hscx)
|
|||
|
||||
static void ISAC_mode(struct _dumb * dumb, Byte mode, Byte listen)
|
||||
{
|
||||
unsigned long ms = SetSPL(dumb->ipl);
|
||||
unsigned long ms = SetSPL(dumb->info.ipl);
|
||||
|
||||
if(dumb->chan[0].m_in != NULL) {
|
||||
freemsg(dumb->chan[0].m_in);
|
||||
|
@ -95,7 +95,7 @@ static void ISAC_mode(struct _dumb * dumb, Byte mode, Byte listen)
|
|||
|
||||
switch(mode) {
|
||||
case M_OFF:
|
||||
printk(KERN_DEBUG "CIX0 0x3F\n");
|
||||
printk("%sCIX0 0x3F\n",KERN_DEBUG );
|
||||
ByteOutISAC(dumb,CIX0,0x3F);
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,0);
|
||||
dumb->chan[0].mode = mode;
|
||||
|
@ -103,10 +103,10 @@ static void ISAC_mode(struct _dumb * dumb, Byte mode, Byte listen)
|
|||
case M_STANDBY:
|
||||
if(dumb->chan[0].mode != M_STANDBY) {
|
||||
ByteOutISAC(dumb,MODE,0xCA);
|
||||
printk(KERN_DEBUG "CIX0 0x03\n");
|
||||
printk("%sCIX0 0x03\n",KERN_DEBUG );
|
||||
ByteOutISAC(dumb,CIX0,0x03);
|
||||
}
|
||||
else printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
||||
else printk("%sNoCIX0 %d\n",KERN_DEBUG ,dumb->chan[0].mode);
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
dumb->chan[0].mode = mode;
|
||||
dumb->chan[0].listen = 1;
|
||||
|
@ -115,10 +115,10 @@ else printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
|||
ByteOutISAC(dumb,MODE,0xCA);
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
if(dumb->chan[0].mode != M_HDLC) {
|
||||
printk(KERN_DEBUG "CIX0 0x27\n");
|
||||
printk("%sCIX0 0x27\n",KERN_DEBUG );
|
||||
ByteOutISAC(dumb,CIX0,0x27);
|
||||
} else {
|
||||
printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
||||
printk("%sNoCIX0 %d\n",KERN_DEBUG ,dumb->chan[0].mode);
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,1);
|
||||
}
|
||||
#if 0
|
||||
|
@ -136,7 +136,7 @@ printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
|||
|
||||
static void HSCX_mode(struct _dumb * dumb, unsigned char hscx, Byte mode, Byte listen)
|
||||
{
|
||||
unsigned long ms = SetSPL(dumb->ipl);
|
||||
unsigned long ms = SetSPL(dumb->info.ipl);
|
||||
if(dumb->chan[hscx].m_in != NULL) {
|
||||
freemsg(dumb->chan[hscx].m_in);
|
||||
dumb->chan[hscx].m_in = dumb->chan[hscx].m_in_run = NULL;
|
||||
|
|
|
@ -3,22 +3,22 @@ inline static void PostIRQ(struct _dumb * dumb)
|
|||
}
|
||||
|
||||
inline static Byte InISAC(struct _dumb * dumb, char offset) {
|
||||
ByteOut(dumb->ioaddr+1,offset);
|
||||
return ByteIn(dumb->ioaddr+2);
|
||||
ByteOut(dumb->info.ioaddr+1,offset);
|
||||
return ByteIn(dumb->info.ioaddr+2);
|
||||
}
|
||||
inline static void OutISAC(struct _dumb * dumb, char offset, Byte data) {
|
||||
ByteOut(dumb->ioaddr+1,offset);
|
||||
ByteOut(dumb->ioaddr+2,data);
|
||||
ByteOut(dumb->info.ioaddr+1,offset);
|
||||
ByteOut(dumb->info.ioaddr+2,data);
|
||||
}
|
||||
|
||||
inline static Byte InHSCX(struct _dumb * dumb, unsigned char hscx, char offset) {
|
||||
ByteOut(dumb->ioaddr+1,offset+((hscx&1)?0x80:0xC0));
|
||||
return ByteIn(dumb->ioaddr+2);
|
||||
ByteOut(dumb->info.ioaddr+1,offset+((hscx&1)?0x80:0xC0));
|
||||
return ByteIn(dumb->info.ioaddr+2);
|
||||
}
|
||||
|
||||
inline static void OutHSCX(struct _dumb * dumb, unsigned char hscx, char offset, Byte what) {
|
||||
ByteOut(dumb->ioaddr+1,offset+((hscx&1)?0x80:0xC0));
|
||||
ByteOut(dumb->ioaddr+2,what);
|
||||
ByteOut(dumb->info.ioaddr+1,offset+((hscx&1)?0x80:0xC0));
|
||||
ByteOut(dumb->info.ioaddr+2,what);
|
||||
}
|
||||
inline static Byte Slot(struct _dumb * dumb, unsigned char hscx) {
|
||||
printf(" Slot %d: ",hscx);
|
||||
|
@ -30,25 +30,25 @@ static int Init(struct _dumb * dumb) {
|
|||
long flags;
|
||||
char iflag;
|
||||
|
||||
if(dumb->ioaddr == 0)
|
||||
if(dumb->info.ioaddr == 0)
|
||||
return -EINVAL;
|
||||
dumb->numHSCX = 2;
|
||||
save_flags(flags);
|
||||
timout = jiffies+(HZ/20)+1;
|
||||
ByteOut(dumb->ioaddr,0xF0);
|
||||
ByteOut(dumb->info.ioaddr,0xF0);
|
||||
sti();
|
||||
while(jiffies <= timout) ;
|
||||
ByteOut(dumb->ioaddr,0xE0);
|
||||
ByteOut(dumb->info.ioaddr,0xE0);
|
||||
timout = jiffies+(HZ/20)+1;
|
||||
while(jiffies <= timout) ;
|
||||
restore_flags(flags);
|
||||
switch(ByteIn(dumb->ioaddr) & 0xE0) {
|
||||
switch(ByteIn(dumb->info.ioaddr) & 0xE0) {
|
||||
case 0: break;
|
||||
default:
|
||||
printf (" unknown card code %d ",ByteIn(dumb->ioaddr) >> 5);
|
||||
printf (" unknown card code %d ",ByteIn(dumb->info.ioaddr) >> 5);
|
||||
return -ENXIO;
|
||||
}
|
||||
switch(dumb->irq) {
|
||||
switch(dumb->info.irq) {
|
||||
case 3: iflag = 0; break;
|
||||
case 5: iflag = 4; break;
|
||||
case 7: iflag = 2; break;
|
||||
|
@ -59,10 +59,10 @@ static int Init(struct _dumb * dumb) {
|
|||
case 15:iflag = 3; break;
|
||||
case 0: iflag = 7; break;
|
||||
default:
|
||||
printf (" impossible irq %d ",dumb->irq);
|
||||
printf (" impossible irq %d ",dumb->info.irq);
|
||||
return -EINVAL;
|
||||
}
|
||||
ByteOut(dumb->ioaddr,(iflag<<5));
|
||||
ByteOut(dumb->info.ioaddr,(iflag<<5));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ static void InitHSCX_(struct _dumb * dumb, unsigned char hscx)
|
|||
|
||||
static int ISAC_mode(struct _dumb * dumb, Byte mode, Byte listen)
|
||||
{
|
||||
unsigned long ms = SetSPL(dumb->ipl);
|
||||
unsigned long ms = SetSPL(dumb->info.ipl);
|
||||
|
||||
if(dumb->chan[0].m_in != NULL) {
|
||||
freemsg(dumb->chan[0].m_in);
|
||||
|
@ -122,7 +122,7 @@ static int ISAC_mode(struct _dumb * dumb, Byte mode, Byte listen)
|
|||
|
||||
switch(mode) {
|
||||
case M_OFF:
|
||||
printk(KERN_DEBUG "CIX0 0x3F\n");
|
||||
printk("%sCIX0 0x3F\n",KERN_DEBUG );
|
||||
ByteOutISAC(dumb,CIX0,0x3F);
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,0);
|
||||
dumb->chan[0].mode = mode;
|
||||
|
@ -130,10 +130,10 @@ static int ISAC_mode(struct _dumb * dumb, Byte mode, Byte listen)
|
|||
case M_STANDBY:
|
||||
if(dumb->chan[0].mode != M_STANDBY) {
|
||||
ByteOutISAC(dumb,MODE,0xCA);
|
||||
printk(KERN_DEBUG "CIX0 0x03\n");
|
||||
printk("%sCIX0 0x03\n",KERN_DEBUG );
|
||||
ByteOutISAC(dumb,CIX0,0x03);
|
||||
}
|
||||
else printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
||||
else printk("%sNoCIX0 %d\n",KERN_DEBUG ,dumb->chan[0].mode);
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
dumb->chan[0].mode = mode;
|
||||
dumb->chan[0].listen = 1;
|
||||
|
@ -142,10 +142,10 @@ else printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
|||
ByteOutISAC(dumb,MODE,0xCA);
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
if(dumb->chan[0].mode != M_HDLC) {
|
||||
printk(KERN_DEBUG "CIX0 0x27\n");
|
||||
printk("%sCIX0 0x27\n",KERN_DEBUG );
|
||||
ByteOutISAC(dumb,CIX0,0x27);
|
||||
} else {
|
||||
printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
||||
printk("%sNoCIX0 %d\n",KERN_DEBUG ,dumb->chan[0].mode);
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,1);
|
||||
}
|
||||
#if 0
|
||||
|
@ -166,7 +166,7 @@ printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
|||
|
||||
static int HSCX_mode(struct _dumb * dumb, unsigned char hscx, Byte mode, Byte listen)
|
||||
{
|
||||
unsigned long ms = SetSPL(dumb->ipl);
|
||||
unsigned long ms = SetSPL(dumb->info.ipl);
|
||||
if(dumb->chan[hscx].m_in != NULL) {
|
||||
freemsg(dumb->chan[hscx].m_in);
|
||||
dumb->chan[hscx].m_in = dumb->chan[hscx].m_in_run = NULL;
|
||||
|
|
|
@ -3,21 +3,21 @@ inline static void PostIRQ(struct _dumb * dumb)
|
|||
}
|
||||
|
||||
inline static Byte InISAC(struct _dumb * dumb, char offset) {
|
||||
ByteOut(dumb->ioaddr+1,offset);
|
||||
return ByteIn(dumb->ioaddr+2);
|
||||
ByteOut(dumb->info.ioaddr+1,offset);
|
||||
return ByteIn(dumb->info.ioaddr+2);
|
||||
}
|
||||
inline static void OutISAC(struct _dumb * dumb, char offset, Byte data) {
|
||||
ByteOut(dumb->ioaddr+1,offset);
|
||||
ByteOut(dumb->ioaddr+2,data);
|
||||
ByteOut(dumb->info.ioaddr+1,offset);
|
||||
ByteOut(dumb->info.ioaddr+2,data);
|
||||
}
|
||||
|
||||
inline static Byte InHSCX(struct _dumb * dumb, unsigned char hscx, char offset) {
|
||||
ByteOut(dumb->ioaddr+1,offset+((hscx&1)?0x80:0xC0));
|
||||
return ByteIn(dumb->ioaddr+2);
|
||||
ByteOut(dumb->info.ioaddr+1,offset+((hscx&1)?0x80:0xC0));
|
||||
return ByteIn(dumb->info.ioaddr+2);
|
||||
}
|
||||
inline static void OutHSCX(struct _dumb * dumb, unsigned char hscx, char offset, Byte what) {
|
||||
ByteOut(dumb->ioaddr+1,offset+((hscx&1)?0x80:0xC0));
|
||||
ByteOut(dumb->ioaddr+2,what);
|
||||
ByteOut(dumb->info.ioaddr+1,offset+((hscx&1)?0x80:0xC0));
|
||||
ByteOut(dumb->info.ioaddr+2,what);
|
||||
}
|
||||
inline static Byte Slot(struct _dumb * dumb, unsigned char hscx) {
|
||||
printf(" Slot %d: ",hscx);
|
||||
|
@ -29,25 +29,25 @@ static int Init(struct _dumb * dumb) {
|
|||
long flags;
|
||||
char iflag;
|
||||
|
||||
if(dumb->ioaddr == 0)
|
||||
if(dumb->info.ioaddr == 0)
|
||||
return -EINVAL;
|
||||
dumb->numHSCX = 2;
|
||||
save_flags(flags);
|
||||
timout = jiffies+(HZ/20)+1;
|
||||
ByteOut(dumb->ioaddr,0xF0);
|
||||
ByteOut(dumb->info.ioaddr,0xF0);
|
||||
sti();
|
||||
while(jiffies <= timout) ;
|
||||
ByteOut(dumb->ioaddr,0xE0);
|
||||
ByteOut(dumb->info.ioaddr,0xE0);
|
||||
timout = jiffies+(HZ/20)+1;
|
||||
while(jiffies <= timout) ;
|
||||
restore_flags(flags);
|
||||
switch(ByteIn(dumb->ioaddr) & 0xE0) {
|
||||
switch(ByteIn(dumb->info.ioaddr) & 0xE0) {
|
||||
case 0: break;
|
||||
default:
|
||||
printf (" unknown card code %d ",ByteIn(dumb->ioaddr) >> 5);
|
||||
printf (" unknown card code %d ",ByteIn(dumb->info.ioaddr) >> 5);
|
||||
return -EIO;
|
||||
}
|
||||
switch(dumb->irq) {
|
||||
switch(dumb->info.irq) {
|
||||
case 3: iflag = 0; break;
|
||||
case 5: iflag = 4; break;
|
||||
case 7: iflag = 2; break;
|
||||
|
@ -57,10 +57,10 @@ static int Init(struct _dumb * dumb) {
|
|||
case 6: iflag = 5; break;
|
||||
case 0: iflag = 7; break;
|
||||
default:
|
||||
printf (" impossible irq %d ",dumb->irq);
|
||||
printf (" impossible irq %d ",dumb->info.irq);
|
||||
return -EINVAL;
|
||||
}
|
||||
ByteOut(dumb->ioaddr,(iflag<<5));
|
||||
ByteOut(dumb->info.ioaddr,(iflag<<5));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ static void InitHSCX_(struct _dumb * dumb, unsigned char hscx)
|
|||
|
||||
static int ISAC_mode(struct _dumb * dumb, Byte mode, Byte listen)
|
||||
{
|
||||
unsigned long ms = SetSPL(dumb->ipl);
|
||||
unsigned long ms = SetSPL(dumb->info.ipl);
|
||||
|
||||
if(dumb->chan[0].m_in != NULL) {
|
||||
freemsg(dumb->chan[0].m_in);
|
||||
|
@ -117,7 +117,7 @@ static int ISAC_mode(struct _dumb * dumb, Byte mode, Byte listen)
|
|||
|
||||
switch(mode) {
|
||||
case M_OFF:
|
||||
printk(KERN_DEBUG "CIX0 0x3F\n");
|
||||
printk("%sCIX0 0x3F\n",KERN_DEBUG );
|
||||
ByteOutISAC(dumb,CIX0,0x3F);
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,0);
|
||||
dumb->chan[0].mode = mode;
|
||||
|
@ -125,10 +125,10 @@ static int ISAC_mode(struct _dumb * dumb, Byte mode, Byte listen)
|
|||
case M_STANDBY:
|
||||
if(dumb->chan[0].mode != M_STANDBY) {
|
||||
ByteOutISAC(dumb,MODE,0xCA);
|
||||
printk(KERN_DEBUG "CIX0 0x03\n");
|
||||
printk("%sCIX0 0x03\n",KERN_DEBUG );
|
||||
ByteOutISAC(dumb,CIX0,0x03);
|
||||
}
|
||||
else printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
||||
else printk("%sNoCIX0 %d\n",KERN_DEBUG ,dumb->chan[0].mode);
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
dumb->chan[0].mode = mode;
|
||||
dumb->chan[0].listen = 1;
|
||||
|
@ -137,10 +137,10 @@ else printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
|||
ByteOutISAC(dumb,MODE,0xCA);
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
if(dumb->chan[0].mode != M_HDLC) {
|
||||
printk(KERN_DEBUG "CIX0 0x27\n");
|
||||
printk("%sCIX0 0x27\n",KERN_DEBUG );
|
||||
ByteOutISAC(dumb,CIX0,0x27);
|
||||
} else {
|
||||
printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
||||
printk("%sNoCIX0 %d\n",KERN_DEBUG ,dumb->chan[0].mode);
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,1);
|
||||
}
|
||||
#if 0
|
||||
|
@ -161,7 +161,7 @@ printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
|||
|
||||
static int HSCX_mode(struct _dumb * dumb, unsigned char hscx, Byte mode, Byte listen)
|
||||
{
|
||||
unsigned long ms = SetSPL(dumb->ipl);
|
||||
unsigned long ms = SetSPL(dumb->info.ipl);
|
||||
if(dumb->chan[hscx].m_in != NULL) {
|
||||
freemsg(dumb->chan[hscx].m_in);
|
||||
dumb->chan[hscx].m_in = dumb->chan[hscx].m_in_run = NULL;
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#if defined(_ncp16_)
|
||||
#define WIDE
|
||||
#endif
|
||||
|
||||
/* BSC
|
||||
|
||||
HSCX
|
||||
|
@ -54,16 +58,14 @@ CMDR 41
|
|||
#endif
|
||||
#include <sys/sysmacros.h>
|
||||
#include <stddef.h>
|
||||
#include "loader.h"
|
||||
|
||||
#ifdef M_UNIX
|
||||
#define ByteOut(_where,_what) iooutb(_where,_what)
|
||||
#define ByteIn(_where) ioinb(_where)
|
||||
#endif
|
||||
#ifdef linux
|
||||
#include <asm/io.h>
|
||||
#include <linux/ptrace.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/malloc.h>
|
||||
#define ByteOut(_where,_what) outb_p(_what,_where)
|
||||
#define ByteIn(_where) inb_p(_where)
|
||||
#endif
|
||||
|
@ -83,7 +85,7 @@ CMDR 41
|
|||
#define HSCX_R_FIFO_SIZE 32
|
||||
#define HSCX_W_FIFO_SIZE 32
|
||||
|
||||
#define FIFO(x) fifo[(x,0)] /* keep side effects but address at offset zero */
|
||||
#define FIFO(x) fifo[0] /* forget the address -- WARNING: side effects of x get lost */
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
|
@ -174,34 +176,27 @@ typedef struct _hscx {
|
|||
#endif
|
||||
|
||||
#ifdef linux
|
||||
|
||||
#ifdef _avm_
|
||||
#define CARDTYPE avm
|
||||
#include "avm_io.c"
|
||||
#endif
|
||||
|
||||
#ifdef _bsc_
|
||||
#define CARDTYPE bsc
|
||||
#include "bsc_io.c"
|
||||
#endif
|
||||
|
||||
#ifdef _ncp16_
|
||||
#define CARDTYPE ncp16
|
||||
#include "ncp16_io.c"
|
||||
#endif
|
||||
|
||||
#ifdef _ncp_
|
||||
#define CARDTYPE ncp
|
||||
#include "ncp_io.c"
|
||||
#endif
|
||||
|
||||
#ifdef _teles_
|
||||
#define CARDTYPE teles
|
||||
#include "teles_io.c"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define DUMBTIME 300 /* poll: times per second */
|
||||
|
||||
#define xxappxx(a,b) a##b
|
||||
|
@ -209,9 +204,9 @@ typedef struct _hscx {
|
|||
#define xxstrxx(a) #a
|
||||
#define STRING(a) xxstrxx(a) /* ditto */
|
||||
|
||||
void NAME(CARDTYPE,poll)(struct _dumb *dumb);
|
||||
void NAME(REALNAME,poll)(struct _dumb *dumb);
|
||||
#else
|
||||
void NAME(CARDTYPE,poll)(void *);
|
||||
void NAME(REALNAME,poll)(void *);
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -257,7 +252,7 @@ dumb_mode (struct _isdn1_card * card, short channel, char mode, char listen)
|
|||
|
||||
switch(channel) {
|
||||
case 0:
|
||||
DEBUG(info) printf(KERN_INFO "ISDN ISAC %s<%d>%s\n",mode?(mode==1?"standby":"up"):"down",mode,listen?" listen":"");
|
||||
DEBUG(info) printf("%sISDN ISAC %s<%d>%s\n",KERN_INFO ,mode?(mode==1?"standby":"up"):"down",mode,listen?" listen":"");
|
||||
ISAC_mode(dumb,mode,listen);
|
||||
if(mode == M_OFF) {
|
||||
int j;
|
||||
|
@ -267,10 +262,10 @@ dumb_mode (struct _isdn1_card * card, short channel, char mode, char listen)
|
|||
break;
|
||||
default:
|
||||
if(channel > 0 && channel <= dumb->numHSCX) {
|
||||
DEBUG(info) printf(KERN_INFO "ISDN HSCX%d %s<%d>%s\n",channel,mode?"up":"down",mode,listen?" listen":"");
|
||||
DEBUG(info) printf("%sISDN HSCX%d %s<%d>%s\n",KERN_INFO ,channel,mode?"up":"down",mode,listen?" listen":"");
|
||||
err = HSCX_mode(dumb,channel,mode,listen);
|
||||
if (err < 0) {
|
||||
printf(KERN_WARNING "ISDN err %d %d\n",channel, err);
|
||||
printf("%sISDN err %d %d\n",KERN_WARNING ,channel, err);
|
||||
splx(ms);
|
||||
return err;
|
||||
}
|
||||
|
@ -279,12 +274,12 @@ dumb_mode (struct _isdn1_card * card, short channel, char mode, char listen)
|
|||
dumb->chan[channel].maxblk = 10;
|
||||
break;
|
||||
} else {
|
||||
printf(KERN_WARNING "ISDN badChan %d\n",channel);
|
||||
printf("%sISDN badChan %d\n",KERN_WARNING ,channel);
|
||||
splx(ms);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
NAME(CARDTYPE,poll)(dumb);
|
||||
NAME(REALNAME,poll)(dumb);
|
||||
splx(ms);
|
||||
return err;
|
||||
}
|
||||
|
@ -297,7 +292,7 @@ dumb_prot (struct _isdn1_card * card, short channel, mblk_t * mp, int flags)
|
|||
ushort_t id;
|
||||
int error = 0;
|
||||
|
||||
DEBUG(info)printf("Prot chan %d flags 0%o\n",channel,flags);
|
||||
DEBUG(info)printf("%sProt chan %d flags 0%o\n",KERN_DEBUG,channel,flags);
|
||||
|
||||
if(!(flags & ~CHP_FROMSTACK)) {
|
||||
if ((error = m_getid (mp, &id)) != 0)
|
||||
|
@ -346,7 +341,7 @@ dumb_data (struct _isdn1_card * card, short channel, mblk_t * data)
|
|||
{
|
||||
struct _dumb * dumb = (struct _dumb *)card;
|
||||
S_enqueue(&dumb->chan[channel].q_out, data);
|
||||
NAME(CARDTYPE,poll)((struct _dumb *) card);
|
||||
NAME(REALNAME,poll)((struct _dumb *) card);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -410,7 +405,7 @@ static void ISAC_kick(struct _dumb * dumb)
|
|||
uchar_t *sendp = NULL;
|
||||
|
||||
unsigned long ms = SetSPL(dumb->ipl);
|
||||
DEBUG(isac) printf(KERN_DEBUG "K ");
|
||||
DEBUG(isac) printf("%sK ",KERN_DEBUG );
|
||||
if(dumb->chan[0].locked) {
|
||||
DEBUG(isac) printf("lck ");
|
||||
splx(ms);
|
||||
|
@ -458,8 +453,10 @@ static void ISAC_kick(struct _dumb * dumb)
|
|||
do {
|
||||
short thisb = (uchar_t *)sendb->b_wptr-sendp;
|
||||
if(thisb > ISAC_W_FIFO_SIZE-numb) thisb = ISAC_W_FIFO_SIZE-numb;
|
||||
for(;thisb > 0; thisb--)
|
||||
ByteOutISAC(dumb,FIFO(numb++),*sendp++);
|
||||
for(;thisb > 0; thisb--) {
|
||||
ByteOutISAC(dumb,FIFO(numb),*sendp);
|
||||
numb++; sendp++;
|
||||
}
|
||||
while(sendp >= (uchar_t *)sendb->b_wptr) {
|
||||
sendb = sendb->b_cont;
|
||||
if(sendb != NULL)
|
||||
|
@ -496,7 +493,7 @@ static void HSCX_kick(struct _dumb * dumb, u_char hscx)
|
|||
hdlc_buf bufp = &dumb->chan[hscx];
|
||||
|
||||
unsigned long ms = SetSPL(dumb->ipl);
|
||||
DEBUG(hscxout) printf(KERN_DEBUG "K.%d ",hscx);
|
||||
DEBUG(hscxout) printf("%sK.%d ",KERN_DEBUG ,hscx);
|
||||
if(bufp->locked) {
|
||||
DEBUG(hscxout) { printf("Lck\n"); }
|
||||
splx(ms);
|
||||
|
@ -550,7 +547,7 @@ static void HSCX_kick(struct _dumb * dumb, u_char hscx)
|
|||
#ifdef CONFIG_DEBUG_ISDN
|
||||
if(sendp == NULL) {
|
||||
DEBUG(hscxout)printf("\n");
|
||||
printf(KERN_WARNING "PNull! %p %p %p %p %p %d\n",sendb,sendp,bufp->m_out,bufp->m_out_run,bufp->p_out,numb);
|
||||
printf("%sPNull! %p %p %p %p %p %d\n",KERN_WARNING ,sendb,sendp,bufp->m_out,bufp->m_out_run,bufp->p_out,numb);
|
||||
goto exhopp;
|
||||
}
|
||||
#endif
|
||||
|
@ -559,8 +556,10 @@ static void HSCX_kick(struct _dumb * dumb, u_char hscx)
|
|||
short thisb = (uchar_t *)sendb->b_wptr-sendp;
|
||||
if(thisb > HSCX_W_FIFO_SIZE-numb) thisb = HSCX_W_FIFO_SIZE-numb;
|
||||
DEBUG(hscxout) printf(">%d ",thisb);
|
||||
for(;thisb > 0; thisb --)
|
||||
ByteOutHSCX(dumb,hscx,FIFO(numb++),*sendp++);
|
||||
for(;thisb > 0; thisb --) {
|
||||
ByteOutHSCX(dumb,hscx,FIFO(numb),*sendp);
|
||||
numb++; sendp++;
|
||||
}
|
||||
while(sendp >= (uchar_t *)sendb->b_wptr) {
|
||||
sendb = sendb->b_cont;
|
||||
DEBUG(hscxout)printf("=%p ",sendb);
|
||||
|
@ -578,7 +577,7 @@ static void HSCX_kick(struct _dumb * dumb, u_char hscx)
|
|||
ByteInHSCX(dumb,hscx,EXIR)&0x40
|
||||
#endif
|
||||
) { /* XDU */
|
||||
DEBUG(info) printf(KERN_DEBUG "Underrun HSCX.%d\n",hscx);
|
||||
DEBUG(info) printf("%sUnderrun HSCX.%d\n",KERN_DEBUG ,hscx);
|
||||
ByteOutHSCX(dumb,hscx,CMDR,0x01);
|
||||
bufp->m_out_run = bufp->m_out;
|
||||
bufp->p_out = bufp->m_out->b_rptr;
|
||||
|
@ -658,9 +657,9 @@ static void IRQ_HSCX_(struct _dumb * dumb, u_char hscx,
|
|||
hdlc_buf bufp = &dumb->chan[hscx];
|
||||
|
||||
#ifdef WIDE
|
||||
DEBUG(hscx) { printf(KERN_DEBUG "%c.%d %02x:%02x\n",(dumb->polled<0)?'X':(dumb->polled>0)?'P':'I',hscx, isr0,isr1); }
|
||||
DEBUG(hscx) { printf("%s%c.%d %02x:%02x\n",KERN_DEBUG ,(dumb->polled<0)?'X':(dumb->polled>0)?'P':'I',hscx, isr0,isr1); }
|
||||
#else
|
||||
DEBUG(hscx) { printf(KERN_DEBUG "%c.%d %02x\n",(dumb->polled<0)?'X':(dumb->polled>0)?'P':'I',hscx, Reason); }
|
||||
DEBUG(hscx) { printf("%s%c.%d %02x\n",KERN_DEBUG ,(dumb->polled<0)?'X':(dumb->polled>0)?'P':'I',hscx, Reason); }
|
||||
if (hasEX)
|
||||
#endif
|
||||
{
|
||||
|
@ -675,7 +674,7 @@ static void IRQ_HSCX_(struct _dumb * dumb, u_char hscx,
|
|||
EXIR & 0x80
|
||||
#endif
|
||||
) { /* XMR */
|
||||
DEBUG(info) { printf(KERN_DEBUG "Msg Repeat HSCX.%d\n",hscx); }
|
||||
DEBUG(info) { printf("%sMsg Repeat HSCX.%d\n",KERN_DEBUG ,hscx); }
|
||||
CEC(ByteInHSCX(dumb,hscx,STAR) & 0x04);
|
||||
if (ByteInHSCX(dumb,hscx,STAR) & 0x40) { /* XFW */
|
||||
#ifdef WIDE
|
||||
|
@ -700,7 +699,7 @@ static void IRQ_HSCX_(struct _dumb * dumb, u_char hscx,
|
|||
CEC(ByteInHSCX(dumb,hscx,STAR) & 0x04);
|
||||
if (bufp->mode >= M_HDLC) {
|
||||
DEBUG(info) {
|
||||
printf(KERN_DEBUG "Xmit Underrun HSCX.%d\n",hscx); }
|
||||
printf("%sXmit Underrun HSCX.%d\n",KERN_DEBUG ,hscx); }
|
||||
#if NEW_XMIT
|
||||
ByteOutHSCX(dumb,hscx,CMDR, 0x01); /* XRES */
|
||||
#ifdef WIDE
|
||||
|
@ -732,27 +731,27 @@ static void IRQ_HSCX_(struct _dumb * dumb, u_char hscx,
|
|||
}
|
||||
#ifdef WIDE
|
||||
DEBUG(hscx)if (isr0 & 0x08) { /* PLLA */
|
||||
DEBUG(info) { printf(KERN_WARNING "ISDN .PLLA\n"); }
|
||||
DEBUG(info) { printf("%sISDN .PLLA\n",KERN_WARNING ); }
|
||||
}
|
||||
DEBUG(hscx)if (isr0 & 0x20) { /* RSC */
|
||||
DEBUG(info) { printf(KERN_WARNING "ISDN .RSC\n"); }
|
||||
DEBUG(info) { printf("%sISDN .RSC\n",KERN_WARNING ); }
|
||||
}
|
||||
DEBUG(hscx)if (isr0 & 0x10) { /* PCE */
|
||||
DEBUG(info) { printf(KERN_WARNING "ISDN .PCE\n"); }
|
||||
DEBUG(info) { printf("%sISDN .PCE\n",KERN_WARNING ); }
|
||||
}
|
||||
DEBUG(hscx)if (isr0 & 0x40) { /* RFS */
|
||||
DEBUG(info) { printf(KERN_WARNING "ISDN .RFS\n"); }
|
||||
DEBUG(info) { printf("%sISDN .RFS\n",KERN_WARNING ); }
|
||||
}
|
||||
#else
|
||||
DEBUG(hscx)if (EXIR & 0x08) { /* CSC */
|
||||
DEBUG(info) { printf(KERN_WARNING "ISDN .CSC\n"); }
|
||||
DEBUG(info) { printf("%sISDN .CSC\n",KERN_WARNING ); }
|
||||
}
|
||||
DEBUG(hscx)if (EXIR & 0x04) { /* RFS */
|
||||
DEBUG(info) { printf(KERN_WARNING "ISDN .RFS\n"); }
|
||||
DEBUG(info) { printf("%sISDN .RFS\n",KERN_WARNING ); }
|
||||
}
|
||||
/* 0x02 and 0x01 are empty */
|
||||
DEBUG(hscx)if (EXIR & 0x20) { /* PCE */
|
||||
DEBUG(info) { printf(KERN_WARNING "ISDN .PCE\n"); }
|
||||
DEBUG(info) { printf("%sISDN .PCE\n",KERN_WARNING ); }
|
||||
}
|
||||
#endif
|
||||
if (
|
||||
|
@ -762,7 +761,7 @@ static void IRQ_HSCX_(struct _dumb * dumb, u_char hscx,
|
|||
EXIR & 0x10
|
||||
#endif
|
||||
) { /* RFO */
|
||||
DEBUG(info) { printf(KERN_DEBUG "Recv overflow HSCX.%d\n",hscx); }
|
||||
DEBUG(info) { printf("%sRecv overflow HSCX.%d\n",KERN_DEBUG ,hscx); }
|
||||
CEC(ByteInHSCX(dumb,hscx,STAR) & 0x04);
|
||||
if(
|
||||
#ifdef WIDE
|
||||
|
@ -853,7 +852,7 @@ static void IRQ_HSCX_(struct _dumb * dumb, u_char hscx,
|
|||
}
|
||||
}
|
||||
} else {
|
||||
DEBUG(info) { printf(KERN_DEBUG "Recv abort (%02x) HSCX.%d\n", RSTA,hscx); }
|
||||
DEBUG(info) { printf("%sRecv abort (%02x) HSCX.%d\n",KERN_DEBUG , RSTA,hscx); }
|
||||
if(bufp->m_in != NULL) {
|
||||
freemsg(bufp->m_in);
|
||||
bufp->m_in = bufp->m_in_run = NULL;
|
||||
|
@ -931,17 +930,17 @@ static void IRQ_HSCX_(struct _dumb * dumb, u_char hscx,
|
|||
}
|
||||
#ifdef WIDE
|
||||
DEBUG(hscx)if (isr1 & 0x08) { /* TIN */
|
||||
DEBUG(info) { printf(KERN_WARNING "ISDN .TIN\n"); }
|
||||
DEBUG(info) { printf("%sISDN .TIN\n",KERN_WARNING ); }
|
||||
}
|
||||
DEBUG(hscx)if (isr1 & 0x20) { /* AOLP */
|
||||
DEBUG(info) { printf(KERN_WARNING "ISDN .AOLP\n"); }
|
||||
DEBUG(info) { printf("%sISDN .AOLP\n",KERN_WARNING ); }
|
||||
}
|
||||
#else
|
||||
DEBUG(hscx)if (Reason & 0x20) { /* RSC */
|
||||
DEBUG(info) { printf(KERN_WARNING "ISDN .RSC\n"); }
|
||||
DEBUG(info) { printf("%sISDN .RSC\n",KERN_WARNING ); }
|
||||
}
|
||||
DEBUG(hscx)if (Reason & 0x08) { /* TIN */
|
||||
DEBUG(info) { printf(KERN_WARNING "ISDN .TIN\n"); }
|
||||
DEBUG(info) { printf("%sISDN .TIN\n",KERN_WARNING ); }
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -964,16 +963,16 @@ static void IRQ_ISAC(struct _dumb * dumb)
|
|||
Byte Reason;
|
||||
|
||||
while((Reason = ByteInISAC(dumb,ISTA))) {
|
||||
DEBUG(isac) { printf(KERN_DEBUG "%c %02x\n",(dumb->polled<0)?'X':(dumb->polled>0)?'P':'I',Reason); }
|
||||
DEBUG(isac) { printf("%s%c %02x\n",KERN_DEBUG ,(dumb->polled<0)?'X':(dumb->polled>0)?'P':'I',Reason); }
|
||||
if (Reason & 0x04) { /* CISQ */
|
||||
Byte CIR = ByteInISAC(dumb,CIR0);
|
||||
|
||||
if (CIR & 0x80) { /* SQC */
|
||||
DEBUG(info) { printf(KERN_WARNING "ISDN .SQC %x\n",ByteInISAC(dumb,SQRR)); }
|
||||
DEBUG(info) { printf("%sISDN .SQC %x\n",KERN_WARNING ,ByteInISAC(dumb,SQRR)); }
|
||||
}
|
||||
if (CIR & 0x03) {
|
||||
CIR = ((CIR >> 2) & 0x0F);
|
||||
DEBUG(info) printf(KERN_DEBUG "ISDN CIR %01x",CIR);
|
||||
DEBUG(info) printf("%sISDN CIR %01x",KERN_DEBUG ,CIR);
|
||||
if (dumb->polled >= 0) {
|
||||
if ((CIR == 0x0C) || (CIR == 0x0D)) {
|
||||
DEBUG(info) printf(" up");
|
||||
|
@ -994,7 +993,7 @@ static void IRQ_ISAC(struct _dumb * dumb)
|
|||
dumb->circ++;
|
||||
}
|
||||
}
|
||||
DEBUG(info) printf(KERN_DEBUG "\n");
|
||||
DEBUG(info) printf("\n");
|
||||
#if 0
|
||||
ByteOutISAC(dumb,CMDR,0x41);
|
||||
Reason &=~ 0xC0;
|
||||
|
@ -1005,7 +1004,7 @@ static void IRQ_ISAC(struct _dumb * dumb)
|
|||
Byte EXIR = ByteInISAC(dumb,EXIR);
|
||||
DEBUG(isac) { printf(". %x", EXIR); }
|
||||
if (EXIR & 0x80) { /* XMR */
|
||||
DEBUG(info) { printf(KERN_DEBUG "MsgRepeat ISAC\n"); }
|
||||
DEBUG(info) { printf("%sMsgRepeat ISAC\n",KERN_DEBUG ); }
|
||||
CEC(ByteInISAC(dumb,STAR) & 0x04);
|
||||
if (ByteInISAC(dumb,STAR) & 0x40) { /* XFW */
|
||||
Reason |= 0x10; /* also set XPR bit */
|
||||
|
@ -1019,7 +1018,7 @@ static void IRQ_ISAC(struct _dumb * dumb)
|
|||
if (EXIR & 0x40) { /* XDU */
|
||||
CEC(ByteInISAC(dumb,STAR) & 0x04);
|
||||
if (dumb->chan[0].mode >= M_HDLC) {
|
||||
DEBUG(info) { printf(KERN_DEBUG "Xmit Underrun ISAC\n"); }
|
||||
DEBUG(info) { printf("%sXmit Underrun ISAC\n",KERN_DEBUG ); }
|
||||
#if NEW_XMIT
|
||||
ByteOutISAC(dumb,CMDR, 0x01); /* XRES */
|
||||
Reason |= 0x10;
|
||||
|
@ -1038,10 +1037,10 @@ static void IRQ_ISAC(struct _dumb * dumb)
|
|||
}
|
||||
}
|
||||
DEBUG(isac)if (EXIR & 0x20) { /* PCE */
|
||||
DEBUG(info) { printf(KERN_WARNING "ISDN .PCE\n"); }
|
||||
DEBUG(info) { printf("%sISDN .PCE\n",KERN_WARNING ); }
|
||||
}
|
||||
if (EXIR & 0x10) { /* RFO */
|
||||
DEBUG(info) { printf(KERN_DEBUG "Recv overflow ISAC (%02x)\n", EXIR); }
|
||||
DEBUG(info) { printf("%sRecv overflow ISAC (%02x)\n",KERN_DEBUG , EXIR); }
|
||||
CEC(ByteInISAC(dumb,STAR) & 0x04);
|
||||
if(Reason & 0xC0) {
|
||||
ByteOutISAC(dumb,CMDR, 0xC0); /* RMC|RHR */
|
||||
|
@ -1054,10 +1053,10 @@ static void IRQ_ISAC(struct _dumb * dumb)
|
|||
}
|
||||
}
|
||||
DEBUG(isac)if (EXIR & 0x08) { /* CSC */
|
||||
DEBUG(info) { printf(KERN_WARNING "ISDN .CSC\n"); }
|
||||
DEBUG(info) { printf("%sISDN .CSC\n",KERN_WARNING ); }
|
||||
}
|
||||
DEBUG(isac)if (EXIR & 0x04) { /* RFS */
|
||||
DEBUG(info) { printf(KERN_WARNING "ISDN .RFS\n"); }
|
||||
DEBUG(info) { printf("%sISDN .RFS\n",KERN_WARNING ); }
|
||||
}
|
||||
/* 0x02 and 0x01 are empty */
|
||||
}
|
||||
|
@ -1073,7 +1072,7 @@ static void IRQ_ISAC(struct _dumb * dumb)
|
|||
blen = (xblen & (ISAC_R_FIFO_SIZE-1));
|
||||
xblen += (ByteInISAC(dumb,RBCH) & 0x0F) << 8;
|
||||
if(blen == 1) {
|
||||
DEBUG(isac) printf(KERN_DEBUG ".R-%d\n",xblen);
|
||||
DEBUG(isac) printf("%s.R-%d\n",KERN_DEBUG ,xblen);
|
||||
if((recvb = dumb->chan[0].m_in_run) != NULL) {
|
||||
mblk_t *msg = dumb->chan[0].m_in;
|
||||
dumb->chan[0].m_in = dumb->chan[0].m_in_run = NULL;
|
||||
|
@ -1086,7 +1085,7 @@ static void IRQ_ISAC(struct _dumb * dumb)
|
|||
} else {
|
||||
if(blen == 0)
|
||||
blen = ISAC_R_FIFO_SIZE;
|
||||
DEBUG(isac) printf(KERN_DEBUG ".R=%d\n",xblen);
|
||||
DEBUG(isac) printf("%s.R=%d\n",KERN_DEBUG ,xblen);
|
||||
if ((recvb = dumb->chan[0].m_in_run) != NULL) {
|
||||
DEBUG(isac)printf("a%d ",dsize(dumb->chan[0].m_in));
|
||||
if ((recvp = (uchar_t *)recvb->b_wptr) + blen > (uchar_t *)DATA_END(recvb))
|
||||
|
@ -1125,7 +1124,7 @@ static void IRQ_ISAC(struct _dumb * dumb)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
DEBUG(info) { printf(KERN_DEBUG "Recv abort (%x)\n",RSTA); }
|
||||
DEBUG(info) { printf("%sRecv abort (%x)\n",KERN_DEBUG ,RSTA); }
|
||||
if(dumb->chan[0].m_in != NULL) {
|
||||
freemsg(dumb->chan[0].m_in);
|
||||
dumb->chan[0].m_in = dumb->chan[0].m_in_run = NULL;
|
||||
|
@ -1174,10 +1173,10 @@ static void IRQ_ISAC(struct _dumb * dumb)
|
|||
}
|
||||
}
|
||||
if (Reason & 0x20) { /* RSC */
|
||||
DEBUG(info) { printf(KERN_WARNING "ISDN .RSC\n"); }
|
||||
DEBUG(info) { printf("%sISDN .RSC\n",KERN_WARNING ); }
|
||||
}
|
||||
if (Reason & 0x08) { /* TIN */
|
||||
DEBUG(info) { printf(KERN_WARNING "ISDN .TIN\n"); }
|
||||
DEBUG(info) { printf("%sISDN .TIN\n",KERN_WARNING ); }
|
||||
#if 0
|
||||
ByteOutISAC(dumb,TIMR,0x11);
|
||||
ByteOutISAC(dumb,CMDR,0x10); /* start timer */
|
||||
|
@ -1227,7 +1226,7 @@ dumbintr(int irq, struct pt_regs *regs)
|
|||
{
|
||||
struct _dumb *dumb;
|
||||
for(dumb=dumbmap[irq];dumb != NULL;dumb = dumb->next) {
|
||||
if(dumb->irq == irq) {
|
||||
if(dumb->info.irq == irq) {
|
||||
dumb->polled --;
|
||||
IRQ_HSCX(dumb);
|
||||
IRQ_ISAC(dumb);
|
||||
|
@ -1237,7 +1236,7 @@ dumbintr(int irq, struct pt_regs *regs)
|
|||
}
|
||||
}
|
||||
for(dumb=dumbmap[irq];dumb != NULL;dumb = dumb->next) {
|
||||
if(dumb->irq == irq) {
|
||||
if(dumb->info.irq == irq) {
|
||||
toggle_on(dumb);
|
||||
}
|
||||
}
|
||||
|
@ -1245,9 +1244,9 @@ dumbintr(int irq, struct pt_regs *regs)
|
|||
|
||||
|
||||
#ifdef linux
|
||||
void NAME(CARDTYPE,poll)(struct _dumb *dumb)
|
||||
void NAME(REALNAME,poll)(struct _dumb *dumb)
|
||||
#else
|
||||
void NAME(CARDTYPE,poll)(void *nix)
|
||||
void NAME(REALNAME,poll)(void *nix)
|
||||
#endif
|
||||
{
|
||||
#ifndef linux
|
||||
|
@ -1274,8 +1273,8 @@ void NAME(CARDTYPE,poll)(void *nix)
|
|||
toggle_on(dumb);
|
||||
splx(ms);
|
||||
#if 0 /* def linux */
|
||||
if(dumb->irq != 0)
|
||||
unblock_irq(dumb->irq);
|
||||
if(dumb->info.irq != 0)
|
||||
unblock_irq(dumb->info.irq);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -1284,24 +1283,34 @@ void NAME(CARDTYPE,poll)(void *nix)
|
|||
#ifdef linux
|
||||
static void dumbtimer(struct _dumb *dumb)
|
||||
{
|
||||
NAME(CARDTYPE,poll)(dumb);
|
||||
NAME(REALNAME,poll)(dumb);
|
||||
#if 0
|
||||
if(dumb->countme++ < 10) {
|
||||
printf(" -(%d):%02x %02x %02x- ",dumb->irq,ByteInISAC(dumb,STAR),ByteInISAC(dumb,ISTA),ByteInISAC(dumb,CIR0));
|
||||
printf(" -(%d):%02x %02x %02x- ",dumb->info.irq,ByteInISAC(dumb,STAR),ByteInISAC(dumb,ISTA),ByteInISAC(dumb,CIR0));
|
||||
}
|
||||
#endif
|
||||
#ifdef NEW_TIMEOUT
|
||||
dumb->timer =
|
||||
#endif
|
||||
timeout((void *)dumbtimer,dumb,(dumb->irq == 0) ? HZ/DUMBTIME+1 : HZ/2);
|
||||
timeout((void *)dumbtimer,dumb,(dumb->info.irq == 0) ? HZ/DUMBTIME+1 : HZ/2);
|
||||
}
|
||||
#endif
|
||||
|
||||
int NAME(CARDTYPE,init)(struct _dumb *dumb)
|
||||
int NAME(REALNAME,init)(struct cardinfo *inf)
|
||||
{
|
||||
extern caddr_t sptalloc();
|
||||
int err;
|
||||
struct _dumb *dumb;
|
||||
|
||||
dumb = kmalloc(sizeof(*dumb),GFP_KERNEL);
|
||||
if(dumb == NULL) {
|
||||
printf("???: No Memory\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
bzero(dumb,sizeof(*dumb));
|
||||
|
||||
dumb->numHSCX = 1;
|
||||
dumb->info = *inf;
|
||||
dumb->infoptr = inf;
|
||||
dumb->card.ctl = dumb;
|
||||
dumb->card.modes = (1<<M_HDLC)| (1<<M_HDLC_7H)| (1<<M_HDLC_7L)| (1<<M_TRANSPARENT)| (1<<M_TRANS_ALAW)| (1<<M_TRANS_V110)| (1<<M_TRANS_HDLC);
|
||||
dumb->card.ch_mode = dumb_mode;
|
||||
|
@ -1312,12 +1321,13 @@ int NAME(CARDTYPE,init)(struct _dumb *dumb)
|
|||
dumb->card.poll = NULL;
|
||||
dumb->polled = -1;
|
||||
|
||||
printf("ISDN: " STRING(CARDTYPE) " at mem %lx io 0x%x irq %d: ",dumb->memaddr,dumb->ioaddr,dumb->irq);
|
||||
printf("%sISDN: " STRING(REALNAME) " at mem 0x%lx io 0x%x irq %d: ",KERN_DEBUG, dumb->info.memaddr,dumb->info.ioaddr,dumb->info.irq);
|
||||
|
||||
if((err = Init(dumb)) < 0) {
|
||||
printf("Card not initializable.\n");
|
||||
if(err == 0)
|
||||
err = -EIO;
|
||||
kfree(dumb);
|
||||
return err;
|
||||
}
|
||||
dumb->card.nr_chans = dumb->numHSCX;
|
||||
|
@ -1328,60 +1338,67 @@ int NAME(CARDTYPE,init)(struct _dumb *dumb)
|
|||
|
||||
if((err = ISACpresent(dumb)) < 0) {
|
||||
printf("Card not responding.\n");
|
||||
kfree(dumb);
|
||||
return err;
|
||||
}
|
||||
#ifndef M_UNIX
|
||||
#ifdef linux
|
||||
if((dumb->irq != 0) && request_irq(dumb->irq,dumbintr,SA_INTERRUPT,"ISDN")) {
|
||||
if((dumb->info.irq != 0) && (dumbmap[dumb->info.irq] == NULL) && request_irq(dumb->info.irq,dumbintr,SA_INTERRUPT,"ISDN")) {
|
||||
printf("IRQ not available.\n");
|
||||
kfree(dumb);
|
||||
return -EEXIST;
|
||||
}
|
||||
#endif
|
||||
NAME(CARDTYPE,poll)(dumb);
|
||||
if((err = isdn2_register(&dumb->card, dumb->ID)) != 0) {
|
||||
NAME(REALNAME,poll)(dumb);
|
||||
if((err = isdn2_register(&dumb->card, dumb->info.ID)) != 0) {
|
||||
printf("not installed (ISDN_2), err %d\n",err);
|
||||
kfree(dumb);
|
||||
return err;
|
||||
}
|
||||
|
||||
dumb->polled = 1;
|
||||
#ifdef linux
|
||||
if(dumb->irq == 0) {
|
||||
if(dumb->info.irq == 0) {
|
||||
printf("polling; ");
|
||||
}
|
||||
#endif
|
||||
printf("installed at ");
|
||||
if(dumb->memaddr != 0)
|
||||
printf("mem 0x%lx ",dumb->memaddr);
|
||||
if(dumb->ioaddr != 0)
|
||||
printf("io 0x%x ",dumb->ioaddr);
|
||||
if(dumb->irq != 0)
|
||||
printf("irq %d.\n",dumb->irq);
|
||||
if(dumb->info.memaddr != 0)
|
||||
printf("mem 0x%lx ",dumb->info.memaddr);
|
||||
if(dumb->info.ioaddr != 0)
|
||||
printf("io 0x%x ",dumb->info.ioaddr);
|
||||
if(dumb->info.irq != 0)
|
||||
printf("irq %d.\n",dumb->info.irq);
|
||||
else
|
||||
printf("polled.\n");
|
||||
dumb->next = dumbmap[dumb->irq];
|
||||
dumbmap[dumb->irq] = dumb;
|
||||
dumb->next = dumbmap[dumb->info.irq];
|
||||
dumbmap[dumb->info.irq] = dumb;
|
||||
#ifdef linux
|
||||
dumbtimer(dumb);
|
||||
#endif
|
||||
#endif /* M_UNIX */
|
||||
MOD_INC_USE_COUNT;
|
||||
MORE_USE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
NAME(CARDTYPE,exit)(struct _dumb *dumb)
|
||||
NAME(REALNAME,exit)(struct cardinfo *inf)
|
||||
{
|
||||
int j;
|
||||
unsigned long ms = SetSPL(dumb->ipl);
|
||||
struct _dumb **ndumb = &dumbmap[dumb->irq];
|
||||
unsigned long ms = SetSPL(inf->ipl);
|
||||
struct _dumb *dumb = NULL;
|
||||
struct _dumb **ndumb = &dumbmap[inf->irq];
|
||||
while(*ndumb != NULL) {
|
||||
if(*ndumb == dumb) {
|
||||
if((*ndumb)->infoptr == inf) {
|
||||
dumb = *ndumb;
|
||||
*ndumb = dumb->next;
|
||||
break;
|
||||
}
|
||||
ndumb = &((*ndumb)->next);
|
||||
}
|
||||
if(dumb == NULL) {
|
||||
printf("%s??? No entry\n",KERN_DEBUG);
|
||||
return;
|
||||
}
|
||||
#ifdef NEW_TIMEOUT
|
||||
untimeout(dumb->timer);
|
||||
#else
|
||||
|
@ -1396,11 +1413,12 @@ NAME(CARDTYPE,exit)(struct _dumb *dumb)
|
|||
ByteOutHSCX(dumb,j,MASK,0xFF);
|
||||
#endif
|
||||
}
|
||||
if(dumb->irq > 0)
|
||||
free_irq(dumb->irq);
|
||||
if((dumb->info.irq > 0) && (dumbmap[dumb->info.irq] == NULL))
|
||||
free_irq(dumb->info.irq);
|
||||
isdn2_unregister(&dumb->card);
|
||||
splx(ms);
|
||||
MOD_DEC_USE_COUNT;
|
||||
kfree(dumb);
|
||||
LESS_USE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,10 +4,11 @@
|
|||
#include "isdn_12.h"
|
||||
#include "smallq.h"
|
||||
#include <stream.h>
|
||||
#include "loader.h"
|
||||
|
||||
extern int dumb_num;
|
||||
|
||||
#define DEBUG(_x) if((DEBUG_##_x) & dumb->debug)
|
||||
#define DEBUG(_x) if((DEBUG_##_x) & dumb->info.debug)
|
||||
#define DEBUG_memory 0x01
|
||||
#define DEBUG_uart 0x00
|
||||
#define DEBUG_isac 0x04
|
||||
|
@ -32,18 +33,14 @@ typedef struct _hdlc_buf {
|
|||
|
||||
typedef struct _dumb {
|
||||
struct _isdn1_card card; /* must be first */
|
||||
|
||||
long memaddr;
|
||||
short ioaddr;
|
||||
unsigned char irq, ipl, numHSCX;
|
||||
unsigned long ID;
|
||||
unsigned int debug;
|
||||
struct cardinfo info, *infoptr;
|
||||
|
||||
struct _hdlc_buf chan[MAX_B+1];
|
||||
#ifdef NEW_TIMEOUT
|
||||
long timer;
|
||||
#endif
|
||||
struct _dumb *next;
|
||||
int numHSCX;
|
||||
long countme; signed char polled; char circ;
|
||||
} *__dumb;
|
||||
|
||||
|
|
|
@ -3,17 +3,17 @@ inline static void PostIRQ(struct _dumb * dumb)
|
|||
}
|
||||
|
||||
static inline Byte InISAC(struct _dumb * dumb, u_char offset) {
|
||||
return *(Byte *)(dumb->memaddr+0x100+((offset&1)?0x1FF:0)+offset);
|
||||
return *(Byte *)(dumb->info.memaddr+0x100+((offset&1)?0x1FF:0)+offset);
|
||||
}
|
||||
static inline void OutISAC(struct _dumb * dumb, u_char offset, Byte data) {
|
||||
*(Byte *)(dumb->memaddr+0x100+((offset&1)?0x1FF:0)+offset) = data;
|
||||
*(Byte *)(dumb->info.memaddr+0x100+((offset&1)?0x1FF:0)+offset) = data;
|
||||
}
|
||||
|
||||
static inline Byte InHSCX(struct _dumb * dumb, u_char hscx, u_char offset) {
|
||||
return *(Byte *)(dumb->memaddr+0x180+((offset&1)?0x1FF:0)+((hscx&1)?0:0x40)+offset);
|
||||
return *(Byte *)(dumb->info.memaddr+0x180+((offset&1)?0x1FF:0)+((hscx&1)?0:0x40)+offset);
|
||||
}
|
||||
static inline void OutHSCX(struct _dumb * dumb, u_char hscx, u_char offset, Byte data) {
|
||||
*(Byte *)(dumb->memaddr+0x180+((offset&1)?0x1FF:0)+((hscx&1)?0:0x40)+offset) = data;
|
||||
*(Byte *)(dumb->info.memaddr+0x180+((offset&1)?0x1FF:0)+((hscx&1)?0:0x40)+offset) = data;
|
||||
}
|
||||
static inline Byte Slot(struct _dumb * dumb, u_char hscx) {
|
||||
return (hscx&1) ? 0x03 : 0x03; /* was 3 / 7 */
|
||||
|
@ -24,22 +24,22 @@ Init(struct _dumb * dumb) {
|
|||
int timout;
|
||||
long flags;
|
||||
|
||||
if(dumb->memaddr == 0)
|
||||
if(dumb->info.memaddr == 0)
|
||||
return -EINVAL;
|
||||
dumb->numHSCX = 2;
|
||||
save_flags(flags);
|
||||
if(dumb->ipl) {
|
||||
if(dumb->info.ipl) {
|
||||
int ioaddr;
|
||||
Byte cfval;
|
||||
switch(dumb->ipl) {
|
||||
default: printk("ipl %d unknown: ",dumb->ipl); return 0;
|
||||
switch(dumb->info.ipl) {
|
||||
default: printk("ipl %d unknown: ",dumb->info.ipl); return 0;
|
||||
case 1: ioaddr = 0xd80; break;
|
||||
case 2: ioaddr = 0xe80; break;
|
||||
case 3: ioaddr = 0xf80; break;
|
||||
case 4: ioaddr = 0xc80; break; /* may cause conflicts (motherboard range) */
|
||||
}
|
||||
switch(dumb->irq) {
|
||||
default: printk("irq %d not possible: ",dumb->irq); return -EINVAL;
|
||||
switch(dumb->info.irq) {
|
||||
default: printk("irq %d not possible: ",dumb->info.irq); return -EINVAL;
|
||||
case 2: cfval = 0x00; break;
|
||||
case 3: cfval = 0x02; break;
|
||||
case 4: cfval = 0x04; break;
|
||||
|
@ -49,9 +49,9 @@ Init(struct _dumb * dumb) {
|
|||
case 12: cfval = 0x0C; break;
|
||||
case 15: cfval = 0x0E; break;
|
||||
}
|
||||
if(dumb->memaddr & ~0xDE000) { printk("memaddr %lx not possible: ",dumb->memaddr); return 0; }
|
||||
if(~dumb->memaddr & 0xC0000) { printk("memaddr %lx not possible: ",dumb->memaddr); return 0; }
|
||||
cfval |= ((dumb->memaddr >> 9) & 0xF0);
|
||||
if(dumb->info.memaddr & ~0xDE000) { printk("info.memaddr %lx not possible: ",dumb->info.memaddr); return 0; }
|
||||
if(~dumb->info.memaddr & 0xC0000) { printk("info.memaddr %lx not possible: ",dumb->info.memaddr); return 0; }
|
||||
cfval |= ((dumb->info.memaddr >> 9) & 0xF0);
|
||||
if(ByteIn(ioaddr+0) != 0x51) { return 0; }
|
||||
if(ByteIn(ioaddr+1) != 0x93) { return 0; }
|
||||
if(ByteIn(ioaddr+2) != 0x1E) { return 0; }
|
||||
|
@ -66,10 +66,10 @@ Init(struct _dumb * dumb) {
|
|||
restore_flags(flags);
|
||||
}
|
||||
timout = jiffies+(HZ/5)+1;
|
||||
*(Byte *)(dumb->memaddr + 0x80) = 0;
|
||||
*(Byte *)(dumb->info.memaddr + 0x80) = 0;
|
||||
sti();
|
||||
while(jiffies <= timout) ;
|
||||
*(Byte *)(dumb->memaddr + 0x80) = 1;
|
||||
*(Byte *)(dumb->info.memaddr + 0x80) = 1;
|
||||
timout = jiffies+(HZ/5)+1;
|
||||
while(jiffies <= timout) ;
|
||||
restore_flags(flags);
|
||||
|
@ -79,7 +79,7 @@ Init(struct _dumb * dumb) {
|
|||
static void
|
||||
ISAC_mode(struct _dumb * dumb, Byte mode, Byte listen)
|
||||
{
|
||||
unsigned long ms = SetSPL(dumb->ipl);
|
||||
unsigned long ms = SetSPL(dumb->info.ipl);
|
||||
static Byte xmode = 0xFF;
|
||||
|
||||
if(dumb->chan[0].m_in != NULL) {
|
||||
|
@ -94,7 +94,7 @@ static Byte xmode = 0xFF;
|
|||
|
||||
switch(mode) {
|
||||
case M_OFF:
|
||||
DEBUG(info) printk(KERN_DEBUG "ISDN CIX0 0x3Fn\n");
|
||||
DEBUG(info) printk("%sISDN CIX0 0x3Fn\n",KERN_DEBUG );
|
||||
if(xmode != mode)
|
||||
ByteOutISAC(dumb,CIX0,0x3F &3);
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,0);
|
||||
|
@ -103,7 +103,7 @@ static Byte xmode = 0xFF;
|
|||
case M_STANDBY:
|
||||
if(dumb->chan[0].mode != M_STANDBY) {
|
||||
ByteOutISAC(dumb,MODE,0xC9);
|
||||
DEBUG(info) printk(KERN_DEBUG "ISDN CIX0 0x03\n");
|
||||
DEBUG(info) printk("%sISDN CIX0 0x03\n",KERN_DEBUG );
|
||||
ByteOutISAC(dumb,CIX0,0x03);
|
||||
}
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
|
@ -114,11 +114,11 @@ static Byte xmode = 0xFF;
|
|||
ByteOutISAC(dumb,MODE,0xC9);
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
if(dumb->chan[0].mode != M_HDLC) {
|
||||
DEBUG(info) printk(KERN_DEBUG "ISDN CIX0 0x27\n");
|
||||
DEBUG(info) printk("%sISDN CIX0 0x27\n",KERN_DEBUG );
|
||||
ByteOutISAC(dumb,CIX0,0x27);
|
||||
} else {
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,1);
|
||||
DEBUG(info) printk(KERN_DEBUG "ISDN noCIX0 0x27\n");
|
||||
DEBUG(info) printk("%sISDN noCIX0 0x27\n",KERN_DEBUG );
|
||||
}
|
||||
#if 0
|
||||
ByteOutISAC(dumb,TIMR,0x11);
|
||||
|
@ -128,7 +128,7 @@ static Byte xmode = 0xFF;
|
|||
dumb->chan[0].listen = 0;
|
||||
break;
|
||||
default:
|
||||
printf("ISAC unknown mode %x\n",mode);
|
||||
printf("%sISAC unknown mode %x\n",KERN_DEBUG,mode);
|
||||
}
|
||||
splx(ms);
|
||||
xmode = mode;
|
||||
|
@ -137,7 +137,7 @@ static Byte xmode = 0xFF;
|
|||
static int
|
||||
HSCX_mode(struct _dumb * dumb, u_char hscx, Byte mode, Byte listen)
|
||||
{
|
||||
unsigned long ms = SetSPL(dumb->ipl);
|
||||
unsigned long ms = SetSPL(dumb->info.ipl);
|
||||
if(dumb->chan[hscx].m_in != NULL) {
|
||||
freemsg(dumb->chan[hscx].m_in);
|
||||
dumb->chan[hscx].m_in = dumb->chan[hscx].m_in_run = NULL;
|
||||
|
@ -209,7 +209,7 @@ HSCX_mode(struct _dumb * dumb, u_char hscx, Byte mode, Byte listen)
|
|||
dumb->chan[hscx].listen = listen;
|
||||
break;
|
||||
default:
|
||||
printf("HSCX unknown mode %x\n",mode);
|
||||
printf("%sHSCX unknown mode %x\n",KERN_DEBUG,mode);
|
||||
}
|
||||
|
||||
splx(ms);
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
#include "f_module.h"
|
||||
#include "isdn_limits.h"
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef linux
|
||||
#include <linux/sched.h>
|
||||
#endif
|
||||
|
||||
#include "shell.h"
|
||||
#include "loader.h"
|
||||
|
||||
#ifndef CARDTYPE
|
||||
#error "You have to define CARDTYPE for this to work."
|
||||
|
@ -17,10 +13,10 @@
|
|||
#define xxstrxx(a) #a
|
||||
#define STRING(a) xxstrxx(a) /* ditto */
|
||||
|
||||
extern int NAME(CARDTYPE,init)(struct _dumb *dumb);
|
||||
extern void NAME(CARDTYPE,exit)(struct _dumb *dumb);
|
||||
extern int NAME(CARDTYPE,init)(struct cardinfo *inf);
|
||||
extern void NAME(CARDTYPE,exit)(struct cardinfo *inf);
|
||||
|
||||
struct _dumb dumb;
|
||||
struct cardinfo inf;
|
||||
|
||||
int irq = 0;
|
||||
int mem = 0;
|
||||
|
@ -33,21 +29,21 @@ int debug = 0;
|
|||
static int do_init_module(void)
|
||||
{
|
||||
if(name == 0) {
|
||||
printf("You must name this card: insmod xxx.o name=$(name Foo0)\n");
|
||||
printf("You must name this card: insmod xxx.o name=$(cardname Foo0)\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
dumb.irq = irq;
|
||||
dumb.ipl = ipl;
|
||||
dumb.ioaddr = io;
|
||||
dumb.memaddr = mem;
|
||||
dumb.ID = name;
|
||||
dumb.debug = debug;
|
||||
return NAME(CARDTYPE,init)(&dumb);
|
||||
inf.irq = irq;
|
||||
inf.ipl = ipl;
|
||||
inf.ioaddr = io;
|
||||
inf.memaddr = mem;
|
||||
inf.ID = name;
|
||||
inf.debug = debug;
|
||||
return NAME(CARDTYPE,init)(&inf);
|
||||
}
|
||||
|
||||
static int do_exit_module(void)
|
||||
{
|
||||
NAME(CARDTYPE,exit)(&dumb);
|
||||
NAME(CARDTYPE,exit)(&inf);
|
||||
return 0;
|
||||
}
|
||||
#else
|
|
@ -1,48 +0,0 @@
|
|||
#include "Config.h"
|
||||
#include "primitives.h"
|
||||
|
||||
#if 0
|
||||
struct _dumb {
|
||||
struct _isdn1_card card;
|
||||
long memaddr;
|
||||
short ioaddr;
|
||||
char irq, ipl;
|
||||
/* Linux: IRQ wird nicht automatisch erkannt bei ladbaren Treibern! */
|
||||
/* IPL ist 0 für Teles/8-Karten, 1..3 für Teles/16-Karten an der 1..3.
|
||||
Adresse. */
|
||||
char numHCRX;
|
||||
long ID;
|
||||
int debug;
|
||||
struct _hdlc_buf chan[MAX_B_CHAN+1];
|
||||
};
|
||||
#endif
|
||||
|
||||
struct _dumb dumbdata[] = {
|
||||
#ifdef _avm_
|
||||
{ { }, 0,0x300, 3, 0,2, CHAR4('A','V','M','0'),
|
||||
DEBUG_isac|DEBUG_hscx|DEBUG_hscxout|DEBUG_info, },
|
||||
#endif
|
||||
#ifdef _ncp_
|
||||
{ { }, 0,0x350, 5, 0,2, CHAR4('n','c','p','0'),
|
||||
DEBUG_hscx|DEBUG_hscxout|DEBUG_info, },
|
||||
{ { }, 0,0x250, 7, 0,2, CHAR4('n','c','p','1'),
|
||||
DEBUG_hscx|DEBUG_hscxout|DEBUG_info, },
|
||||
#endif
|
||||
#ifdef _bsc_
|
||||
{ { }, 0,0x3E0, 5, 5,2, CHAR4('B','S','C','0'),
|
||||
DEBUG_isac|DEBUG_hscx|DEBUG_hscxout|DEBUG_info, },
|
||||
#endif
|
||||
#ifdef _teles_
|
||||
{ { }, 0xD4000,0,12, 1,2, CHAR4('T','e','l','0'),
|
||||
DEBUG_info| 0, },
|
||||
{ { }, 0xD5000,0, 3, 0,2, CHAR4('T','e','l','1'),
|
||||
DEBUG_info| 0, },
|
||||
{ { }, 0xD6000,0, 5, 0,2, CHAR4('T','e','l','2'),
|
||||
DEBUG_info| 0, },
|
||||
{ { }, 0xD7000,0, 4, 0,2, CHAR4('T','e','l','3'),
|
||||
DEBUG_info| 0, },
|
||||
#endif
|
||||
};
|
||||
|
||||
int dumb_num = sizeof(dumbdata)/sizeof(dumbdata[0]);
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
#include "isdn_limits.h"
|
||||
#include "isdn_12.h"
|
||||
#include "smallq.h"
|
||||
#include <stream.h>
|
||||
|
||||
extern int dumb_num;
|
||||
|
||||
#define DEBUG(_x) if((DEBUG_##_x) & dumb->debug)
|
||||
#define DEBUG_memory 0x01
|
||||
#define DEBUG_uart 0x00
|
||||
#define DEBUG_isac 0x04
|
||||
#define DEBUG_hscx 0x08
|
||||
#define DEBUG_hscxout 0x02
|
||||
#define DEBUG_cpu 0x00
|
||||
#define DEBUG_check 0x20
|
||||
#define DEBUG_info 0x40
|
||||
#define DEBUG_main 0x80
|
||||
|
||||
typedef unsigned char Byte;
|
||||
typedef struct _hdlc_buf {
|
||||
mblk_t *m_in, *m_in_run;
|
||||
unsigned short inlen;
|
||||
struct _smallq q_out;
|
||||
mblk_t *m_out, *m_out_run;
|
||||
unsigned char *p_out;
|
||||
Byte mode;
|
||||
Byte locked,listen;
|
||||
u_short nblk,maxblk;
|
||||
} *hdlc_buf;
|
||||
|
||||
typedef struct _dumb {
|
||||
struct _isdn1_card card;
|
||||
|
||||
long memaddr;
|
||||
short ioaddr;
|
||||
char irq, ipl, numHSCX;
|
||||
long ID;
|
||||
int debug;
|
||||
|
||||
struct _hdlc_buf chan[MAX_B+1];
|
||||
#ifdef NEW_TIMEOUT
|
||||
long timer;
|
||||
#endif
|
||||
long countme; signed char polled; char circ;
|
||||
} *__dumb;
|
||||
|
||||
extern struct _dumb dumbdata[];
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
|
||||
SHELL = /bin/sh
|
||||
MAKE = make
|
||||
## =()<P = @<P>@>()=
|
||||
P =
|
||||
|
||||
## =()<CC = @<CC>@>()=
|
||||
CC = gcc
|
||||
## =()<DEFS = @<DEFCARDS>@ @<KERNEL>@ -I../../include >()=
|
||||
DEFS = -I../../streams -I../../compat -fomit-frame-pointer -funroll-loops -DKERNEL -D__KERNEL__ -DMODULE -DCONFIG_MODVERSIONS -I../../include
|
||||
## =()<CFLAGS = @<CFLAGS>@ $(DEFS)>()=
|
||||
CFLAGS = -O2 -Wall $(DEFS)
|
||||
|
||||
## =()<SYS = @<SYS>@>()=
|
||||
SYS = linux
|
||||
|
||||
SOURCES = test.c
|
||||
|
||||
OBJ =
|
||||
ALL = test.o
|
||||
|
||||
all: test.o
|
||||
|
||||
load:
|
||||
insmod test.o
|
||||
|
||||
test.o: test.c
|
||||
$(CC) $(CFLAGS) -o test.o -c test.c
|
||||
|
||||
lib:
|
||||
|
||||
indent:
|
||||
../../indent.sh $(SOURCES)
|
||||
|
||||
depend: Makefile $(SOURCES)
|
||||
$(CC) -M $(DEFS) test.c > .depend ; done
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(ALL)
|
||||
|
||||
install: all
|
||||
@sh ../../iftrue.sh "-d $(SYS)" "cd $(SYS); make"
|
||||
|
||||
update: all
|
||||
@sh ../../iftrue.sh "-d $(SYS)" "cd $(SYS); make update"
|
||||
|
||||
|
||||
ifeq (.depend,$(wildcard .depend))
|
||||
include .depend
|
||||
endif
|
||||
|
|
@ -1,355 +0,0 @@
|
|||
/*
|
||||
* Testing driver which registers a device for loopback, and so on.
|
||||
*
|
||||
*/
|
||||
|
||||
#define UAREA
|
||||
|
||||
#include "f_module.h"
|
||||
#include "primitives.h"
|
||||
#include <sys/time.h>
|
||||
#include "f_signal.h"
|
||||
#include "f_malloc.h"
|
||||
#include <sys/sysmacros.h>
|
||||
#include "streams.h"
|
||||
#include <sys/stropts.h>
|
||||
/* #ifdef DONT_ADDERROR */
|
||||
#include "f_user.h"
|
||||
/* #endif */
|
||||
#include <sys/errno.h>
|
||||
#include <sys/file.h>
|
||||
#include <fcntl.h>
|
||||
#include <stddef.h>
|
||||
#include "streamlib.h"
|
||||
#include "lap.h"
|
||||
#include <sys/termios.h>
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/tqueue.h>
|
||||
#include <asm/io.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);
|
||||
|
||||
#define ddprintf(xx) printf(xx),({int x;for(x=0;x<1000;x++) udelay(1000);})
|
||||
#define ldprintf if(0)printf
|
||||
#if 1
|
||||
#if 1
|
||||
#define dprintf printf
|
||||
#else
|
||||
#define dprintf ({int x;for(x=0;x<300;x++) udelay(1000);}),printf
|
||||
#endif
|
||||
#else
|
||||
#define dprintf if(0)printf
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Standard Streams driver information.
|
||||
*/
|
||||
static struct module_info itest_minfo =
|
||||
{
|
||||
0, "itest", 0, INFPSZ, 8000, 3000
|
||||
};
|
||||
|
||||
static qf_open itest_open;
|
||||
static qf_close itest_close;
|
||||
static qf_srv itest_wsrv, itest_rsrv;
|
||||
static qf_put itest_wput;
|
||||
|
||||
static struct qinit itest_rinit =
|
||||
{
|
||||
NULL, NULL, itest_open, itest_close, NULL, &itest_minfo, NULL
|
||||
};
|
||||
|
||||
static struct qinit itest_winit =
|
||||
{
|
||||
itest_wput, itest_wsrv, NULL, NULL, NULL, &itest_minfo, NULL
|
||||
};
|
||||
|
||||
struct streamtab itest_info =
|
||||
{&itest_rinit, &itest_winit, NULL, NULL};
|
||||
|
||||
#define NCARDS 2
|
||||
#define NBCHAN 3
|
||||
|
||||
struct testcard {
|
||||
struct _isdn1_card *card;
|
||||
struct testchannel {
|
||||
struct testcard *card;
|
||||
queue_t *q;
|
||||
} port[NBCHAN+1];
|
||||
} test_card[NCARDS];
|
||||
|
||||
|
||||
static int test_poll (struct _isdn1_card * card, short channel)
|
||||
{
|
||||
struct testcard *test_card = (struct testcad *)card;
|
||||
struct testchannel *testport;
|
||||
|
||||
if(channel < 0 || channel >= NBCHAN)
|
||||
return -EIO;
|
||||
testport = &testcard.port[channel];
|
||||
if(testport->q == NULL)
|
||||
return -ENXIO;
|
||||
if(WR(testport->q)->q_first == NULL)
|
||||
return -EAGAIN;
|
||||
qenable(WR(testport->q));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_candata (struct _isdn1_card * card, short channel)
|
||||
{
|
||||
struct testcard *test_card = (struct testcad *)card;
|
||||
struct testchannel *testport;
|
||||
|
||||
if(channel < 0 || channel >= NBCHAN)
|
||||
return 0;
|
||||
testport = &testcard.port[channel];
|
||||
if(testport->q == NULL)
|
||||
return 0;
|
||||
return canput(testport->q->q_next);
|
||||
}
|
||||
|
||||
static int test_data (struct _isdn1_card * card, short channel, mblk_t * data)
|
||||
{
|
||||
struct testcard *test_card = (struct testcad *)card;
|
||||
struct testchannel *testport;
|
||||
|
||||
if(channel < 0 || channel >= NBCHAN)
|
||||
return -EIO;
|
||||
testport = &testcard.port[channel];
|
||||
if(testport->q == NULL)
|
||||
return -ENXIO;
|
||||
if(!canput(testport->q->q_next))
|
||||
return -EAGAIN;
|
||||
putnext(testport->q,data);
|
||||
}
|
||||
|
||||
data
|
||||
candata
|
||||
|
||||
static int test_flush (struct _isdn1_card * card, short channel)
|
||||
{
|
||||
struct testcard *test_card = (struct testcad *)card;
|
||||
struct testchannel *testport;
|
||||
|
||||
if(channel < 0 || channel >= NBCHAN)
|
||||
return -EIO;
|
||||
testport = &testcard.port[channel];
|
||||
if(testport->q == NULL)
|
||||
return -ENXIO;
|
||||
putctlx1(testport->q,M_FLUSH,FLUSHR|FLUSHW);
|
||||
}
|
||||
|
||||
static int test_prot (struct _isdn1_card * card, short channel, mblk_t * proto)
|
||||
{
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
static int test_mode (struct _isdn1_card * card, short channel, char mode,
|
||||
char listen)
|
||||
{
|
||||
struct testcard *test_card = (struct testcad *)card;
|
||||
struct testchannel *testport;
|
||||
|
||||
if(channel < 0 || channel >= NBCHAN)
|
||||
return -EIO;
|
||||
testport = &testcard.port[channel];
|
||||
if(testport->q == NULL)
|
||||
return -ENXIO;
|
||||
if(mode == MODE_OFF)
|
||||
putctlx1(testport->q,M_HANGUP);
|
||||
}
|
||||
|
||||
|
||||
/* Streams code to open the driver. */
|
||||
static int
|
||||
itest_open (queue_t * q, dev_t dev, int flag, int sflag
|
||||
#ifdef DO_ADDERROR
|
||||
,int *err
|
||||
#define U_ERROR *err
|
||||
#else
|
||||
#define U_ERROR u.u_error
|
||||
#endif
|
||||
)
|
||||
{
|
||||
struct testcard *test_card;
|
||||
struct testchannel *testport;
|
||||
int mdev = 0;
|
||||
int cdev;
|
||||
int err;
|
||||
|
||||
dev = minor (dev);
|
||||
cdev = dev & 0x0F;
|
||||
mdev = cdev / (NBCHAN+1);
|
||||
cdev %= (NBCHAN+1);
|
||||
|
||||
if(mdev >= NCARDS) {
|
||||
U_ERROR = ENXIO;
|
||||
return OPENFAIL;
|
||||
}
|
||||
testcard = test_card[mdev];
|
||||
testport = &testcard->port[cdev];
|
||||
if(testport->q != NULL) {
|
||||
printf("itest dev 0x%x: already open, %p\n",dev,testport->q);
|
||||
return 0;
|
||||
}
|
||||
|
||||
MORE_USE;
|
||||
|
||||
if(cdev == 0) {
|
||||
int theID = CHAR4('T','s','t','A'+mdev);
|
||||
|
||||
testcard->card.nr_chans = NBCHAN;
|
||||
testcard->card.ctl = testcard;
|
||||
testcard->card.chan = NULL;
|
||||
testcard->card.modes = (1<<M_HDLC)| (1<<M_TRANSPARENT)| (1<<M_TRANS_ALAW)| (1<<M_TRANS_V110)| (1<<M_TRANS_HDLC);
|
||||
testcard->card.ch_mode = test_mode;
|
||||
testcard->card.ch_prot = test_prot;
|
||||
testcard->card.send = test_data;
|
||||
testcard->card.flush = test_flush;
|
||||
testcard->card.cansend = test_candata;
|
||||
testcard->card.poll = test_poll;
|
||||
|
||||
if((err = isdn2_register(&testcard->card, theID)) != 0) {
|
||||
U_ERROR = err;
|
||||
LESS_USE;
|
||||
return OPENFAIL;
|
||||
}
|
||||
}
|
||||
|
||||
testport->card = testcard;
|
||||
testport->q = q;
|
||||
|
||||
WR (q)->q_ptr = (caddr_t) testport;
|
||||
q->q_ptr = (caddr_t) testport;
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
/* Streams code to close the driver. */
|
||||
static void
|
||||
itest_close (queue_t *q, int dummy)
|
||||
{
|
||||
struct testchannel *testport = (struct testchannel *) q->q_ptr;
|
||||
struct testcard *test_card = testport->card;
|
||||
|
||||
if(testport->q == NULL)
|
||||
return;
|
||||
if(testport == &testcard->port[0])
|
||||
isdn2_unregister(&testcard->card);
|
||||
|
||||
testport->q = NULL;
|
||||
|
||||
LESS_USE;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Streams code to write data. */
|
||||
static void
|
||||
itest_wput (queue_t *q, mblk_t *mp)
|
||||
{
|
||||
struct testchannel *testport = (struct testchannel *) q->q_ptr;
|
||||
struct testcard *test_card = testport->card;
|
||||
ldprintf(".%d.",__LINE__);
|
||||
|
||||
#ifdef CONFIG_DEBUG_STREAMS
|
||||
if(msgdsize(mp) < 0)
|
||||
return;
|
||||
#endif
|
||||
if(testport->q == NULL) {
|
||||
freemsg(mp);
|
||||
return;
|
||||
}
|
||||
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
|
||||
putq (q, mp);
|
||||
break;
|
||||
case M_FLUSH:
|
||||
if (*mp->b_rptr & FLUSHW)
|
||||
flushq (q, 0);
|
||||
|
||||
if (*mp->b_rptr & FLUSHR) {
|
||||
flushq (RD (q), 0);
|
||||
*mp->b_rptr &= ~FLUSHW;
|
||||
qreply (q, mp);
|
||||
} else
|
||||
freemsg (mp);
|
||||
break;
|
||||
default:
|
||||
log_printmsg (NULL, "Strange itest", mp, KERN_WARNING);
|
||||
/* putctl1(RD(q)->b_next, M_ERROR, ENXIO); */
|
||||
freemsg (mp);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* Streams code to scan the write queue. */
|
||||
static void
|
||||
itest_wsrv (queue_t *q)
|
||||
{
|
||||
struct testchannel *testport = (struct testchannel *) q->q_ptr;
|
||||
struct testcard *testcard;
|
||||
mblk_t *mp;
|
||||
int chan;
|
||||
|
||||
if(testport == NULL || testport->q == NULL) {
|
||||
flushq(q,FLUSHALL);
|
||||
return;
|
||||
}
|
||||
testcard = testport->card;
|
||||
chan = testport - testcard->port;
|
||||
|
||||
while (q->q_first != NULL) {
|
||||
int err = isdn2_canrecv(&testcard->card, chan);
|
||||
if(err != 0)
|
||||
break;
|
||||
mp = getq (q)) != NULL);
|
||||
if(mp != NULL) {
|
||||
err = isdn2_recv(&testcard->card, chan,mp);
|
||||
if(err != 0)
|
||||
freemsg(mp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
static int devmajor1 = 0;
|
||||
|
||||
static int do_init_module(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
bzero(test_card,sizeof(test_card));
|
||||
|
||||
err = register_strdev(0,&itest_info,0);
|
||||
if(err < 0) {
|
||||
return err;
|
||||
}
|
||||
devmajor1 = err;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int do_exit_module(void)
|
||||
{
|
||||
int err1;
|
||||
int i;
|
||||
|
||||
err1 = unregister_strdev(devmajor1,&itest_info,0);
|
||||
return err1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -1,52 +1,14 @@
|
|||
## Makefile for compatibility stuff
|
||||
all::
|
||||
|
||||
SHELL = /bin/sh
|
||||
MAKE = make
|
||||
## =()<P = @<P>@>()=
|
||||
P =
|
||||
|
||||
## =()<CC = @<CC>@>()=
|
||||
CC = gcc
|
||||
## =()<DEFS = @<DEFKERNEL>@ @<KERNEL>@ -I../include >()=
|
||||
DEFS = -I../streams -I../compat -I/usr/src/linux/include -fomit-frame-pointer -DKERNEL -D__KERNEL__ -DMODULE -DCONFIG_MODVERSIONS -I../include
|
||||
## =()<CFLAGS = @<CFLAGS>@ $(DEFS)>()=
|
||||
CFLAGS = -O2 -Wall $(DEFS)
|
||||
|
||||
## =()<SYS = @<SYS>@>()=
|
||||
SYS = linux
|
||||
|
||||
SOURCES = compat.c
|
||||
OBJ = compat.o
|
||||
ALL =
|
||||
|
||||
all: compat.o
|
||||
|
||||
lib:
|
||||
|
||||
install: all
|
||||
# @sh ../iftrue.sh "-d $(SYS)" "cd $(SYS); make"
|
||||
|
||||
update: all
|
||||
# @sh ../iftrue.sh "-d $(SYS)" "cd $(SYS); make update"
|
||||
|
||||
indent:
|
||||
../indent.sh $(SOURCES)
|
||||
|
||||
clean:
|
||||
rm -f linux
|
||||
rm -f $(ALL) $(OBJ)
|
||||
# @sh ../iftrue.sh "-d $(SYS)" "cd $(SYS); make clean"
|
||||
|
||||
depend: Makefile $(SOURCES)
|
||||
depend::
|
||||
rm -f syscompat.h linux
|
||||
ln -s compat.h syscompat.h
|
||||
ln -s . linux
|
||||
$(CC) -M $(DEFS) $(SOURCES) > .depend
|
||||
|
||||
load:
|
||||
insmod compat.o
|
||||
KERNEL=1
|
||||
|
||||
ifeq (.depend,$(wildcard .depend))
|
||||
include .depend
|
||||
endif
|
||||
TOPDIR=..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
||||
clean::
|
||||
rm -f linux
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <linux/version.h>
|
||||
#endif
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include "kernel.h"
|
||||
#include <linux/delay.h>
|
||||
#include <asm/delay.h>
|
||||
|
||||
|
@ -244,21 +244,21 @@ void sysdump(const char *msg, struct pt_regs *regs, unsigned long err)
|
|||
esp = (unsigned long) ®s->esp;
|
||||
ss = KERNEL_DS;
|
||||
|
||||
printk(KERN_DEBUG "\n");
|
||||
printk("%s\n",KERN_DEBUG);
|
||||
if(msg != NULL)
|
||||
printk(KERN_EMERG "%s: %08lx\n", msg, err);
|
||||
printk("%s%s: %08lx\n", KERN_DEBUG, msg, err);
|
||||
else
|
||||
nlim += 4;
|
||||
if(regs != NULL) {
|
||||
printk(KERN_EMERG "EIP: %04x:%08lx EFLAGS: %08lx\n", 0xffff & regs->cs,regs->eip,regs->eflags);
|
||||
printk(KERN_EMERG "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n",
|
||||
printk("%sEIP: %04x:%08lx EFLAGS: %08lx\n", KERN_EMERG, 0xffff & regs->cs,regs->eip,regs->eflags);
|
||||
printk("%seax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", KERN_EMERG,
|
||||
regs->eax, regs->ebx, regs->ecx, regs->edx);
|
||||
printk(KERN_EMERG "esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n",
|
||||
printk("%sesi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n",KERN_EMERG,
|
||||
regs->esi, regs->edi, regs->ebp, esp);
|
||||
printk(KERN_EMERG "ds: %04x es: %04x fs: %04x gs: %04x ss: %04x\n",
|
||||
printk("%sds: %04x es: %04x fs: %04x gs: %04x ss: %04x\n",KERN_EMERG,
|
||||
regs->ds, regs->es, regs->fs, regs->gs, ss);
|
||||
if (STACK_MAGIC != *(unsigned long *)current->kernel_stack_page)
|
||||
printk(KERN_EMERG "Corrupted stack page\n");
|
||||
printk("%sCorrupted stack page\n",KERN_EMERG);
|
||||
else
|
||||
nlim += 1;
|
||||
|
||||
|
@ -266,24 +266,24 @@ void sysdump(const char *msg, struct pt_regs *regs, unsigned long err)
|
|||
nlim += 5;
|
||||
store_TR(i);
|
||||
if(current != NULL) {
|
||||
printk(KERN_EMERG "Process %s (pid: %d, process nr: %d, stackpage=%08lx)\n",
|
||||
current->comm, current->pid, 0xffff & i, current->kernel_stack_page);
|
||||
printk("%sProcess %s (pid: %d, process nr: %d, stackpage=%08lx)\n",
|
||||
KERN_EMERG,current->comm, current->pid, 0xffff & i, current->kernel_stack_page);
|
||||
} else {
|
||||
printk(KERN_EMERG "No current process\n");
|
||||
printk("%sNo current process\n",KERN_EMERG);
|
||||
}
|
||||
{
|
||||
int nlines = 0, linepos = 0;
|
||||
printk(KERN_EMERG "");
|
||||
printk("%s",KERN_EMERG);
|
||||
for (i=0; dodump && nlines < nlim; i++) {
|
||||
u_long xx = get_seg_long(ss,(i+(unsigned long *)esp));
|
||||
if(dodump > 1 && (xx & 0xfff00000) == 0xbff00000)
|
||||
dodump = 4;
|
||||
#define WRAP(n) do { if((linepos+=(n))>=80) { dodump--; nlines++; linepos=(n); printk("\n" KERN_EMERG); } } while(0)
|
||||
#define WRAP(n) do { if((linepos+=(n))>=80) { dodump--; nlines++; linepos=(n); printk("\n%s", KERN_EMERG); } } while(0)
|
||||
if (xx & 0xFF000000UL) { WRAP(9); printk("%08lx ",xx); }
|
||||
else if(xx & 0x00FF0000UL) { WRAP(7); printk("%06lx ",xx); }
|
||||
else if(xx & 0x0000FF00UL) { WRAP(5); printk("%04lx ",xx); }
|
||||
else { WRAP(3); printk("%02lx ",xx); }
|
||||
#undef WRAP
|
||||
#undef WRAP
|
||||
}
|
||||
printk("\n");
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ void sysdump(const char *msg, struct pt_regs *regs, unsigned long err)
|
|||
if(dodump < 10000) {
|
||||
int j;
|
||||
|
||||
printk(KERN_EMERG "Crash & Burn...");
|
||||
printk("%sCrash & Burn...",KERN_EMERG);
|
||||
for(j=dodump;j>0;j--) {
|
||||
int i;
|
||||
if((j%30 == 0) || (j%5 == 0 && j < 60) || j < 10) printk("%d...",j);
|
||||
|
@ -309,7 +309,7 @@ void sysdump(const char *msg, struct pt_regs *regs, unsigned long err)
|
|||
}
|
||||
panic("now.");
|
||||
} else {
|
||||
printk(KERN_EMERG "Kernel halted.");
|
||||
printk("%sKernel halted.",KERN_EMERG);
|
||||
for(;;);
|
||||
}
|
||||
}
|
||||
|
@ -317,6 +317,17 @@ void sysdump(const char *msg, struct pt_regs *regs, unsigned long err)
|
|||
}
|
||||
|
||||
|
||||
|
||||
char *loghdr(char level)
|
||||
{
|
||||
static char sbuf[30];
|
||||
static int tdiff = 0;
|
||||
sprintf(sbuf,"<%d>%d:",level,jiffies-tdiff);
|
||||
tdiff = jiffies;
|
||||
return sbuf;
|
||||
}
|
||||
|
||||
|
||||
void do_i_sleep_on(struct wait_queue **p)
|
||||
{
|
||||
long s = splx(~0);
|
||||
|
@ -337,7 +348,8 @@ char kernel_version[] = UTS_RELEASE;
|
|||
|
||||
int init_module(void)
|
||||
{
|
||||
#if defined(__ELF__) || LINUX_VERSION_CODE >= 66304 /* 1.3.0. Is that right??? */
|
||||
/* This should work... */
|
||||
#if defined(__ELF__)
|
||||
#define U
|
||||
#else
|
||||
#define U "_"
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
## $Revision: 1.20 $
|
||||
SHELL = /bin/sh
|
||||
MAKE = make
|
||||
## =()<P = @<P>@>()=
|
||||
P =
|
||||
|
||||
FILE = files.list
|
||||
LIST = `grep -v '^;' <$(FILE)`
|
||||
|
@ -12,19 +9,24 @@ LIST = `grep -v '^;' <$(FILE)`
|
|||
#SED = -e /usr/gnu/bin/sed
|
||||
|
||||
|
||||
all prog lib install update depend: substitutions
|
||||
all prog lib install update depend:: substitutions
|
||||
|
||||
indent load:
|
||||
|
||||
quiet:
|
||||
@$(MAKE) 'FILE=$(FILE)' substitutions | grep -v unchanged
|
||||
|
||||
clobber clean:
|
||||
clobber: clean
|
||||
rm -f config.data
|
||||
rm -f tags lint substitutions
|
||||
|
||||
clean:
|
||||
rm -f subst.tmp config.new subst
|
||||
rm -f tags lint substitutions
|
||||
|
||||
substitutions: subst files.list config.data
|
||||
-@rm -f ../*/substtmp.new ../*/substtmp.old
|
||||
-@find .. -name substtmp.new -o -name substtmp.old | xargs rm -f ../.not.there
|
||||
@if test -f config.new ; then echo "*** Check config.new and rename it to config.data, then re-make!"; exit 1 ; fi
|
||||
@sh ./checkconf.sh
|
||||
cat config.data >subst.tmp
|
||||
#@awk 'NR==1 {printf "PATCHLEVEL\t%s\n", $$2;}' <../PATCHLOG >>subst.tmp
|
||||
|
@ -33,44 +35,19 @@ substitutions: subst files.list config.data
|
|||
@rm subst.tmp
|
||||
-date > substitutions
|
||||
|
||||
backup:
|
||||
@sh ../iftrue.sh '-d ORIG' 'echo ORIG exists! ; exit 1'
|
||||
mkdir ORIG
|
||||
@for I in $(LIST) ; do \
|
||||
echo cp $$I ORIG ; \
|
||||
cp $$I ORIG ; \
|
||||
done
|
||||
|
||||
restore:
|
||||
@sh ../iftrue.sh '! -d ORIG' 'echo No ORIG directory! ; exit 1'
|
||||
@for I in $(LIST) ; do \
|
||||
echo cp ORIG/`basename $$I` $$I ; \
|
||||
cp ORIG/`basename $$I` $$I ; \
|
||||
done
|
||||
|
||||
config.data: config.dist
|
||||
@sh ../iftrue.sh '-f config.new' 'echo config.new exists! ; exit 1'
|
||||
@sh ../iftrue.sh '-f config.old' 'echo config.old exists! ; exit 1'
|
||||
@sh ../iftrue.sh '! -f config.data' '$(MAKE) CLOBBER=YES SCRATCH'
|
||||
cat config.data config.dist >subst.tmp
|
||||
config.data: subst config.dist
|
||||
@if test -f config.new; then echo "*** Check config.new and rename it to config.data, then re-make!" ; exit 1 ; fi
|
||||
-@rm -f subst.tmp
|
||||
@if test -f config.data; then cat config.data config.dist ; else cat config.dist ; fi > subst.tmp
|
||||
cp config.dist config.new
|
||||
./subst $(SED) -f subst.tmp config.new
|
||||
-@rm -f subst.tmp
|
||||
@echo "Update config.old from config.new!"
|
||||
@sh ../iftrue.sh '-f config.data' \
|
||||
'echo "Renamed config file to config.old"; mv config.data config.old'
|
||||
exit 1 ;
|
||||
SCRATCH:
|
||||
@sh ../iftrue.sh '-z $(CLOBBER)' 'echo No way! ; exit 1'
|
||||
@echo 'You do not have a config.data file.'
|
||||
@echo 'Setting one up using the default file.'
|
||||
@echo 'You must edit this file, then remove config.new and config.old.'
|
||||
@echo 'Then restart the make.'
|
||||
cat config.dist >config.data
|
||||
@echo "Check config.new, then rename it to config.data, and re-make!"
|
||||
@false
|
||||
|
||||
subst: subst.c subst.sh
|
||||
-make c || make sh || rm -f subst
|
||||
@sh ../iftrue.sh '! -f subst' 'echo Cannot make subst ; exit 1'
|
||||
@if test ! -f subst; then echo Cannot make subst ; exit 1; fi
|
||||
c:
|
||||
@rm -f subst
|
||||
$(CC) -o subst subst.c
|
||||
|
|
|
@ -1,193 +0,0 @@
|
|||
##
|
||||
## ISDN master configuration file for Linux.
|
||||
## Note that if you leave a field blank, you must have the trailing tab!
|
||||
##
|
||||
## Set the STR_IN parameter to "in" if you're using BSD networking code.
|
||||
## If not, use "none" and forget about TCP/IP.
|
||||
|
||||
|
||||
##
|
||||
## System type. Selects which Makefiles to use for installation.
|
||||
#### =()<SYS @<SYS>@>()=
|
||||
SYS linux
|
||||
##
|
||||
##
|
||||
## Where to install everything.
|
||||
#### =()<DESTDIR @<DESTDIR>@>()=
|
||||
DESTDIR /usr/local/isdn
|
||||
##
|
||||
## What to name the lockfiles.
|
||||
#### =()<LOCKNAME @<LOCKNAME>@>()=
|
||||
LOCKNAME /var/lock/LCK..%s
|
||||
##
|
||||
|
||||
## Name of the "KERNEL" flag in system include files (KERNEL, _KERNEL, INKERNEL)
|
||||
## Be aware that -DKERNEL is used by the ISDN libraries -- don't turn it off.
|
||||
#### =()<KERNEL @<KERNEL>@>()=
|
||||
KERNEL -DKERNEL -D__KERNEL__ -DMODULE -DCONFIG_MODVERSIONS
|
||||
## Byte order. Motorola 4321, Intel 1234.
|
||||
#### =()<BYTEORDER @<BYTEORDER>@>()=
|
||||
BYTEORDER 1234
|
||||
##
|
||||
## Card drivers to install. Subdirectories of SRC/cards.
|
||||
#### =()<CARDS @<CARDS>@>()=
|
||||
CARDS dumb
|
||||
#### =()<DUMBCARDS @<DUMBCARDS>@>()=
|
||||
DUMBCARDS teles
|
||||
### teles avm bsc ncp ncp16
|
||||
## Teles is good for Creatix cards, too.
|
||||
## Also edit cards/dumb/Config.c.
|
||||
## All drivers other than Teles don't work yet.
|
||||
##
|
||||
## Defines for master program (L2 test version)
|
||||
#### =()<CARDDEFS @<CARDDEFS>@>()=
|
||||
CARDDEFS -DDUMB
|
||||
##
|
||||
## Level to include in master program.
|
||||
## Set to 3.(2 for semi-testing L2 in user mode. 4 is untested.)
|
||||
#### =()<MLEVEL @<MLEVEL>@>()=
|
||||
MLEVEL 3
|
||||
|
||||
## If you have a parallel make, set this to "&"
|
||||
#### =()<P @<P>@>()=
|
||||
P
|
||||
## C pre-processor flags for normal programs.
|
||||
#### =()<DEFS @<DEFS>@>()=
|
||||
DEFS -I../streams -I../compat -I/usr/src/linux/include -I/usr/include/bsd
|
||||
## C pre-processor flags for kernel code.
|
||||
## Don't include any KERNEL flags.
|
||||
#### =()<DEFKERNEL @<DEFKERNEL>@>()=
|
||||
DEFKERNEL -I../streams -I../compat -I/usr/src/linux/include -fomit-frame-pointer
|
||||
## C pre-processor flags for ISDN card support
|
||||
#### =()<DEFCARDS @<DEFCARDS>@>()=
|
||||
DEFCARDS -I../../streams -I../../compat -fomit-frame-pointer -funroll-loops
|
||||
###
|
||||
## C compiler for the kernel
|
||||
#### =()<CC @<CC>@>()=
|
||||
CC gcc
|
||||
###
|
||||
## C compiler for the utilities
|
||||
#### =()<CCU @<CCU>@>()=
|
||||
CCU gcc
|
||||
##
|
||||
## common C compiler flags
|
||||
#### =()<CFLAGS @<CFLAGS>@>()=
|
||||
CFLAGS -O2 -Wall
|
||||
#CFLAGS -x c++ -g -O2 -W -Wreturn-type -Wshadow -Wcomment
|
||||
#CFLAGS -g -W -Wreturn-type -Wshadow -Wcomment -D_BSD_SOURCE -D_SYSV_SOURCE
|
||||
## Flags for the "cc -o" line
|
||||
#### =()<LDFLAGS @<LDFLAGS>@>()=
|
||||
LDFLAGS -v
|
||||
##
|
||||
## Calling ld directly?
|
||||
#### =()<LD @<LD>@>()=
|
||||
LD ld
|
||||
##
|
||||
## If you need to link in other libraries, add them here
|
||||
#### =()<LIBS @<LIBS>@>()=
|
||||
LIBS -lbsd
|
||||
##
|
||||
## Ranlib needed ?
|
||||
#### =()<RANLIB @<RANLIB>@>()=
|
||||
RANLIB ranlib
|
||||
##
|
||||
## Need strsave(3)? DO or DONT.
|
||||
#### =()<NEED_STRDUP @<NEED_STRDUP>@>()=
|
||||
NEED_STRDUP DONT
|
||||
##
|
||||
## Do you have setsid()?
|
||||
#### =()<HAVE_SETSID @<HAVE_SETSID>@>()=
|
||||
HAVE_SETSID DO
|
||||
##
|
||||
## How many arguments does your setpgrp() take? 0 or 2.
|
||||
#### =()<HAVE_SETPGRP @<HAVE_SETPGRP>@>()=
|
||||
HAVE_SETPGRP 0
|
||||
|
||||
## Does Streeams use signed or unsigned characters in its buffer?
|
||||
#### =()<STREAMCHAR @<STREAMCHAR>@>()=
|
||||
STREAMCHAR unsigned char
|
||||
##
|
||||
## Define only if building a kernel complains that there's no spl().
|
||||
#### =()<NEED_SPL @<NEED_SPL>@>()=
|
||||
NEED_SPL DONT
|
||||
##
|
||||
## signal functions' return type? Usually void or int.
|
||||
#### =()<SIGRET @<SIGRET>@>()=
|
||||
SIGRET void
|
||||
##
|
||||
## Need writev(3)? DO or DONT.
|
||||
#### =()<NEED_WRITEV @<NEED_WRITEV>@>()=
|
||||
NEED_WRITEV DONT
|
||||
##
|
||||
## Signal blocking? SYSV or BSD or NONE.
|
||||
#### =()<SIGTYPE @<SIGTYPE>@>()=
|
||||
SIGTYPE SYSV
|
||||
##
|
||||
## Define only if building a kernel complains that there's no memcpy.
|
||||
#### =()<NEED_MEMCPY @<NEED_MEMCPY>@>()=
|
||||
NEED_MEMCPY DONT
|
||||
##
|
||||
## Name of sys/termio.h (or sys/termios.h)
|
||||
#### =()<TERMIO @<TERMIO>@>()=
|
||||
TERMIO termios
|
||||
##
|
||||
## Name of /usr/include/strings.h
|
||||
#### =()<STRINGS @<STRINGS>@>()=
|
||||
STRINGS string
|
||||
##
|
||||
## What a minor number is called.
|
||||
#### =()<SUBDEV @<SUBDEV>@>()=
|
||||
SUBDEV uchar_t
|
||||
##
|
||||
## Streams <-> INet interface? "in" or "in2" or "str" or "linux" or "none"
|
||||
## "in" is old BSD, "in2" is BSD 4.4, "str" is Streams-based
|
||||
#### =()<STR_IN @<STR_IN>@>()=
|
||||
STR_IN linux
|
||||
##
|
||||
## kernel timeout() funtion. OLD: untimeout takes first two args of timeout().
|
||||
## NEW: untimeout takes return value of timeout().
|
||||
#### =()<TIMEOUT @<TIMEOUT>@>()=
|
||||
TIMEOUT NEW
|
||||
##
|
||||
## Streams XXXopen() -- does it get an additional "pointer to int" argument
|
||||
## which points to the appropriate errno value?
|
||||
#### =()<ADDERROR @<ADDERROR>@>()=
|
||||
ADDERROR DONT
|
||||
##
|
||||
## Debugging? DO or DONT
|
||||
#### =()<DEBUGGING @<DEBUGGING>@>()=
|
||||
DEBUGGING DO
|
||||
#### =()<CONF_DEBUG @<CONF_DEBUG>@>()=
|
||||
CONF_MOD2 0x00
|
||||
## 0x00, 0x33
|
||||
#### =()<CONF_DEBUG @<CONF_DEBUG>@>()=
|
||||
CONF_DEBUG 0x0000
|
||||
## 0x5006, 0xf3df
|
||||
|
||||
|
||||
### ISDN configuration options
|
||||
|
||||
## One TEI per B channel? Seems to be required for US National-1.
|
||||
## DO or DONT. DO is currently not supported by the L3 driver.
|
||||
#### =()<MULTI_TEI @<MULTI_TEI>@>()=
|
||||
MULTI_TEI DONT
|
||||
##
|
||||
### the other configuration stuff is now per-card, see DOKU.
|
||||
|
||||
##
|
||||
## What to call protocol stuff. M_EXPROTO or (M_PROTO+0x40)
|
||||
#### =()<MSG_PROTO @<MSG_PROTO>@>()=
|
||||
MSG_PROTO M_EXPROTO
|
||||
##
|
||||
## What to call hopefully-expedited data stuff. M_EXDATA or (M_DATA+0x40).
|
||||
#### =()<MSG_EXDATA @<MSG_EXDATA>@>()=
|
||||
MSG_EXDATA M_EXDATA
|
||||
##
|
||||
## What to call normal data stuff. M_DATA
|
||||
#### =()<MSG_DATA @<MSG_DATA>@>()=
|
||||
MSG_DATA M_DATA
|
||||
|
||||
##
|
||||
#### Path names
|
||||
ROUTE_PATH /sbin/route
|
||||
|
|
@ -1,182 +0,0 @@
|
|||
##
|
||||
## ISDN master configuration file.
|
||||
## Note that if you leave a field blank, you must have the trailing tab!
|
||||
##
|
||||
|
||||
|
||||
##
|
||||
## System type. Selects which Makefiles to use for installation.
|
||||
#### =()<SYS @<SYS>@>()=
|
||||
SYS aux
|
||||
##
|
||||
## Name of the "KERNEL" flag in system include files (KERNEL, _KERNEL, INKERNEL)
|
||||
## Be aware that -DKERNEL is used by the ISDN libraries.
|
||||
#### =()<KERNEL @<KERNEL>@>()=
|
||||
KERNEL -DKERNEL
|
||||
## Byte order. Motorola 4321, Intel 1234.
|
||||
#### =()<BYTEORDER @<BYTEORDER>@>()=
|
||||
BYTEORDER 4321
|
||||
##
|
||||
## Card drivers to install. Subdirectories of SRC/cards.
|
||||
#### =()<CARDS @<CARDS>@>()=
|
||||
CARDS leonardo
|
||||
##
|
||||
## Defines for master program (L2 test version)
|
||||
#### =()<CARDDEFS @<CARDDEFS>@>()=
|
||||
CARDDEFS -DLEONARDO
|
||||
##
|
||||
## Level to include in master program.
|
||||
## Set to 3.(2 for semi-testing L2 in user mode. 4 is untested.)
|
||||
#### =()<MLEVEL @<MLEVEL>@>()=
|
||||
MLEVEL 3
|
||||
|
||||
## If you have a parallel make, set this to "&"
|
||||
#### =()<P @<P>@>()=
|
||||
P
|
||||
## C pre-processor flags; other flags specific for code location.
|
||||
#### =()<DEFS @<DEFS>@>()=
|
||||
DEFS -I../include
|
||||
## C pre-processor flags when compiling kernel code.
|
||||
## Don't include any KERNEL flags.
|
||||
#### =()<DEFKERNEL @<DEFKERNEL>@>()=
|
||||
DEFKERNEL -I../include
|
||||
## C pre-processor flags, when compiling card support
|
||||
#### =()<DEFSCARDS @<DEFCARDS>@>()=
|
||||
DEFCARDS -I../../include
|
||||
## C compiler
|
||||
#### =()<CC @<CC>@>()=
|
||||
CC gcc.new
|
||||
##
|
||||
## common C compiler flags
|
||||
#### =()<CFLAGS @<CFLAGS>@>()=
|
||||
CFLAGS -g -O2 -W -Wreturn-type -Wshadow -Wcomment
|
||||
#CFLAGS -g -O2 -W -Wreturn-type -Wshadow -Wcomment
|
||||
#CFLAGS -g -W -Wreturn-type -Wshadow -Wcomment -D_BSD_SOURCE -D_SYSV_SOURCE
|
||||
## Flags for the "cc -o" line; e.g., -Bstatic on SunOS4.x while debugging.
|
||||
#### =()<LDFLAGS @<LDFLAGS>@>()=
|
||||
LDFLAGS
|
||||
##
|
||||
## If you need to link in other libraries, add them here
|
||||
#### =()<LIBS @<LIBS>@>()=
|
||||
LIBS -lbsd
|
||||
##
|
||||
## Ranlib needed ?
|
||||
#### =()<RANLIB @<RANLIB>@>()=
|
||||
RANLIB : ranlib
|
||||
##
|
||||
## Need strsave(3)? DO or DONT.
|
||||
#### =()<NEED_STRSAVE @<NEED_STRSAVE>@>()=
|
||||
NEED_STRSAVE DO
|
||||
##
|
||||
|
||||
## Does Streeams use signed or unsigned characters in its buffer?
|
||||
#### =()<STREAMCHAR @<STREAMCHAR>@>()=
|
||||
STREAMCHAR uchar_t
|
||||
##
|
||||
## Define only if building a kernel complains that there's no spl().
|
||||
#### =()<NEED_SPL @<NEED_SPL>@>()=
|
||||
NEED_SPL DO
|
||||
##
|
||||
## signal functions' return type? Usually void or int.
|
||||
#### =()<SIGRET @<SIGRET>@>()=
|
||||
SIGRET void
|
||||
##
|
||||
## Need writev(3)? DO or DONT.
|
||||
#### =()<NEED_WRITEV @<NEED_WRITEV>@>()=
|
||||
NEED_WRITEV DO
|
||||
##
|
||||
## Signal blocking? SYSV or BSD or NONE.
|
||||
#### =()<SIGTYPE @<SIGTYPE>@>()=
|
||||
SIGTYPE SYSV
|
||||
##
|
||||
## Define only if building a kernel complains that there's no memcpy.
|
||||
#### =()<NEED_MEMCPY @<NEED_MEMCPY>@>()=
|
||||
NEED_MEMCPY DO
|
||||
##
|
||||
## Name of sys/termio.h (or sys/termios.h)
|
||||
#### =()<TERMIO @<TERMIO>@>()=
|
||||
TERMIO termio
|
||||
##
|
||||
## Name of /usr/include/strings.h
|
||||
#### =()<STRINGS @<STRINGS>@>()=
|
||||
STRINGS strings
|
||||
##
|
||||
## What a minor number is called.
|
||||
#### =()<SUBDEV @<SUBDEV>@>()=
|
||||
SUBDEV uchar_t
|
||||
##
|
||||
## Streams <-> INet interface? "in" or "str"
|
||||
#### =()<TIMEOUT @<TIMEOUT>@>()=
|
||||
STR_IN str
|
||||
##
|
||||
## kernel timeout() funtion. OLD: untimeout takes first two args of timeout().
|
||||
## NEW: untimeout takes return value of timeout().
|
||||
#### =()<TIMEOUT @<TIMEOUT>@>()=
|
||||
TIMEOUT OLD
|
||||
##
|
||||
## Streams XXXopen() -- does it have an additional "pointer to int" argument
|
||||
## which points to the appropriate errno value?
|
||||
#### =()<ADDERROR @<ADDERROR>@>()=
|
||||
ADDERROR DONT
|
||||
##
|
||||
## Include some Streams debugging code? DO or DONT.
|
||||
#### =()<STREAMDEBUG @<STREAMDEBUG>@>()=
|
||||
STREAMDEBUG DONT
|
||||
##
|
||||
## Also hook into the Kernel Streams code?
|
||||
#### =()<STREAMDEBUGK @<STREAMDEBUGK>@>()=
|
||||
STREAMDEBUGK DONT
|
||||
##
|
||||
## Also allocate a few spare Streams blocks?
|
||||
#### =()<STREAMALLOC @<STREAMALLOC>@>()=
|
||||
STREAMALLOC DONT
|
||||
##
|
||||
## Also include tracing code? DO or DONT.
|
||||
#### =()<STREAMTRACE @<STREAMTRACE>@>()=
|
||||
STREAMTRACE DONT
|
||||
##
|
||||
## Also include free list and queue checking code? DO or DONT.
|
||||
#### =()<STREAMCHECK @<STREAMCHECK>@>()=
|
||||
STREAMCHECK DONT
|
||||
##
|
||||
## Cause a reboot if theres a fatal error somewhere? DO or DONT.
|
||||
#### =()<BOOT @<BOOT>@>()=
|
||||
BOOT DONT
|
||||
##
|
||||
|
||||
### ISDN configuration options
|
||||
|
||||
## One TEI per B channel? Seems to be required for US National-1.
|
||||
## DO or DONT.
|
||||
#### =()<MULTI_TEI @<MULTI_TEI>@>()=
|
||||
MULTI_TEI DONT
|
||||
##
|
||||
## Take down Level 2 if idle? (Some PBXes don't like this.)
|
||||
#### =()<L2_DOWN @<L2_DOWN>@>()=
|
||||
L2_DOWN DO
|
||||
##
|
||||
## Grab a TEI when starting up?
|
||||
## Turn this on if the first incoming call is answered too late.
|
||||
#### =()<TEI_IMMEDIATE @<TEI_IMMEDIATE>@>()=
|
||||
TEI_IMMEDIATE DONT
|
||||
|
||||
##
|
||||
## Delay when establishing a connection. Range: 1..HZ*2.
|
||||
## Use this when the ISDN switch has problems with accepting data
|
||||
## immediately after establishing a connection.
|
||||
#### =()<UP_DELAY @<UP_DELAY>@>()=
|
||||
UP_DELAY ((HZ * 3) / 2)
|
||||
|
||||
##
|
||||
## What to call protocol stuff. M_EXPROTO or (M_PROTO+0x40)
|
||||
#### =()<MSG_PROTO @<MSG_PROTO>@>()=
|
||||
MSG_PROTO M_EXPROTO
|
||||
##
|
||||
## What to call hopefully-expedited data stuff. M_EXDATA or (M_DATA+0x40).
|
||||
#### =()<MSG_DATA @<MSG_DATA>@>()=
|
||||
MSG_DATA M_EXDATA
|
||||
|
||||
##
|
||||
#### Path names
|
||||
ROUTE_PATH /usr/etc/route
|
||||
|
|
@ -1,191 +0,0 @@
|
|||
##
|
||||
## ISDN master configuration file for Linux.
|
||||
## Note that if you leave a field blank, you must have the trailing tab!
|
||||
##
|
||||
## Set the STR_IN parameter to "in" if you're using BSD networking code.
|
||||
## If not, use "none" and forget about TCP/IP.
|
||||
|
||||
|
||||
##
|
||||
## System type. Selects which Makefiles to use for installation.
|
||||
#### =()<SYS @<SYS>@>()=
|
||||
SYS linux
|
||||
##
|
||||
## Name of the "KERNEL" flag in system include files (KERNEL, _KERNEL, INKERNEL)
|
||||
## Be aware that -DKERNEL is used by the ISDN libraries.
|
||||
#### =()<KERNEL @<KERNEL>@>()=
|
||||
KERNEL -DKERNEL -D__KERNEL__
|
||||
## Byte order. Motorola 4321, Intel 1234.
|
||||
#### =()<BYTEORDER @<BYTEORDER>@>()=
|
||||
BYTEORDER 1234
|
||||
##
|
||||
## Card drivers to install. Subdirectories of SRC/cards.
|
||||
#### =()<CARDS @<CARDS>@>()=
|
||||
CARDS bsc
|
||||
##
|
||||
## Defines for master program (L2 test version)
|
||||
#### =()<CARDDEFS @<CARDDEFS>@>()=
|
||||
CARDDEFS -DBSC
|
||||
##
|
||||
## Level to include in master program.
|
||||
## Set to 3.(2 for semi-testing L2 in user mode. 4 is untested.)
|
||||
#### =()<MLEVEL @<MLEVEL>@>()=
|
||||
MLEVEL 3
|
||||
|
||||
## If you have a parallel make, set this to "&"
|
||||
#### =()<P @<P>@>()=
|
||||
P
|
||||
## C pre-processor flags; other flags specific for code location.
|
||||
#### =()<DEFS @<DEFS>@>()=
|
||||
DEFS -I../include
|
||||
## C pre-processor flags when compiling kernel code.
|
||||
## Don't include any KERNEL flags.
|
||||
#### =()<DEFKERNEL @<DEFKERNEL>@>()=
|
||||
DEFKERNEL -I../include
|
||||
## C pre-processor flags, when compiling card support
|
||||
#### =()<DEFSCARDS @<DEFCARDS>@>()=
|
||||
DEFCARDS -I../../include
|
||||
## C compiler
|
||||
#### =()<CC @<CC>@>()=
|
||||
CC gcc
|
||||
##
|
||||
## common C compiler flags
|
||||
#### =()<CFLAGS @<CFLAGS>@>()=
|
||||
CFLAGS -x c++ -g -O2 -W -Wreturn-type -Wshadow -Wcomment
|
||||
#CFLAGS -g -O2 -W -Wreturn-type -Wshadow -Wcomment
|
||||
#CFLAGS -g -W -Wreturn-type -Wshadow -Wcomment -D_BSD_SOURCE -D_SYSV_SOURCE
|
||||
## Flags for the "cc -o" line; e.g., -Bstatic on SunOS4.x while debugging.
|
||||
#### =()<LDFLAGS @<LDFLAGS>@>()=
|
||||
LDFLAGS -v
|
||||
##
|
||||
## If you need to link in other libraries, add them here
|
||||
#### =()<LIBS @<LIBS>@>()=
|
||||
LIBS -lbsd
|
||||
##
|
||||
## Ranlib needed ?
|
||||
#### =()<RANLIB @<RANLIB>@>()=
|
||||
RANLIB ranlib
|
||||
##
|
||||
## Need strsave(3)? DO or DONT.
|
||||
#### =()<NEED_STRDUP @<NEED_STRDUP>@>()=
|
||||
NEED_STRDUP DONT
|
||||
##
|
||||
## Do you have setsid()?
|
||||
#### =()<HAVE_SETSID @<HAVE_SETSID>@>()=
|
||||
HAVE_SETSID DO
|
||||
##
|
||||
## How many arguments does your setpgrp() take? 0 or 2.
|
||||
#### =()<HAVE_SETPGRP @<HAVE_SETPGRP>@>()=
|
||||
HAVE_SETPGRP 0
|
||||
|
||||
## Does Streeams use signed or unsigned characters in its buffer?
|
||||
#### =()<STREAMCHAR @<STREAMCHAR>@>()=
|
||||
STREAMCHAR unsigned char
|
||||
##
|
||||
## Define only if building a kernel complains that there's no spl().
|
||||
#### =()<NEED_SPL @<NEED_SPL>@>()=
|
||||
NEED_SPL DONT
|
||||
##
|
||||
## signal functions' return type? Usually void or int.
|
||||
#### =()<SIGRET @<SIGRET>@>()=
|
||||
SIGRET void
|
||||
##
|
||||
## Need writev(3)? DO or DONT.
|
||||
#### =()<NEED_WRITEV @<NEED_WRITEV>@>()=
|
||||
NEED_WRITEV DONT
|
||||
##
|
||||
## Signal blocking? SYSV or BSD or NONE.
|
||||
#### =()<SIGTYPE @<SIGTYPE>@>()=
|
||||
SIGTYPE SYSV
|
||||
##
|
||||
## Define only if building a kernel complains that there's no memcpy.
|
||||
#### =()<NEED_MEMCPY @<NEED_MEMCPY>@>()=
|
||||
NEED_MEMCPY DONT
|
||||
##
|
||||
## Name of sys/termio.h (or sys/termios.h)
|
||||
#### =()<TERMIO @<TERMIO>@>()=
|
||||
TERMIO termios
|
||||
##
|
||||
## Name of /usr/include/strings.h
|
||||
#### =()<STRINGS @<STRINGS>@>()=
|
||||
STRINGS string
|
||||
##
|
||||
## What a minor number is called.
|
||||
#### =()<SUBDEV @<SUBDEV>@>()=
|
||||
SUBDEV uchar_t
|
||||
##
|
||||
## Streams <-> INet interface? "in" or "str" or "none"
|
||||
#### =()<TIMEOUT @<TIMEOUT>@>()=
|
||||
STR_IN in
|
||||
##
|
||||
## kernel timeout() funtion. OLD: untimeout takes first two args of timeout().
|
||||
## NEW: untimeout takes return value of timeout().
|
||||
#### =()<TIMEOUT @<TIMEOUT>@>()=
|
||||
TIMEOUT NEW
|
||||
##
|
||||
## Streams XXXopen() -- does it have an additional "pointer to int" argument
|
||||
## which points to the appropriate errno value?
|
||||
#### =()<ADDERROR @<ADDERROR>@>()=
|
||||
ADDERROR DONT
|
||||
##
|
||||
## Include some Streams debugging code? DO or DONT.
|
||||
#### =()<STREAMDEBUG @<STREAMDEBUG>@>()=
|
||||
STREAMDEBUG DONT
|
||||
##
|
||||
## Also hook into the Kernel Streams code?
|
||||
#### =()<STREAMDEBUGK @<STREAMDEBUGK>@>()=
|
||||
STREAMDEBUGK DONT
|
||||
##
|
||||
## Also allocate a few spare Streams blocks?
|
||||
#### =()<STREAMALLOC @<STREAMALLOC>@>()=
|
||||
STREAMALLOC DONT
|
||||
##
|
||||
## Also include tracing code? DO or DONT.
|
||||
#### =()<STREAMTRACE @<STREAMTRACE>@>()=
|
||||
STREAMTRACE DONT
|
||||
##
|
||||
## Also include free list and queue checking code? DO or DONT.
|
||||
#### =()<STREAMCHECK @<STREAMCHECK>@>()=
|
||||
STREAMCHECK DONT
|
||||
##
|
||||
## Cause a reboot if theres a fatal error somewhere? DO or DONT.
|
||||
#### =()<BOOT @<BOOT>@>()=
|
||||
BOOT DONT
|
||||
##
|
||||
|
||||
### ISDN configuration options
|
||||
|
||||
## One TEI per B channel? Seems to be required for US National-1.
|
||||
## DO or DONT.
|
||||
#### =()<MULTI_TEI @<MULTI_TEI>@>()=
|
||||
MULTI_TEI DONT
|
||||
##
|
||||
## Take down Level 2 if idle? (Some PBXes don't like this.)
|
||||
#### =()<L2_DOWN @<L2_DOWN>@>()=
|
||||
L2_DOWN DO
|
||||
##
|
||||
## Grab a TEI when starting up?
|
||||
## Turn this on if the first incoming call is answered too late.
|
||||
#### =()<TEI_IMMEDIATE @<TEI_IMMEDIATE>@>()=
|
||||
TEI_IMMEDIATE DONT
|
||||
|
||||
##
|
||||
## Delay when establishing a connection. Range: 1..HZ*2.
|
||||
## Use this when the ISDN switch has problems with accepting data
|
||||
## immediately after establishing a connection.
|
||||
#### =()<UP_DELAY @<UP_DELAY>@>()=
|
||||
UP_DELAY (HZ / 2)
|
||||
|
||||
##
|
||||
## What to call protocol stuff. M_EXPROTO or (M_PROTO+0x40)
|
||||
#### =()<MSG_PROTO @<MSG_PROTO>@>()=
|
||||
MSG_PROTO M_EXPROTO
|
||||
##
|
||||
## What to call hopefully-expedited data stuff. M_EXDATA or (M_DATA+0x40).
|
||||
#### =()<MSG_DATA @<MSG_DATA>@>()=
|
||||
MSG_DATA M_EXDATA
|
||||
|
||||
##
|
||||
#### Path names
|
||||
ROUTE_PATH /usr/etc/route
|
||||
|
|
@ -1,182 +0,0 @@
|
|||
##
|
||||
## ISDN master configuration file.
|
||||
## Note that if you leave a field blank, you must have the trailing tab!
|
||||
##
|
||||
|
||||
|
||||
##
|
||||
## System type. Selects which Makefiles to use for installation.
|
||||
#### =()<SYS @<SYS>@>()=
|
||||
SYS svr4
|
||||
##
|
||||
## Name of the "KERNEL" flag in system include files (KERNEL, _KERNEL, INKERNEL)
|
||||
## Be aware that -DKERNEL is used by the ISDN libraries.
|
||||
#### =()<KERNEL @<KERNEL>@>()=
|
||||
KERNEL -DKERNEL -DINKERNEL -D_INKERNEL
|
||||
## Byte order. Motorola 4321, Intel 1234.
|
||||
#### =()<BYTEORDER @<BYTEORDER>@>()=
|
||||
BYTEORDER 1234
|
||||
##
|
||||
## Card drivers to install. Subdirectories of SRC/cards.
|
||||
#### =()<CARDS @<CARDS>@>()=
|
||||
CARDS bsc
|
||||
##
|
||||
## Defines for master program (L2 test version)
|
||||
#### =()<CARDDEFS @<CARDDEFS>@>()=
|
||||
CARDDEFS -DBSC
|
||||
##
|
||||
## Level to include in master program.
|
||||
## Set to 3.(2 for semi-testing L2 in user mode. 4 is untested.)
|
||||
#### =()<MLEVEL @<MLEVEL>@>()=
|
||||
MLEVEL 3
|
||||
|
||||
## If you have a parallel make, set this to "&"
|
||||
#### =()<P @<P>@>()=
|
||||
P
|
||||
## C pre-processor flags. SysV systems include -DSYSV here.
|
||||
#### =()<DEFS @<DEFS>@>()=
|
||||
DEFS -DSYSV -DSVR4
|
||||
## C pre-processor flags when compiling kernel code.
|
||||
## Don't include any KERNEL flags.
|
||||
#### =()<DEFKERNEL @<DEFKERNEL>@>()=
|
||||
DEFKERNEL
|
||||
## C pre-processor flags, when compiling card support
|
||||
#### =()<DEFSCARDS @<DEFCARDS>@>()=
|
||||
DEFCARDS
|
||||
## C compiler
|
||||
#### =()<CC @<CC>@>()=
|
||||
CC gcc
|
||||
##
|
||||
## common C compiler flags
|
||||
#### =()<CFLAGS @<CFLAGS>@>()=
|
||||
CFLAGS -g -O2 -W -Wreturn-type -Wshadow -Wcomment
|
||||
#CFLAGS -g -O2 -W -Wreturn-type -Wshadow -Wcomment
|
||||
#CFLAGS -g -W -Wreturn-type -Wshadow -Wcomment -D_BSD_SOURCE -D_SYSV_SOURCE
|
||||
## Flags for the "cc -o" line; e.g., -Bstatic on SunOS4.x while debugging.
|
||||
#### =()<LDFLAGS @<LDFLAGS>@>()=
|
||||
LDFLAGS -g -static
|
||||
##
|
||||
## If you need to link in other libraries, add them here
|
||||
#### =()<LIBS @<LIBS>@>()=
|
||||
LIBS -lsocket
|
||||
##
|
||||
## Ranlib needed ?
|
||||
#### =()<RANLIB @<RANLIB>@>()=
|
||||
RANLIB : ranlib
|
||||
##
|
||||
## Signal blocking? SYSV or BSD or NONE.
|
||||
#### =()<SIGTYPE @<SIGTYPE>@>()=
|
||||
SIGTYPE SYSV
|
||||
##
|
||||
## signal functions' return type? Usually void or int.
|
||||
#### =()<SIGRET @<SIGRET>@>()=
|
||||
SIGRET void
|
||||
##
|
||||
## Need writev(3)? DO or DONT.
|
||||
#### =()<NEED_WRITEV @<NEED_WRITEV>@>()=
|
||||
NEED_WRITEV DO
|
||||
##
|
||||
## Need strsave(3)? DO or DONT.
|
||||
#### =()<NEED_STRSAVE @<NEED_STRSAVE>@>()=
|
||||
NEED_STRSAVE DO
|
||||
##
|
||||
## Define only if building a kernel complains that there's no spl().
|
||||
#### =()<NEED_SPL @<NEED_SPL>@>()=
|
||||
NEED_SPL DO
|
||||
##
|
||||
## Define only if building a kernel complains that there's no memcpy().
|
||||
#### =()<NEED_MEMCPY @<NEED_MEMCPY>@>()=
|
||||
NEED_MEMCPY DONT
|
||||
##
|
||||
## Name of sys/termio.h (or sys/termios.h)
|
||||
#### =()<TERMIO @<TERMIO>@>()=
|
||||
TERMIO termio
|
||||
##
|
||||
## Name of /usr/include/strings.h
|
||||
#### =()<STRINGS @<STRINGS>@>()=
|
||||
STRINGS string
|
||||
##
|
||||
## Does Streeams use signed or unsigned characters in its buffer?
|
||||
#### =()<STREAMCHAR @<STREAMCHAR>@>()=
|
||||
STREAMCHAR uchar_t
|
||||
##
|
||||
## What a minor number is called.
|
||||
#### =()<SUBDEV @<SUBDEV>@>()=
|
||||
SUBDEV uchar_t
|
||||
##
|
||||
## Streams <-> INet interface? "in" or "str"
|
||||
#### =()<TIMEOUT @<TIMEOUT>@>()=
|
||||
STR_IN str
|
||||
##
|
||||
## kernel timeout() funtion. OLD: untimeout takes first two args of timeout().
|
||||
## NEW: untimeout takes return value of timeout().
|
||||
#### =()<TIMEOUT @<TIMEOUT>@>()=
|
||||
TIMEOUT NEW
|
||||
##
|
||||
## Streams XXXopen() -- does it have an additional "pointer to int" argument
|
||||
## which points to the appropriate errno value?
|
||||
#### =()<ADDERROR @<ADDERROR>@>()=
|
||||
ADDERROR DONT
|
||||
##
|
||||
## Include some Streams debugging code? DO or DONT.
|
||||
#### =()<STREAMDEBUG @<STREAMDEBUG>@>()=
|
||||
STREAMDEBUG DO
|
||||
##
|
||||
## Also hook into the Kernel Streams code?
|
||||
#### =()<STREAMDEBUGK @<STREAMDEBUGK>@>()=
|
||||
STREAMDEBUGK DO
|
||||
##
|
||||
## Also allocate a few spare Streams blocks?
|
||||
#### =()<STREAMALLOC @<STREAMALLOC>@>()=
|
||||
STREAMALLOC DONT
|
||||
##
|
||||
## Also include tracing code? DO or DONT.
|
||||
#### =()<STREAMTRACE @<STREAMTRACE>@>()=
|
||||
STREAMTRACE DONT
|
||||
##
|
||||
## Also include free list and queue checking code? DO or DONT.
|
||||
#### =()<STREAMCHECK @<STREAMCHECK>@>()=
|
||||
STREAMCHECK DO
|
||||
##
|
||||
## Cause a reboot if theres a fatal error somewhere? DO or DONT.
|
||||
#### =()<BOOT @<BOOT>@>()=
|
||||
BOOT DONT
|
||||
##
|
||||
|
||||
### ISDN configuration options
|
||||
|
||||
## One TEI per B channel? Seems to be required for US National-1.
|
||||
## DO or DONT.
|
||||
#### =()<MULTI_TEI @<MULTI_TEI>@>()=
|
||||
MULTI_TEI DONT
|
||||
##
|
||||
## Take down Level 2 if idle? (Some PBXes don't like this.)
|
||||
#### =()<L2_DOWN @<L2_DOWN>@>()=
|
||||
L2_DOWN DO
|
||||
##
|
||||
## Grab a TEI when starting up?
|
||||
## Turn this on if the first incoming call is answered too late.
|
||||
#### =()<TEI_IMMEDIATE @<TEI_IMMEDIATE>@>()=
|
||||
TEI_IMMEDIATE DONT
|
||||
|
||||
##
|
||||
## Delay when establishing a connection. Range: 1..HZ*2.
|
||||
## Use this when the ISDN switch has problems with accepting data
|
||||
## immediately after establishing a connection.
|
||||
#### =()<UP_DELAY @<UP_DELAY>@>()=
|
||||
UP_DELAY ((HZ * 3) / 2)
|
||||
|
||||
##
|
||||
## What to call protocol stuff. M_PROTO or M_EXPROTO or (M_PROTO+0x40)
|
||||
#### =()<MSG_PROTO @<MSG_PROTO>@>()=
|
||||
MSG_PROTO M_PROTO
|
||||
##
|
||||
## What to call hopefully-expedited data stuff. M_DATA or M_EXDATA or (M_DATA+0x40).
|
||||
#### =()<MSG_DATA @<MSG_DATA>@>()=
|
||||
MSG_DATA M_DATA
|
||||
|
||||
|
||||
|
||||
##
|
||||
#### Path names
|
||||
ROUTE_PATH /usr/etc/route
|
|
@ -1,79 +1,210 @@
|
|||
##
|
||||
## ISDN master configuration file.
|
||||
## ISDN master configuration file for Linux.
|
||||
## Note that if you leave a field blank, you must have the trailing tab!
|
||||
##
|
||||
|
||||
|
||||
##
|
||||
## System type. Selects which Makefiles to use for installation.
|
||||
##
|
||||
## System type.
|
||||
##
|
||||
#### =()<SYS @<SYS>@>()=
|
||||
SYS aux
|
||||
SYS linux
|
||||
##
|
||||
## Name of the "KERNEL" flag in system include files (KERNEL, _KERNEL, INKERNEL)
|
||||
#### =()<KERNEL @<KERNEL>@>()=
|
||||
KERNEL KERNEL
|
||||
## Byte order. Motorola 4321, Intel 1234.
|
||||
#### =()<BYTEORDER @<BYTEORDER>@>()=
|
||||
BYTEORDER 4321
|
||||
##
|
||||
## Card drivers to install. Subdirectories of SRC/cards.
|
||||
## Where to install everything. The programs are in bin-KERNELVERSION.
|
||||
##
|
||||
#### =()<DESTDIR @<DESTDIR>@>()=
|
||||
DESTDIR /usr/local/isdn
|
||||
##
|
||||
##
|
||||
## What to name the lockfiles. Someting with %s (device name).
|
||||
## Make sure "cu" and other UUCP utilities use the same convention!
|
||||
##
|
||||
#### =()<LOCKNAME @<LOCKNAME>@>()=
|
||||
LOCKNAME /var/lock/LCK..%s
|
||||
##
|
||||
##
|
||||
#### Path names
|
||||
##
|
||||
#### =()<ROUTE_PATH @<ROUTE_PATH>@>()=
|
||||
ROUTE_PATH /sbin/route
|
||||
##
|
||||
##
|
||||
##
|
||||
## Card drivers to install. teles.
|
||||
##
|
||||
#### =()<CARDS @<CARDS>@>()=
|
||||
CARDS leonardo
|
||||
CARDS teles
|
||||
##
|
||||
## Defines for master program (L2 test version)
|
||||
#### =()<CARDDEFS @<CARDDEFS>@>()=
|
||||
CARDDEFS -DLEONARDO
|
||||
##
|
||||
## Level to include in master program.
|
||||
## Set to 3.(2 for semi-testing L2 in user mode. 4 is untested.)
|
||||
#### =()<MLEVEL @<MLEVEL>@>()=
|
||||
MLEVEL 3
|
||||
|
||||
## If you have a parallel make, set this to "&"
|
||||
#### =()<P @<P>@>()=
|
||||
P
|
||||
## C pre-processor flags
|
||||
#### =()<DEFS @<DEFS>@>()=
|
||||
DEFS -I../include
|
||||
## C pre-processor flags, when compiling card support
|
||||
#### =()<DEFS2 @<DEFS2>@>()=
|
||||
DEFS2 -I../../include
|
||||
## C compiler
|
||||
## Protocols to make. fixed phone tei.
|
||||
##
|
||||
#### =()<PROTOCOLS @<PROTOCOLS>@>()=
|
||||
PROTOCOLS phone tei
|
||||
##
|
||||
##
|
||||
## Subprotocols for "phone". euro german.
|
||||
##
|
||||
#### =()<SUBPROTOCOLS @<SUBPROTOCOLS>@>()=
|
||||
SUBPROTOCOLS euro german
|
||||
##
|
||||
##
|
||||
##
|
||||
## Stuff to define
|
||||
##
|
||||
## Where's the Linux source?
|
||||
##
|
||||
#### =()<KERNELSRC @<KERNELSRC>@>()=
|
||||
KERNELSRC /usr/src/linux
|
||||
##
|
||||
##
|
||||
## C compiler for the kernel
|
||||
##
|
||||
#### =()<CC @<CC>@>()=
|
||||
CC gcc.new
|
||||
CC gcc
|
||||
##
|
||||
##
|
||||
## C compiler for the utilities
|
||||
##
|
||||
#### =()<HOSTCC @<HOSTCC>@>()=
|
||||
HOSTCC gcc
|
||||
##
|
||||
##
|
||||
## C flags for kernel modules. Needs -DMODULE -DKERNEL -D__KERNEL__.
|
||||
##
|
||||
## C compiler flags
|
||||
#### =()<CFLAGS @<CFLAGS>@>()=
|
||||
CFLAGS $(DEFS) -g -O2 -W -Wreturn-type -Wshadow -Wcomment
|
||||
#CFLAGS $(DEFS) -g -O -W -Wreturn-type -Wshadow -Wcomment
|
||||
#CFLAGS $(DEFS) -g -W -Wreturn-type -Wshadow -Wcomment -D_BSD_SOURCE -D_SYSV_SOURCE
|
||||
## Flags for the "cc -o" line; e.g., -Bstatic on SunOS4.x while debugging.
|
||||
CFLAGS -g -O2 -Wall -fomit-frame-pointer -DKERNEL -D__KERNEL__ -DMODULE
|
||||
##
|
||||
##
|
||||
## C flags for programs
|
||||
##
|
||||
#### =()<HOSTCFLAGS @<HOSTCFLAGS>@>()=
|
||||
HOSTCFLAGS -g -O2 -Wall
|
||||
#CFLAGS -x c++ -g -O2 -W -Wreturn-type -Wshadow -Wcomment
|
||||
#CFLAGS -g -W -Wreturn-type -Wshadow -Wcomment -D_BSD_SOURCE -D_SYSV_SOURCE
|
||||
##
|
||||
##
|
||||
## Calling ld directly?
|
||||
##
|
||||
#### =()<LD @<LD>@>()=
|
||||
LD ld
|
||||
#LD /usr/i486-linuxaout/bin/ld -m i386linux
|
||||
##
|
||||
##
|
||||
## Flags for the "cc -o" command line
|
||||
##
|
||||
#### =()<LDFLAGS @<LDFLAGS>@>()=
|
||||
LDFLAGS
|
||||
##
|
||||
##
|
||||
## If you need to link in other libraries, add them here
|
||||
##
|
||||
#### =()<LIBS @<LIBS>@>()=
|
||||
LIBS -lbsd -lc_s
|
||||
LIBS -lbsd
|
||||
##
|
||||
## RANLIB
|
||||
##
|
||||
##
|
||||
## System dependent stuff below: don't change.
|
||||
##
|
||||
##
|
||||
## Byte order. Motorola 4321, Intel 1234.
|
||||
#### =()<BYTEORDER @<BYTEORDER>@>()=
|
||||
BYTEORDER 1234
|
||||
##
|
||||
## Ranlib needed ? "ranlib" or "echo"
|
||||
#### =()<RANLIB @<RANLIB>@>()=
|
||||
RANLIB : ranlib
|
||||
RANLIB echo
|
||||
##
|
||||
## Need strsave(3)? DO or DONT.
|
||||
#### =()<NEED_STRDUP @<NEED_STRDUP>@>()=
|
||||
NEED_STRDUP DONT
|
||||
##
|
||||
## Do you have setsid()?
|
||||
#### =()<HAVE_SETSID @<HAVE_SETSID>@>()=
|
||||
HAVE_SETSID DO
|
||||
##
|
||||
## How many arguments does your setpgrp() take? 0 or 2.
|
||||
#### =()<HAVE_SETPGRP @<HAVE_SETPGRP>@>()=
|
||||
HAVE_SETPGRP 0
|
||||
|
||||
## Does Streeams use signed or unsigned characters in its buffer?
|
||||
#### =()<STREAMCHAR @<STREAMCHAR>@>()=
|
||||
STREAMCHAR unsigned char
|
||||
##
|
||||
## Define only if building a kernel complains that there's no spl().
|
||||
#### =()<NEED_SPL @<NEED_SPL>@>()=
|
||||
NEED_SPL DONT
|
||||
##
|
||||
## signal functions' return type? Usually void or int.
|
||||
#### =()<SIGRET @<SIGRET>@>()=
|
||||
SIGRET void
|
||||
##
|
||||
## Need writev(3)? DO or DONT.
|
||||
#### =()<NEED_WRITEV @<NEED_WRITEV>@>()=
|
||||
NEED_WRITEV DONT
|
||||
##
|
||||
## Signal blocking? SYSV or BSD or NONE.
|
||||
#### =()<SIGTYPE @<SIGTYPE>@>()=
|
||||
SIGTYPE SYSV
|
||||
##
|
||||
## Define only if building a kernel complains that there's no memcpy.
|
||||
#### =()<NEED_MEMCPY @<NEED_MEMCPY>@>()=
|
||||
NEED_MEMCPY DONT
|
||||
##
|
||||
## Name of sys/termio.h (or sys/termios.h)
|
||||
#### =()<TERMIO @<TERMIO>@>()=
|
||||
TERMIO termio
|
||||
TERMIO termios
|
||||
##
|
||||
## Name of /usr/include/strings.h
|
||||
#### =()<STRINGS @<STRINGS>@>()=
|
||||
STRINGS strings
|
||||
STRINGS string
|
||||
##
|
||||
## What a minor number is called.
|
||||
#### =()<SUBDEV @<SUBDEV>@>()=
|
||||
SUBDEV uchar_t
|
||||
##
|
||||
## Streams <-> INet interface? "in" or "in2" or "str" or "linux" or "none"
|
||||
## "in" is old BSD, "in2" is BSD 4.4, "str" is Streams-based
|
||||
#### =()<STR_IF @<STR_IF>@>()=
|
||||
STR_IF linux
|
||||
##
|
||||
## kernel timeout() funtion. OLD: untimeout takes first two args of timeout().
|
||||
## NEW: untimeout takes return value of timeout().
|
||||
#### =()<TIMEOUT @<TIMEOUT>@>()=
|
||||
TIMEOUT NEW
|
||||
##
|
||||
## Streams XXXopen() -- does it get an additional "pointer to int" argument
|
||||
## which points to the appropriate errno value?
|
||||
#### =()<ADDERROR @<ADDERROR>@>()=
|
||||
ADDERROR DONT
|
||||
##
|
||||
## Debugging? DO or DONT
|
||||
#### =()<DEBUGGING @<DEBUGGING>@>()=
|
||||
DEBUGGING DO
|
||||
#### =()<CONF_MOD2 @<CONF_MOD2>@>()=
|
||||
CONF_MOD2 0x30
|
||||
## 0x00, 0x33
|
||||
#### =()<CONF_DEBUG @<CONF_DEBUG>@>()=
|
||||
CONF_DEBUG 0x5016
|
||||
## 0x5006, 0xf3df
|
||||
|
||||
|
||||
### ISDN configuration options
|
||||
|
||||
## One TEI per B channel? Seems to be required for US National-1.
|
||||
## DO or DONT.
|
||||
#### =()<MULTI_TEI @<MULTI_TEI>@>()=
|
||||
MULTI_TEI DONT
|
||||
##
|
||||
##
|
||||
## What to call protocol stuff. M_EXPROTO or (M_PROTO+0x40)
|
||||
#### =()<MSG_PROTO @<MSG_PROTO>@>()=
|
||||
MSG_PROTO M_EXPROTO
|
||||
##
|
||||
## What to call hopefully-expedited data stuff.
|
||||
## What to call hopefully-expedited data stuff. M_EXDATA or (M_DATA+0x40).
|
||||
#### =()<MSG_EXDATA @<MSG_EXDATA>@>()=
|
||||
MSG_EXDATA M_EXDATA
|
||||
##
|
||||
## What to call normal data stuff. M_DATA
|
||||
#### =()<MSG_DATA @<MSG_DATA>@>()=
|
||||
MSG_DATA M_EXDATA
|
||||
MSG_DATA M_DATA
|
||||
|
||||
|
|
|
@ -1,38 +1,7 @@
|
|||
;; List of isdn files that are fed to subst.
|
||||
;; Lines beginning with a semi-colon are comment lines.
|
||||
../rate/Makefile
|
||||
../alaw/Makefile
|
||||
../compat/Makefile
|
||||
../streams/Makefile
|
||||
;; ../cards/leonardo/Makefile
|
||||
;; ../ppp_if/Makefile
|
||||
../cards/Makefile
|
||||
../cards/arnet/Makefile
|
||||
../cards/dumb/Makefile
|
||||
;; ../cards/bintec/Makefile
|
||||
../config/Makefile
|
||||
../tools/Makefile
|
||||
../include/config.h
|
||||
../include/f_strings.h
|
||||
../include/f_termio.h
|
||||
../include/Makefile
|
||||
../include/msgtype.h
|
||||
../ip_mon/Makefile
|
||||
../isdn_2/Makefile
|
||||
../isdn_3/Makefile
|
||||
../isdn_4/Makefile
|
||||
../ksupport/Makefile
|
||||
../reconnect/Makefile
|
||||
;; ../portman/Makefile
|
||||
../pr_on/Makefile
|
||||
../str_if/Makefile
|
||||
;; ../strppp/Makefile
|
||||
../strslip/Makefile
|
||||
../support/Makefile
|
||||
../timer/Makefile
|
||||
../t70/Makefile
|
||||
../fakeh/Makefile
|
||||
../van_j/Makefile
|
||||
../v110/Makefile
|
||||
../x75/Makefile
|
||||
../final/Makefile
|
||||
../Make.config
|
||||
|
|
1294
config/subst.s
1294
config/subst.s
File diff suppressed because it is too large
Load Diff
|
@ -1,52 +1,5 @@
|
|||
SHELL = /bin/sh
|
||||
MAKE = make
|
||||
## =()<P = @<P>@>()=
|
||||
P =
|
||||
KERNEL=1
|
||||
|
||||
## =()<CC = @<CC>@>()=
|
||||
CC = gcc
|
||||
## =()<DEFS = @<DEFKERNEL>@ @<KERNEL>@ -I../include >()=
|
||||
DEFS = -I../streams -I../compat -I/usr/src/linux/include -fomit-frame-pointer -DKERNEL -D__KERNEL__ -DMODULE -DCONFIG_MODVERSIONS -I../include
|
||||
## =()<CFLAGS = @<CFLAGS>@ $(DEFS)>()=
|
||||
CFLAGS = -O2 -Wall $(DEFS)
|
||||
## =()<DEFSN = @<DEFS>@ >()=
|
||||
DEFSN = -I../streams -I../compat -I/usr/src/linux/include -I/usr/include/bsd
|
||||
## =()<CFLAGSN = @<CFLAGS>@ $(DEFSN)>()=
|
||||
CFLAGSN = -O2 -Wall $(DEFSN)
|
||||
|
||||
## =()<SYS = @<SYS>@>()=
|
||||
SYS = linux
|
||||
|
||||
SOURCES = fakeh.c
|
||||
|
||||
OBJ = fakeh.o
|
||||
ALL =
|
||||
|
||||
all: $(OBJ) $(ALL)
|
||||
|
||||
lib:
|
||||
|
||||
install: all
|
||||
@sh ../iftrue.sh "-d $(SYS)" "cd $(SYS); make"
|
||||
|
||||
update: all
|
||||
@sh ../iftrue.sh "-d $(SYS)" "cd $(SYS); make update"
|
||||
|
||||
indent:
|
||||
../indent.sh $(SOURCES) $(TESTSOURCES)
|
||||
|
||||
depend: Makefile $(SOURCES) $(TESTSOURCES)
|
||||
$(CC) -M $(DEFS) $(SOURCES) $(TESTSOURCES) > .depend
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(ALL) $(TESTALL) $(TESTOBJ)
|
||||
@sh ../iftrue.sh "-d $(SYS)" "cd $(SYS); make clean"
|
||||
|
||||
|
||||
load:
|
||||
insmod fakeh.o
|
||||
|
||||
ifeq (.depend,$(wildcard .depend))
|
||||
include .depend
|
||||
endif
|
||||
TOPDIR=..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
SHELL = /bin/sh
|
||||
MAKE = make
|
||||
## =()<SYS = @<SYS>@>()=
|
||||
SYS = linux
|
||||
|
||||
## =()<CC = @<CC>@>()=
|
||||
CC = gcc
|
||||
## =()<DEFS = @<DEFKERNEL>@ @<KERNEL>@ >()=
|
||||
DEFS = -I../streams -I../compat -I/usr/src/linux/include -fomit-frame-pointer -DKERNEL -D__KERNEL__ -DMODULE
|
||||
## =()<CFLAGS = @<CFLAGS>@ $(DEFS)>()=
|
||||
CFLAGS = -g -O2 -Wall $(DEFS)
|
||||
|
||||
## =()<SYS = @<SYS>@>()=
|
||||
SYS = linux
|
||||
## =()<DESTDIR = @<DESTDIR>@>()=
|
||||
DESTDIR = /usr/local/isdn
|
||||
|
||||
SOURCES = x75.c
|
||||
|
||||
doinstall:
|
||||
#@$(MAKE) $(MAKEFLAGS) -C .. install
|
||||
|
||||
install.sys:
|
||||
@sh ../iftrue.sh "-f $(SYS)/Makefile" "cd $(SYS) && $(MAKE) $(MAKEFLAGS) install \
|
||||
CFLAGS=\"$(CFLAGS)\" CC=\"$(CC)\""
|
||||
if test ! -d ${DESTDIR} ; then mkdir ${DESTDIR} ; else true ; fi
|
||||
if test ! -d ${DESTDIR}/bin ; then mkdir ${DESTDIR}/bin ; else true ; fi
|
||||
if test ! -f /etc/isdn.conf; then cp ../cf.tcp /etc/isdn.conf ; else true ; fi
|
||||
|
||||
install.bin:
|
||||
DIR=${DESTDIR}/bin-$$(uname -r) ; \
|
||||
if test -d $$DIR ; then true; else mkdir -p $$DIR; fi ; \
|
||||
for i in `/bin/ls ../bin` ; do \
|
||||
test -f $$DIR/$$i && \
|
||||
mv -f $$DIR/$$i $$DIR/$$i.old ; \
|
||||
cp ../bin/$$i $$DIR/$$i ; \
|
||||
done
|
||||
|
||||
# "install" does _not_ depend on all, because all calls install indirectly
|
||||
#install: install.sys install.bin
|
||||
install: install.sys
|
||||
|
||||
clean:
|
||||
@sh ../iftrue.sh "-f $(SYS)/Makefile" "cd $(SYS) && $(MAKE) $(MAKEFLAGS) clean"
|
||||
|
||||
run:
|
||||
@sh ../iftrue.sh "-f $(SYS)/Makefile" "cd $(SYS) && $(MAKE) $(MAKEFLAGS) run"
|
||||
|
||||
lib:
|
||||
|
||||
depend:
|
||||
|
||||
load:
|
||||
|
||||
all:
|
||||
|
25
iftrue.sh
25
iftrue.sh
|
@ -1,25 +0,0 @@
|
|||
#! /bin/sh
|
||||
## $Revision: 1.2 $
|
||||
## Perform a test(1) and execute a command string if the test is true;
|
||||
## otherwise exit 0. Usage:
|
||||
## testit <test> <command>
|
||||
## On some systems (those with a /bin/sh from BSD4.2), the following
|
||||
## line in a Makefile will always fail:
|
||||
## if [ ! -f x ] ; then echo No x -- stop. ; exit 1 ; else exit 0 ; fi
|
||||
case $# in
|
||||
2)
|
||||
;;
|
||||
*)
|
||||
echo "Can't perform test: wrong number of arguments." 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
TEST="$1"
|
||||
COMMAND="$2"
|
||||
|
||||
## Note the lack of quotes around ${TEST} below.
|
||||
if test ${TEST} ; then
|
||||
eval "${COMMAND}"
|
||||
exit $?
|
||||
fi
|
||||
exit 0
|
|
@ -1,18 +1,5 @@
|
|||
HEADERS = $(wildcard *.h)
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
HEADERS = alaw.h config.h dump.h isdn3_phone.h isdn_12.h isdn_2.h isdn_23.h \
|
||||
isdn_3.h isdn_34.h isdn_limits.h isdn_proto.h kernel.h lap.h msgtype.h \
|
||||
phone_1TR6.h primitives.h proto.h q_data.h sioctl.h smallq.h streamlib.h \
|
||||
streams.h timeout.h v110.h x75.h x75lib.h
|
||||
|
||||
SOURCES =
|
||||
OBJ =
|
||||
ALL =
|
||||
|
||||
all prog lib install update clean depend load:
|
||||
|
||||
indent:
|
||||
../indent.sh $(HEADERS) $(SOURCES)
|
||||
|
||||
TOPDIR=..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
||||
|
|
|
@ -40,9 +40,9 @@ typedef unsigned char streamchar;
|
|||
|
||||
#ifdef KERNEL
|
||||
/* =()<#define CONF_MOD2 @<CONF_MOD2>@>()= */
|
||||
#define CONF_MOD2 0x00
|
||||
#define CONF_MOD2 0x30
|
||||
/* =()<#define CONF_DEBUG @<CONF_DEBUG>@>()= */
|
||||
#define CONF_DEBUG 0x0000
|
||||
#define CONF_DEBUG 0x5016
|
||||
#else
|
||||
#ifdef DO_DEBUGGING
|
||||
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
#ifndef _ISDN3_PHONE
|
||||
#define _ISDN3_PHONE
|
||||
|
||||
/* PD */
|
||||
#define PD_Q931 8
|
||||
#define PD_N0 0x40
|
||||
#define PD_N1 0x41
|
||||
|
||||
/*
|
||||
* Interface for different phone protocol handlers.
|
||||
*/
|
||||
|
@ -78,11 +73,6 @@ typedef struct _isdn3_prot {
|
|||
*/
|
||||
int isdn3_attach_prot (isdn3_prot prot);
|
||||
|
||||
/*
|
||||
* Find the protocol; "info" has a list of allowable protocols
|
||||
*/
|
||||
isdn3_prot isdn3_findprot (mblk_t *info, uchar_t protocol);
|
||||
|
||||
/*
|
||||
* Extract data into a conn vector.
|
||||
*/
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
typedef struct _isdn23_hdr {
|
||||
uchar_t key;
|
||||
ushort_t seqnum;
|
||||
union { /* Length param must be first if it's needed */
|
||||
|
||||
struct { /* Command mode data/response. */
|
||||
|
@ -159,6 +160,7 @@ typedef struct _isdn23_hdr {
|
|||
* somewhat cleaner if the TEI negotiation
|
||||
* handler is just another L3 protocol */
|
||||
struct {
|
||||
ushort_t len;
|
||||
uchar_t card;
|
||||
int seqnum;
|
||||
int foffset;
|
||||
|
@ -169,7 +171,7 @@ typedef struct _isdn23_hdr {
|
|||
*/
|
||||
|
||||
} sel;
|
||||
} *isdn23_hdr;
|
||||
} __attribute__((packed)) *isdn23_hdr;
|
||||
|
||||
/* Aliases for writing actual programs. *//* Keys for debugging L2. */
|
||||
#define hdr_atcmd sel._hdr_atcmd /* A */
|
||||
|
|
|
@ -31,6 +31,7 @@ typedef struct _isdn3_card { /* One per card */
|
|||
uchar_t nr; /* Card number, for L2. */
|
||||
uchar_t TEI; /* For reference */
|
||||
uchar_t bchans; /* Number of B channels. */
|
||||
unsigned is_up:1;
|
||||
} *isdn3_card;
|
||||
|
||||
/**
|
||||
|
@ -102,6 +103,11 @@ typedef void (*P_hndl_killconn) (struct _isdn3_conn * conn, char force);
|
|||
*/
|
||||
typedef void (*P_hndl_hook) (struct _isdn3_conn * conn);
|
||||
|
||||
/*
|
||||
* Catch what's sent down to L2. If data returns NULL, forward nothing.
|
||||
*/
|
||||
typedef int (*P_hndl_proto) (struct _isdn3_conn * conn, mblk_t **data, char down);
|
||||
|
||||
typedef struct _isdn3_hndl {
|
||||
struct _isdn3_hndl *next; /* Next handler */
|
||||
uchar_t SAPI;
|
||||
|
@ -119,6 +125,7 @@ typedef struct _isdn3_hndl {
|
|||
P_hndl_kill kill; /* Say goodbye */
|
||||
P_hndl_killconn killconn; /* terminate a connection */
|
||||
P_hndl_hook hook; /* isdn3_setup_conn was called */
|
||||
P_hndl_proto proto; /* Send cmd; used for catching protocol lists */
|
||||
} *isdn3_hndl;
|
||||
|
||||
/**
|
||||
|
@ -127,6 +134,9 @@ typedef struct _isdn3_hndl {
|
|||
** Calls managed by this connection are chained off the struct.
|
||||
**/
|
||||
|
||||
#define NITALK 3
|
||||
#define NSTALK 1
|
||||
|
||||
typedef struct _isdn3_talk { /* one per card's D channel connection */
|
||||
struct _isdn3_conn *conn; /* connections managed on this channel */
|
||||
struct _isdn3_card *card; /* Back ref to my card */
|
||||
|
@ -134,15 +144,16 @@ typedef struct _isdn3_talk { /* one per card's D channel connection */
|
|||
struct _isdn3_hndl *hndl; /* Handler for this type of talk. */
|
||||
uchar_t state; /* . Zero: first call / uninitialized. Others
|
||||
* depend on the talker. */
|
||||
int talk_a, talk_b, talk_c, talk_d; /* additional variables, handler
|
||||
* dependent */
|
||||
long talki[NITALK];
|
||||
void *talks[NSTALK];
|
||||
} *isdn3_talk;
|
||||
|
||||
/**
|
||||
** One struct isdn3_conn represents one ISDN call.
|
||||
**/
|
||||
#define NCONNVEC 5
|
||||
#define STACK_LEN 10
|
||||
#define NICONN 15
|
||||
#define NSCONN 3
|
||||
|
||||
typedef struct _isdn3_conn {
|
||||
struct _isdn3_card *card; /* Card this call is running on */
|
||||
|
@ -156,8 +167,9 @@ typedef struct _isdn3_conn {
|
|||
* vs... */
|
||||
char stack[STACK_LEN]; /* Protocol stack to set up on this
|
||||
* connection */
|
||||
int *v[NCONNVEC]; /* additional and possibly-long parameters */
|
||||
int delay; /* don't get at it right away */
|
||||
long conni[NICONN]; /* additional variables, handler dependent */
|
||||
void *conns[NSCONN];
|
||||
#ifdef NEW_TIMEOUT /* Grumble */
|
||||
int start_timer;
|
||||
int delay_timer;
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
* will be interpreted directly. This
|
||||
* way, specialized drivers can do
|
||||
* their own call management. */
|
||||
#define CMD_NOCARD CHAR2('q','C') /* (active) card is to be presumed dead */
|
||||
|
||||
/* Commands for ISDN-B access. */
|
||||
#define CMD_DIAL CHAR2 ('d','o')/* Dial out. */
|
||||
|
@ -103,6 +104,7 @@
|
|||
#define ARG_NOREJECT CHAR2('n','j') /* don't send REJ code */
|
||||
#define ARG_FASTDROP CHAR2('f','X')
|
||||
#define ARG_FASTREDIAL CHAR2('f','r')
|
||||
#define ARG_CHANBUSY CHAR2('i','b')
|
||||
#define ARG_IGNORELIMIT CHAR2('i','l')
|
||||
|
||||
#define ARG_FORCE CHAR2('f','d') /* In CMD_OFF: Force DISC */
|
||||
|
@ -124,11 +126,15 @@
|
|||
#define ARG_CONNREF CHAR2 ('C','r') /* uchar refnum for a connection. */
|
||||
#define ARG_CARD CHAR2 ('c','d') /* ident Card */
|
||||
#define ARG_CHANNEL CHAR2 ('b','c') /* uchar B channel to use */
|
||||
#define ARG_ASSOC CHAR2 ('a','=') /* associate card IDs */
|
||||
#define ARG_LISTEN CHAR2 ('l','p') /* listen params */
|
||||
|
||||
#define ARG_MINOR CHAR2 ('m','i') /* uchar minor number of data
|
||||
* connection */
|
||||
#define ARG_FMINOR CHAR2 ('m','f') /* uchar minor number of command
|
||||
* connection */
|
||||
#define ARG_CALLREF CHAR2 ('c','r') /* long call reference number */
|
||||
#define ARG_EAZ CHAR2 ('e','a') /* map EAZ to local phone nr */
|
||||
#define ARG_LNUMBER CHAR2 ('l','r') /* local phone nr */
|
||||
#define ARG_NUMBER CHAR2 ('n','r') /* remote phone nr */
|
||||
#define ARG_OUTNUMS CHAR2 ('o','m') /* outgoing, for build */
|
||||
|
@ -162,6 +168,7 @@
|
|||
|
||||
#define ARG_SEQNUM CHAR2('s','N') /* number of the file */
|
||||
#define ARG_OFFSET CHAR2('o','F') /* offset within the file */
|
||||
#define ARG_LENGTH CHAR2('l','N') /* offset within the file */
|
||||
|
||||
#define ARG_UPDELAY CHAR2('u','d') /* Delay the data exchange */
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#define PROTO_AT CHAR2('a','t') /* Command. "*at ATD9612521". */
|
||||
#define PROTO_MODULE CHAR2('m','s') /* Setup for a protocol */
|
||||
#define PROTO_MODLIST CHAR2('m','l') /* list of modules to be pushed */
|
||||
#define PROTO_UPDATEMODLIST CHAR2('m','L') /* informational: list of modules */
|
||||
#define PROTO_ERROR CHAR2('e','r')/* Error. */
|
||||
#define PROTO_NOERROR CHAR2('o','k') /* Error. */
|
||||
/*
|
||||
|
|
|
@ -4,19 +4,23 @@
|
|||
|
||||
#if defined(linux)
|
||||
#include <linux/config.h>
|
||||
#ifdef CONFIG_DEBUG_LATENCY
|
||||
#undef CONFIG_DEBUG_LATENCY
|
||||
#endif
|
||||
#endif
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
extern int spl6 (void);
|
||||
extern int spl1 (void);
|
||||
extern int splhi (void);
|
||||
extern int splx (int ms);
|
||||
extern int spl (int ms);
|
||||
|
||||
extern void timeout (void *a, void *b, int c);
|
||||
extern void untimeout (void *a, void *b);
|
||||
|
||||
int min (int a, int b);
|
||||
int max (int a, int b);
|
||||
|
||||
extern void panic(const char *x, ...);
|
||||
|
||||
#define KERN_EMERG "0:" /* system is unusable */
|
||||
|
@ -28,5 +32,29 @@ extern void panic(const char *x, ...);
|
|||
#define KERN_INFO "6:" /* informational */
|
||||
#define KERN_DEBUG "7:" /* debug-level messages */
|
||||
|
||||
#define kmalloc(a,b) malloc((a))
|
||||
#define kfree(a) free((a))
|
||||
#define kfree_s(a,b) free((a))
|
||||
|
||||
#else /* KERNEL */
|
||||
#include <linux/kernel.h>
|
||||
char *loghdr(char level);
|
||||
#undef KERN_EMERG
|
||||
#undef KERN_ALERT
|
||||
#undef KERN_CRIT
|
||||
#undef KERN_ERR
|
||||
#undef KERN_WARNING
|
||||
#undef KERN_NOTICE
|
||||
#undef KERN_INFO
|
||||
#undef KERN_DEBUG
|
||||
#define KERN_EMERG loghdr(0)
|
||||
#define KERN_ALERT loghdr(1)
|
||||
#define KERN_CRIT loghdr(2)
|
||||
#define KERN_ERR loghdr(3)
|
||||
#define KERN_WARNING loghdr(4)
|
||||
#define KERN_NOTICE loghdr(5)
|
||||
#define KERN_INFO loghdr(6)
|
||||
#define KERN_DEBUG loghdr(7)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* Defs for Q.921. */
|
||||
|
||||
#define SAPI_INVALID 0xFF
|
||||
#define TEI_FIXED 0x12 /* if using a fixed TEI value */
|
||||
#define TEI_BROADCAST 0x7F
|
||||
#define TEI_REQUESTED 0xFF /* invalid value, used in L2 only
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef LOADER_H
|
||||
#define LOADER_H
|
||||
#include <stream.h>
|
||||
|
||||
struct cardinfo {
|
||||
long memaddr;
|
||||
short ioaddr;
|
||||
unsigned char irq, ipl;
|
||||
unsigned long ID;
|
||||
unsigned int debug;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,24 +1,19 @@
|
|||
#ifndef _PRIM_H
|
||||
#define _PRIM_H
|
||||
|
||||
#ifdef linux
|
||||
#ifdef KERNEL
|
||||
#include <linux/config.h>
|
||||
#endif
|
||||
#include <linux/major.h>
|
||||
#include <linux/syscompat.h>
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
#include "kernel.h"
|
||||
|
||||
#include "msgtype.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#ifdef linux
|
||||
#include <linux/major.h>
|
||||
#ifdef KERNEL
|
||||
#include <linux/syscompat.h>
|
||||
#include <linux/kernel.h>
|
||||
#else
|
||||
#include "kernel.h"
|
||||
#include <stdio.h> /* printf */
|
||||
#include <unistd.h>
|
||||
#include <stddef.h>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef ISDN_SAPI
|
||||
#define ISDN_SAPI
|
||||
|
||||
/*
|
||||
* Service Access Point Identifiers. (Oder sowas in der Art...)
|
||||
*/
|
||||
|
||||
#define SAPI_PHONE 0
|
||||
#define SAPI_PHONE_DSS1 8
|
||||
#define SAPI_PHONE_1TR6_0 64 /* Unused (so far) */
|
||||
#define SAPI_PHONE_1TR6_1 65
|
||||
|
||||
#define SAPI_TEI 63
|
||||
|
||||
/* pseudo-SAPIs */
|
||||
#define SAPI_FIXED 64
|
||||
|
||||
#define SAPI_CAPI 65
|
||||
#define SAPI_CAPI_BINTEC 0
|
||||
|
||||
#define SAPI_INVALID 127
|
||||
|
||||
#endif
|
|
@ -78,15 +78,15 @@ int putctlx1 (queue_t * q, char type, streamchar msg);
|
|||
|
||||
#ifdef CONFIG_DEBUG_STREAMS
|
||||
|
||||
#define pullupm(q,x) deb_pullupm(__FILE__,__LINE__,q,x)
|
||||
#define pullupm(q,x) deb_pullupm(__FILE__,__LINE__,(q),(x))
|
||||
mblk_t *deb_pullupm (const char *deb_file, unsigned int deb_line, mblk_t * mb, short what);
|
||||
|
||||
#define putctlx(q,t) deb_putctlx(__FILE__,__LINE__,q,t)
|
||||
#define putctlx1(q,t,p) deb_putctlx1(__FILE__,__LINE__,q,t,p)
|
||||
#define putctlx(q,t) deb_putctlx(__FILE__,__LINE__,(q),(t))
|
||||
#define putctlx1(q,t,p) deb_putctlx1(__FILE__,__LINE__,(q),(t),(p))
|
||||
int deb_putctlx (const char *deb_file, unsigned int deb_line, queue_t * q, char type);
|
||||
int deb_putctlx1 (const char *deb_file, unsigned int deb_line, queue_t * q, char type, streamchar msg);
|
||||
|
||||
#define putbqf(q,m) deb_putbqf(__FILE__,__LINE__,q,m)
|
||||
#define putbqf(q,m) deb_putbqf(__FILE__,__LINE__,(q),(m))
|
||||
void deb_putbqf (const char *deb_file, unsigned int deb_line, queue_t * q, mblk_t *mb);
|
||||
|
||||
#endif /* CONFIG_DEBUG_STREAMS */
|
||||
|
@ -112,18 +112,23 @@ int m_getlx (mblk_t * mb, ulong_t * id);
|
|||
int m_geti (mblk_t * mb, long *id);
|
||||
int m_getx (mblk_t * mb, ulong_t * id);
|
||||
int m_getstr (mblk_t * mb, char *str, int maxlen);
|
||||
int m_getstrlen (mblk_t * mb);
|
||||
int m_getc (mblk_t * mb, char *c);
|
||||
int m_gethex (mblk_t *mb, uchar_t *data, int len);
|
||||
int m_gethexlen (mblk_t *mb);
|
||||
|
||||
|
||||
#ifdef CONFIG_DEBUG_STREAMS
|
||||
void deb_m_reply (const char*, unsigned int, queue_t * q, mblk_t * mb, int err);
|
||||
#define m_reply(a,b,c) deb_m_reply(__FILE__,__LINE__,a,b,c)
|
||||
#define m_reply(a,b,c) deb_m_reply(__FILE__,__LINE__,(a),(b),(c))
|
||||
void deb_md_reply (const char*, unsigned int, queue_t * q, mblk_t * mb, int err);
|
||||
#define md_reply(a,b,c) deb_md_reply(__FILE__,__LINE__,a,b,c)
|
||||
#define md_reply(a,b,c) deb_md_reply(__FILE__,__LINE__,(a),(b),(c))
|
||||
mblk_t * deb_make_reply (const char*, unsigned int, int err);
|
||||
#define make_reply(a) deb_make_reply(__FILE__,__LINE__,(a))
|
||||
#else
|
||||
void m_reply (queue_t * q, mblk_t * mb, int err);
|
||||
void md_reply (queue_t * q, mblk_t * mb, int err);
|
||||
mblk_t * make_reply (int err);
|
||||
#endif
|
||||
|
||||
#endif /* _STREAMLIB_H */
|
||||
|
|
|
@ -90,9 +90,16 @@ mblk_t *allocsb (ushort_t size, streamchar *data);
|
|||
void modregister (struct streamtab *info);
|
||||
struct xstream *stropen (int flag);
|
||||
void strclose (struct xstream *xp, int flag);
|
||||
int strread (struct xstream *xp, streamchar *data, int *len, int usehq);
|
||||
int strwrite (struct xstream *xp, streamchar *data, int *len, int usehq);
|
||||
int strread (struct xstream *xp, streamchar *data, int len, int usehq);
|
||||
#ifdef CONFIG_DEBUG_STREAMS
|
||||
#define strwrite(a,b,c,d) deb_strwrite(__FILE__,__LINE__,(a),(b),(c),(d))
|
||||
int deb_strwrite (const char *deb_file,unsigned int deb_line, struct xstream *xp, streamchar *data, int len, int usehq);
|
||||
#define strwritev(a,b,c,d) deb_strwritev(__FILE__,__LINE__,(a),(b),(c),(d))
|
||||
int deb_strwritev (const char *deb_file,unsigned int deb_line, struct xstream *xp, struct iovec *iov, int iovlen, int usehq);
|
||||
#else
|
||||
int strwrite (struct xstream *xp, streamchar *data, int len, int usehq);
|
||||
int strwritev (struct xstream *xp, struct iovec *iov, int iovlen, int usehq);
|
||||
#endif
|
||||
int strioctl (struct xstream *xp, long cmd, long arg);
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
|
|
@ -12,4 +12,6 @@
|
|||
#define VANJ_PPP CHAR2('p','p') /* turn on PPP mode */
|
||||
#define VANJ_NORM CHAR2('n','p') /* turn off PPP mode */
|
||||
|
||||
#define VANJ_SIZES CHAR2('s','b') /* length of TX and TX queues */
|
||||
|
||||
#endif /* __VAN_J */
|
||||
|
|
|
@ -1,63 +1,6 @@
|
|||
SHELL = /bin/sh
|
||||
MAKE = make
|
||||
## =()<P = @<P>@>()=
|
||||
P =
|
||||
KERNEL=1
|
||||
SUBDIRS=tools
|
||||
|
||||
## =()<CCU = @<CCU>@>()=
|
||||
CCU = gcc
|
||||
## =()<CC = @<CC>@>()=
|
||||
CC = gcc
|
||||
## =()<DEFS = @<DEFKERNEL>@ @<KERNEL>@ -I../include >()=
|
||||
DEFS = -I../streams -I../compat -I/usr/src/linux/include -fomit-frame-pointer -DKERNEL -D__KERNEL__ -DMODULE -DCONFIG_MODVERSIONS -I../include
|
||||
## =()<CFLAGS = @<CFLAGS>@ $(DEFS)>()=
|
||||
CFLAGS = -O2 -Wall $(DEFS)
|
||||
## =()<DEFSN = @<DEFS>@ -I../include >()=
|
||||
DEFSN = -I../streams -I../compat -I/usr/src/linux/include -I/usr/include/bsd -I../include
|
||||
## =()<CFLAGSN = @<CFLAGS>@ $(DEFSN)>()=
|
||||
CFLAGSN = -O2 -Wall $(DEFSN)
|
||||
## =()<LIBS = @<LIBS>@>()=
|
||||
LIBS = -lbsd
|
||||
## =()<LDFLAGS = @<LDFLAGS>@>()=
|
||||
LDFLAGS = -v
|
||||
|
||||
## =()<SYS = @<SYS>@>()=
|
||||
SYS = linux
|
||||
|
||||
SOURCES = ip_mon.c monitor.c
|
||||
|
||||
OBJ = ip_mon.o monitor.o
|
||||
ALL = monitor
|
||||
|
||||
all: ip_mon.o
|
||||
prog: monitor
|
||||
|
||||
monitor: monitor.o
|
||||
$(CCU) $(LDFLAGS) -o monitor monitor.o $(LIBS)
|
||||
monitor.o: monitor.c
|
||||
$(CCU) $(CFLAGSN) -c monitor.c
|
||||
|
||||
lib:
|
||||
|
||||
install: all
|
||||
@sh ../iftrue.sh "-d $(SYS)" "cd $(SYS); make"
|
||||
|
||||
update: all
|
||||
@sh ../iftrue.sh "-d $(SYS)" "cd $(SYS); make update"
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(ALL) monitor.old
|
||||
@sh ../iftrue.sh "-d $(SYS)" "cd $(SYS); make clean"
|
||||
|
||||
indent:
|
||||
../indent.sh $(SOURCES)
|
||||
|
||||
depend: Makefile $(SOURCES)
|
||||
$(CC) -M $(DEFS) $(SOURCES) > .depend
|
||||
|
||||
load:
|
||||
insmod ip_mon.o
|
||||
|
||||
ifeq (.depend,$(wildcard .depend))
|
||||
include .depend
|
||||
endif
|
||||
TOPDIR=..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ struct streamtab ip_mon2info =
|
|||
{&ip_mon_rinit, &ip_mon_winit, NULL, NULL};
|
||||
|
||||
#define NIP_MON 8
|
||||
#define NIP_INFO 40
|
||||
#define NIP_INFO 50
|
||||
|
||||
struct _ip_mon {
|
||||
queue_t *qptr;
|
||||
|
@ -348,7 +348,7 @@ static mblk_t *count_packet (struct _ip_mon *ipmon, mblk_t *mp, char doswap)
|
|||
return mp; /* oh well -- don't count it */
|
||||
}
|
||||
ms = splstr();
|
||||
ipp = (struct ip *) (mq->b_rptr+ipmon->encap ? 2 : 0);
|
||||
ipp = (struct ip *) (mq->b_rptr+(ipmon->encap ? 2 : 0));
|
||||
|
||||
switch (ipp->ip_p) {
|
||||
default:
|
||||
|
@ -361,7 +361,7 @@ static mblk_t *count_packet (struct _ip_mon *ipmon, mblk_t *mp, char doswap)
|
|||
struct tcphdr *tcp;
|
||||
|
||||
mq = mp;
|
||||
ipp = (struct ip *) (mq->b_rptr+ipmon->encap ? 2 : 0);
|
||||
ipp = (struct ip *) (mq->b_rptr+(ipmon->encap ? 2 : 0));
|
||||
tcp = (struct tcphdr *) (((char *)ipp) + (ipp->ip_hl << 2));
|
||||
localp = tcp->th_sport;
|
||||
remotep = tcp->th_dport;
|
||||
|
@ -375,7 +375,7 @@ static mblk_t *count_packet (struct _ip_mon *ipmon, mblk_t *mp, char doswap)
|
|||
struct udphdr *udp;
|
||||
|
||||
mq = mp;
|
||||
ipp = (struct ip *) (mq->b_rptr+ipmon->encap ? 2 : 0);
|
||||
ipp = (struct ip *) (mq->b_rptr+(ipmon->encap ? 2 : 0));
|
||||
udp = (struct udphdr *) (((char *)ipp) + (ipp->ip_hl << 2));
|
||||
localp = udp->uh_sport;
|
||||
remotep = udp->uh_dport;
|
||||
|
@ -388,7 +388,7 @@ static mblk_t *count_packet (struct _ip_mon *ipmon, mblk_t *mp, char doswap)
|
|||
struct icmp *icm;
|
||||
|
||||
mq = mp;
|
||||
ipp = (struct ip *) (mq->b_rptr+ipmon->encap ? 2 : 0);
|
||||
ipp = (struct ip *) (mq->b_rptr+(ipmon->encap ? 2 : 0));
|
||||
icm = (struct icmp *) (((char *)ipp) + (ipp->ip_hl << 2));
|
||||
if(doswap) {
|
||||
localp = htons(icm->icmp_code);
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
PROGRAMS = monitor
|
||||
EXTRA_INCLUDES=-I..
|
||||
|
||||
TOPDIR=../..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
|
@ -16,10 +16,12 @@
|
|||
#include "ip_mon.h"
|
||||
#include <sys/stropts.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef linux
|
||||
#include <linux/fs.h>
|
||||
#endif
|
||||
#include <sys/uio.h>
|
||||
|
||||
#if 0
|
||||
#define FD_SETSIZE (sizeof(fd_set) * 8)
|
||||
|
@ -76,6 +78,9 @@ set_inval (unsigned long inv)
|
|||
next_inval = 0;
|
||||
}
|
||||
|
||||
int tostr (char *bf, struct _monitor *mon);
|
||||
int tomon (char *bf, struct _monitor *mon);
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int c;
|
||||
|
@ -145,7 +150,7 @@ int main (int argc, char *argv[])
|
|||
|
||||
openlog (progname, LOG_PID, LOG_USER);
|
||||
if(logtime)
|
||||
printf("*%ld\n",lastpri = time(NULL));
|
||||
printf("*%d\n",lastpri = time(NULL));
|
||||
#ifdef linux
|
||||
{
|
||||
FILE * fd;
|
||||
|
@ -174,8 +179,6 @@ int main (int argc, char *argv[])
|
|||
if(monitordev == 0)
|
||||
syslog(LOG_CRIT, "No IP monitor driver found!");
|
||||
else {
|
||||
int i;
|
||||
|
||||
unlink(IP_MON_NAME);
|
||||
mknod (IP_MON_NAME, S_IFCHR | S_IRUSR | S_IWUSR, MKDEV(monitordev,0));
|
||||
syslog(LOG_DEBUG,"ISDN: monitor: major number %d\n",monitordev);
|
||||
|
@ -266,7 +269,7 @@ int main (int argc, char *argv[])
|
|||
int
|
||||
tomon (char *bf, struct _monitor *mon)
|
||||
{
|
||||
struct sockaddr_in server;
|
||||
/* struct sockaddr_in server; */
|
||||
struct hostent *hp, *gethostbyname ();
|
||||
|
||||
char a[256], b[256];
|
||||
|
@ -305,11 +308,12 @@ void alju(int nix) { longjmp(jp,1); }
|
|||
int
|
||||
tostr (char *bf, struct _monitor *mon)
|
||||
{
|
||||
struct sockaddr_in server;
|
||||
struct hostent *hp;
|
||||
struct protoent *proto;
|
||||
struct servent *serv1, *serv2;
|
||||
char a[256], b[256];
|
||||
static char *bfx;
|
||||
bfx = bf; /* to prevent longjmp clobber */
|
||||
|
||||
if (mon->sofar_p == 0 && mon->sofar_b == 0)
|
||||
return -1;
|
||||
|
@ -346,10 +350,10 @@ tostr (char *bf, struct _monitor *mon)
|
|||
alarm(0);
|
||||
if(logtime) {
|
||||
unsigned long thispri = time(NULL);
|
||||
bf += sprintf(bf,"%d:",thispri-lastpri);
|
||||
bfx += sprintf(bfx,"%ld:",thispri-lastpri);
|
||||
lastpri=thispri;
|
||||
}
|
||||
bf += sprintf (bf, "%s %s %d %d ", a, b, mon->sofar_p, mon->sofar_b);
|
||||
bfx += sprintf (bfx, "%s %s %d %ld ", a, b, mon->sofar_p, mon->sofar_b);
|
||||
if(!notprotocol && (proto = getprotobynumber(mon->p_protocol)) != NULL) {
|
||||
if((serv1 = getservbyport((mon->p_local), proto->p_name)) != NULL)
|
||||
strcpy(a, serv1->s_name);
|
||||
|
@ -359,9 +363,9 @@ tostr (char *bf, struct _monitor *mon)
|
|||
strcpy(b, serv2->s_name);
|
||||
else
|
||||
sprintf(b,"_%u",ntohs(mon->p_remote));
|
||||
bf += sprintf (bf, "%s %s %s",proto->p_name,a,b);
|
||||
bfx += sprintf (bfx, "%s %s %s",proto->p_name,a,b);
|
||||
} else {
|
||||
bf += sprintf (bf, "_%d _%u _%u", mon->p_protocol, ntohs(mon->p_local), ntohs(mon->p_remote));
|
||||
bfx += sprintf (bfx, "_%d _%u _%u", mon->p_protocol, ntohs(mon->p_local), ntohs(mon->p_remote));
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -1,48 +1,5 @@
|
|||
SHELL = /bin/sh
|
||||
MAKE = make
|
||||
## =()<P = @<P>@>()=
|
||||
P =
|
||||
KERNEL=1
|
||||
|
||||
## =()<CC = @<CC>@>()=
|
||||
CC = gcc
|
||||
## =()<DEFS = @<DEFKERNEL>@ @<KERNEL>@ -I../include >()=
|
||||
DEFS = -I../streams -I../compat -I/usr/src/linux/include -fomit-frame-pointer -DKERNEL -D__KERNEL__ -DMODULE -DCONFIG_MODVERSIONS -I../include
|
||||
## =()<CFLAGS = @<CFLAGS>@ $(DEFS)>()=
|
||||
CFLAGS = -O2 -Wall $(DEFS)
|
||||
## =()<RANLIB = @<RANLIB>@>()=
|
||||
RANLIB = ranlib
|
||||
|
||||
## =()<SYS = @<SYS>@>()=
|
||||
SYS = linux
|
||||
|
||||
SOURCES = isdn_2.c
|
||||
|
||||
OBJ = isdn_2.o
|
||||
ALL = ../isdn_2.a
|
||||
|
||||
all: $(OBJ) $(ALL)
|
||||
|
||||
install: all
|
||||
@sh ../iftrue.sh "-d $(SYS)" "cd $(SYS); make"
|
||||
|
||||
../isdn_2.a: $(OBJ)
|
||||
ar r ../isdn_2.a $(OBJ)
|
||||
@$(RANLIB) ../isdn_2.a
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(ALL)
|
||||
@sh ../iftrue.sh "-d $(SYS)" "cd $(SYS); make clean"
|
||||
|
||||
indent:
|
||||
../indent.sh $(SOURCES)
|
||||
|
||||
depend: Makefile $(SOURCES)
|
||||
$(CC) -M $(DEFS) $(SOURCES) > .depend
|
||||
|
||||
load:
|
||||
insmod isdn_2.o
|
||||
|
||||
ifeq (.depend,$(wildcard .depend))
|
||||
include .depend
|
||||
endif
|
||||
TOPDIR=..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
||||
|
|
360
isdn_2/isdn_2.c
360
isdn_2/isdn_2.c
File diff suppressed because it is too large
Load Diff
|
@ -1,51 +1,19 @@
|
|||
SHELL = /bin/sh
|
||||
MAKE = make
|
||||
## =()<P = @<P>@>()=
|
||||
P =
|
||||
TOPDIR=..
|
||||
include $(TOPDIR)/Make.config
|
||||
|
||||
## =()<CC = @<CCU>@>()=
|
||||
CC = gcc
|
||||
|
||||
## Change this to @<CFLAGS>@ @<DEFKERNEL>@ @<KERNEL>@ -I../include
|
||||
#### if you want to move isdn_3 into the kernel
|
||||
#### Also swap the commented lines for all: and lib:
|
||||
|
||||
## =()<DEFS = @<DEFS>@ -I../include >()=
|
||||
DEFS = -I../streams -I../compat -I/usr/src/linux/include -I/usr/include/bsd -I../include
|
||||
## =()<CFLAGS = @<CFLAGS>@ $(DEFS)>()=
|
||||
CFLAGS = -O2 -Wall $(DEFS)
|
||||
|
||||
## =()<RANLIB = @<RANLIB>@>()=
|
||||
RANLIB = ranlib
|
||||
|
||||
HEADERS = phone.h capi.h prot_1TR6_0.h prot_1TR6_1.h tei.h fixed.h
|
||||
|
||||
SOURCES = isdn_3.c tei.c fixed.c capi.c phone.c prot_1TR6_0.c prot_1TR6_1.c prot_1TR6_common.c prot_ETS.c
|
||||
|
||||
OBJ = isdn_3.o tei.o fixed.o capi.o phone.o prot_1TR6_0.o prot_1TR6_1.o prot_1TR6_common.o prot_ETS.o
|
||||
|
||||
ALL = ../isdn_3.a
|
||||
|
||||
all prog: $(OBJ) $(ALL)
|
||||
|
||||
../isdn_3.a: $(OBJ)
|
||||
ar r ../isdn_3.a $?
|
||||
@ $(RANLIB) ../isdn_3.a
|
||||
|
||||
indent:
|
||||
../indent.sh $(HEADERS) $(SOURCES)
|
||||
|
||||
install update: all
|
||||
|
||||
clean:
|
||||
rm -f $(ALL) $(OBJ)
|
||||
|
||||
depend: Makefile $(SOURCES)
|
||||
$(CC) -M $(DEFS) $(SOURCES) > .depend
|
||||
|
||||
load:
|
||||
|
||||
ifeq (.depend,$(wildcard .depend))
|
||||
include .depend
|
||||
PSOURCES := isdn_3.c $(addsuffix .c,$(PROTOCOLS))
|
||||
ifneq ($(strip $(filter phone, $(PROTOCOLS))),)
|
||||
ifneq ($(strip $(filter euro, $(SUBPROTOCOLS))),)
|
||||
PSOURCES += prot_ETS.c
|
||||
endif
|
||||
ifneq ($(strip $(filter german, $(SUBPROTOCOLS))),)
|
||||
PSOURCES += prot_1TR6_1.c
|
||||
PSOURCES += prot_1TR6_common.c
|
||||
endif
|
||||
endif
|
||||
|
||||
EXTRA_CFLAGS=$(addsuffix _,$(addprefix -D_,$(PROTOCOLS) $(SUBPROTOCOLS)))
|
||||
|
||||
LIB = ../isdn_3.a
|
||||
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
|
1449
isdn_3/capi.c
1449
isdn_3/capi.c
File diff suppressed because it is too large
Load Diff
|
@ -9,8 +9,8 @@
|
|||
#include <sys/errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/param.h>
|
||||
#include "sapi.h"
|
||||
|
||||
#define SAPI_FIXED 64
|
||||
#define ST_up 01
|
||||
|
||||
static int
|
||||
|
@ -102,7 +102,7 @@ fixed_sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
{
|
||||
if (data == NULL) {
|
||||
printf("DataInvalA ");
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
while ((err = m_getsx (data, &typ)) == 0) {
|
||||
switch (typ) {
|
||||
|
@ -124,9 +124,9 @@ fixed_sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
case 0:
|
||||
case 2:
|
||||
if (conn->minor == 0)
|
||||
return ENOENT;
|
||||
return -ENOENT;
|
||||
if (conn->mode == 0)
|
||||
err = ENOEXEC;
|
||||
err = -ENOEXEC;
|
||||
conn->state++;
|
||||
{
|
||||
int err = 0;
|
||||
|
@ -135,7 +135,7 @@ fixed_sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
|
||||
if (mb == NULL) {
|
||||
conn->state = 0;
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
m_putid (mb, IND_CONN);
|
||||
conn_info (conn, mb);
|
||||
|
@ -150,7 +150,7 @@ fixed_sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
return EBUSY;
|
||||
return -EBUSY;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -179,7 +179,7 @@ fixed_sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
err = EINVAL;
|
||||
err = -EINVAL;
|
||||
break;
|
||||
}
|
||||
if (data != NULL && err == 0)
|
||||
|
@ -220,5 +220,6 @@ struct _isdn3_hndl FIXED_hndl =
|
|||
{
|
||||
NULL, SAPI_FIXED,1,
|
||||
NULL, &fixed_newcard, NULL, &fixed_chstate, NULL, NULL,
|
||||
NULL, &fixed_sendcmd, NULL, &fixed_killconn, NULL,
|
||||
NULL, &fixed_sendcmd, NULL, &fixed_killconn, NULL, NULL,
|
||||
};
|
||||
|
||||
|
|
1077
isdn_3/isdn_3.c
1077
isdn_3/isdn_3.c
File diff suppressed because it is too large
Load Diff
|
@ -13,48 +13,10 @@
|
|||
#include "prot_1TR6_0.h"
|
||||
#include "prot_1TR6_1.h"
|
||||
#include "prot_ETS.h"
|
||||
#include "sapi.h"
|
||||
|
||||
int
|
||||
phone_get_vector (isdn3_conn conn, uchar_t * data, int len, int vnr, uchar_t dict, uchar_t key)
|
||||
{
|
||||
int qd_len;
|
||||
uchar_t *qd_data;
|
||||
int *vec;
|
||||
|
||||
qd_data = qd_find (data, len, dict,key, &qd_len);
|
||||
if (qd_data == NULL)
|
||||
return 0;
|
||||
if (qd_len < 1)
|
||||
return 0;
|
||||
if(conn->v[vnr] != NULL)
|
||||
free(conn->v[vnr]);
|
||||
conn->v[vnr] = vec = malloc(sizeof(int)+qd_len);
|
||||
if (vec == NULL)
|
||||
return 0;
|
||||
*vec++ = qd_len;
|
||||
memcpy(vec,qd_data,qd_len);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
phone_put_vector (isdn3_conn conn, uchar_t * data, int len, int vnr, uchar_t dict, uchar_t key)
|
||||
{
|
||||
int qd_len;
|
||||
uchar_t *qd_data;
|
||||
int *vec;
|
||||
|
||||
vec = conn->v[vnr];
|
||||
if(vec == NULL)
|
||||
return 0;
|
||||
qd_len = *vec++;
|
||||
if (qd_len < 1)
|
||||
return 0;
|
||||
qd_data = qd_insert (data, &len, dict,key, qd_len, 0);
|
||||
if (qd_data == NULL)
|
||||
return 0;
|
||||
memcpy(qd_data,vec,qd_len);
|
||||
return 1;
|
||||
}
|
||||
static isdn3_prot isdn3_findprot (mblk_t *info, uchar_t protocol);
|
||||
|
||||
int
|
||||
phone_sendback (isdn3_conn conn, uchar_t msgtype, mblk_t * data)
|
||||
|
@ -74,14 +36,14 @@ phone_sendback (isdn3_conn conn, uchar_t msgtype, mblk_t * data)
|
|||
creflen++;
|
||||
} while (cref != 0);
|
||||
if ((mb = allocb (creflen + 3, BPRI_MED)) == NULL)
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
if (data != NULL)
|
||||
linkb (mb, data);
|
||||
|
||||
*mb->b_wptr++ = conn->subprotocol;
|
||||
*mb->b_wptr++ = creflen;
|
||||
|
||||
if (conn->subprotocol == PD_Q931) {
|
||||
if (conn->subprotocol == SAPI_PHONE_DSS1) {
|
||||
if(conn->card == NULL || conn->card->bchans <= 2) {
|
||||
if (creflen < 1)
|
||||
creflen = 1;
|
||||
|
@ -266,7 +228,7 @@ send (isdn3_conn conn, mblk_t * data)
|
|||
return (*prot->send) (conn, data);
|
||||
else {
|
||||
isdn3_killconn (conn, 1);
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -281,7 +243,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
printf("\n !*!*! ProtNull / %ld::%s !*!*!\n",conn->subprotocol,
|
||||
conn->card->info ? (char *)conn->card->info->b_rptr : "none");
|
||||
isdn3_killconn (conn, 1);
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -375,8 +337,12 @@ init (void)
|
|||
isdn_prot = NULL;
|
||||
|
||||
if(0) isdn3_attach_prot (&prot_1TR6_0);
|
||||
#ifdef _german_
|
||||
isdn3_attach_prot (&prot_1TR6_1);
|
||||
#endif
|
||||
#ifdef _euro_
|
||||
isdn3_attach_prot (&prot_ETSI);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -388,7 +354,7 @@ isdn3_attach_prot (isdn3_prot prot)
|
|||
for (nprot = isdn_prot; nprot != NULL; nprot = nprot->next) {
|
||||
if (nprot->protocol == prot->protocol) {
|
||||
splx (ms);
|
||||
return EEXIST;
|
||||
return -EEXIST;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -401,7 +367,7 @@ isdn3_attach_prot (isdn3_prot prot)
|
|||
return 0;
|
||||
}
|
||||
|
||||
isdn3_prot
|
||||
static isdn3_prot
|
||||
isdn3_findprot (mblk_t *info, uchar_t protocol)
|
||||
{
|
||||
isdn3_prot prot;
|
||||
|
@ -446,5 +412,5 @@ struct _isdn3_hndl PHONE_hndl =
|
|||
{
|
||||
NULL, SAPI_PHONE,0,
|
||||
&init, &newcard, &modeflags, &chstate, &report, &recv, &send,
|
||||
&sendcmd, &ckill, &killconn, &hook,
|
||||
&sendcmd, &ckill, &killconn, &hook, NULL,
|
||||
};
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <sys/param.h>
|
||||
#include "prot_1TR6_0.h"
|
||||
#include "prot_1TR6_common.h"
|
||||
#include "sapi.h"
|
||||
|
||||
#define RUN_N0_T308 01
|
||||
#define RUN_N0_T3D1 02
|
||||
|
@ -83,7 +84,7 @@ recv (isdn3_conn conn, uchar_t msgtype, char isUI, uchar_t * data, ushort_t len)
|
|||
#if 0
|
||||
QD_INIT (data, len) {
|
||||
pr_setstate (conn, 0);
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
#endif
|
||||
switch (msgtype) {
|
||||
|
@ -221,6 +222,6 @@ killconn (isdn3_conn conn, char force)
|
|||
|
||||
struct _isdn3_prot prot_1TR6_0 =
|
||||
{
|
||||
NULL, PD_N0,
|
||||
NULL, SAPI_PHONE_1TR6_0,
|
||||
NULL, &chstate, NULL, &recv, NULL, &sendcmd, &killconn, NULL,
|
||||
};
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <sys/param.h>
|
||||
#include "prot_1TR6_1.h"
|
||||
#include "prot_1TR6_common.h"
|
||||
#include "sapi.h"
|
||||
|
||||
#undef HAS_SUSPEND
|
||||
|
||||
|
@ -323,11 +324,11 @@ report_n1_setup (isdn3_conn conn, uchar_t * data, int len)
|
|||
{
|
||||
int err = 0;
|
||||
|
||||
mblk_t *mb = allocb (128, BPRI_MED);
|
||||
mblk_t *mb = allocb (256, BPRI_MED);
|
||||
|
||||
if (mb == NULL) {
|
||||
pr_setstate (conn, 0);
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
m_putid (mb, IND_INCOMING);
|
||||
conn_info (conn, mb);
|
||||
|
@ -347,11 +348,11 @@ report_n1_setup_ack (isdn3_conn conn, uchar_t * data, int len)
|
|||
{
|
||||
int err = 0;
|
||||
|
||||
mblk_t *mb = allocb (128, BPRI_MED);
|
||||
mblk_t *mb = allocb (256, BPRI_MED);
|
||||
|
||||
if (mb == NULL) {
|
||||
pr_setstate (conn, 0);
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
m_putid (mb, IND_INFO);
|
||||
m_putid (mb, ID_N1_SETUP_ACK);
|
||||
|
@ -372,11 +373,11 @@ report_n1_call_sent (isdn3_conn conn, uchar_t * data, int len)
|
|||
{
|
||||
int err = 0;
|
||||
|
||||
mblk_t *mb = allocb (128, BPRI_MED);
|
||||
mblk_t *mb = allocb (256, BPRI_MED);
|
||||
|
||||
if (mb == NULL) {
|
||||
pr_setstate (conn, 0);
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
m_putid (mb, IND_INFO);
|
||||
m_putid (mb, ID_N1_CALL_SENT);
|
||||
|
@ -397,11 +398,11 @@ report_n1_alert (isdn3_conn conn, uchar_t * data, int len)
|
|||
{
|
||||
int err = 0;
|
||||
|
||||
mblk_t *mb = allocb (128, BPRI_MED);
|
||||
mblk_t *mb = allocb (256, BPRI_MED);
|
||||
|
||||
if (mb == NULL) {
|
||||
pr_setstate (conn, 0);
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
m_putid (mb, IND_INFO);
|
||||
m_putid (mb, ID_N1_ALERT);
|
||||
|
@ -426,11 +427,11 @@ report_n1_user_info (isdn3_conn conn, uchar_t * data, int len)
|
|||
int qd_len;
|
||||
uchar_t *qd_data;
|
||||
|
||||
mblk_t *mb = allocb (128, BPRI_MED);
|
||||
mblk_t *mb = allocb (256, BPRI_MED);
|
||||
|
||||
if (mb == NULL) {
|
||||
pr_setstate (conn, 0);
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
m_putid (mb, IND_INFO);
|
||||
m_putid (mb, ID_N1_ALERT);
|
||||
|
@ -459,11 +460,11 @@ report_n1_conn (isdn3_conn conn, uchar_t * data, int len)
|
|||
{
|
||||
int err = 0;
|
||||
|
||||
mblk_t *mb = allocb (128, BPRI_MED);
|
||||
mblk_t *mb = allocb (256, BPRI_MED);
|
||||
|
||||
if (mb == NULL) {
|
||||
pr_setstate (conn, 0);
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
m_putid (mb, IND_CONN);
|
||||
conn_info (conn, mb);
|
||||
|
@ -485,11 +486,11 @@ report_n1_conn_ack (isdn3_conn conn, uchar_t * data, int len)
|
|||
{
|
||||
int err = 0;
|
||||
|
||||
mblk_t *mb = allocb (128, BPRI_MED);
|
||||
mblk_t *mb = allocb (256, BPRI_MED);
|
||||
|
||||
if (mb == NULL) {
|
||||
pr_setstate (conn, 0);
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
m_putid (mb, IND_INFO);
|
||||
m_putid (mb, ID_N1_CONN_ACK);
|
||||
|
@ -512,11 +513,11 @@ report_n1_info (isdn3_conn conn, uchar_t * data, int len)
|
|||
{
|
||||
int err = 0;
|
||||
|
||||
mblk_t *mb = allocb (128, BPRI_MED);
|
||||
mblk_t *mb = allocb (256, BPRI_MED);
|
||||
|
||||
if (mb == NULL) {
|
||||
pr_setstate (conn, 0);
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
m_putid (mb, IND_INFO);
|
||||
m_putid (mb, ID_N1_INFO);
|
||||
|
@ -540,11 +541,11 @@ report_n1_stat (isdn3_conn conn, uchar_t * data, int len)
|
|||
int err = 0;
|
||||
char cval;
|
||||
|
||||
mblk_t *mb = allocb (128, BPRI_MED);
|
||||
mblk_t *mb = allocb (256, BPRI_MED);
|
||||
|
||||
if (mb == NULL) {
|
||||
pr_setstate (conn, 0);
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
m_putid (mb, IND_INFO);
|
||||
m_putid (mb, ID_N1_STAT);
|
||||
|
@ -589,7 +590,7 @@ report_n1_terminate (isdn3_conn conn, uchar_t * data, int len)
|
|||
{
|
||||
int err = 0;
|
||||
|
||||
mblk_t *mb = allocb (128, BPRI_MED);
|
||||
mblk_t *mb = allocb (256, BPRI_MED);
|
||||
|
||||
if (mb == NULL) {
|
||||
pr_setstate (conn, 0);
|
||||
|
@ -1904,7 +1905,7 @@ send_N1_disc (isdn3_conn conn, char release, mblk_t * data)
|
|||
if (release) {
|
||||
goto common_off_noconn;
|
||||
} else
|
||||
return EBUSY;
|
||||
return -EBUSY;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
|
@ -1957,7 +1958,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
if (data == NULL) {
|
||||
printf("DataNull: ");
|
||||
conn->lockit--;
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
while ((err = m_getsx (data, &typ)) == 0) {
|
||||
switch (typ) {
|
||||
|
@ -1981,7 +1982,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
data->b_rptr = oldpos;
|
||||
printf("GetX EAZ: ");
|
||||
conn->lockit--;
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
((struct t_info *)conn->p_data)->eaz = data->b_rptr[1];
|
||||
} break;
|
||||
|
@ -2000,7 +2001,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
if (service == ~0) {
|
||||
printf("No Service: ");
|
||||
conn->lockit--;
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
conn->minorstate |= MS_OUTGOING | MS_WANTCONN;
|
||||
|
@ -2020,24 +2021,24 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
if (conn->minor == 0) {
|
||||
printf("ConnMinorZero: ");
|
||||
conn->lockit--;
|
||||
return ENOENT;
|
||||
return -ENOENT;
|
||||
}
|
||||
if (conn->mode == 0)
|
||||
err = ENOEXEC;
|
||||
err = -ENOEXEC;
|
||||
{
|
||||
mblk_t *asn = allocb (128, BPRI_MED);
|
||||
mblk_t *asn = allocb (256, BPRI_MED);
|
||||
int qd_len = 0;
|
||||
uchar_t *qd_d;
|
||||
|
||||
if (asn == NULL) {
|
||||
conn->lockit--;
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (suppress) {
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 0, PT_N0_netSpecFac, 4, 1)) == NULL) {
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
*(uchar_t *) qd_d++ = 0;
|
||||
*(uchar_t *) qd_d++ = N1_FAC_Unterdruecke;
|
||||
|
@ -2046,14 +2047,14 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
if (svc) {
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 0, PT_N0_netSpecFac, 4, 1)) == NULL) {
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
*(uchar_t *) qd_d++ = 0;
|
||||
*(uchar_t *) qd_d++ = N1_FAC_SVC;
|
||||
*(ushort_t *) qd_d = 0;
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 0, PT_N0_netSpecFac, 4, 1)) == NULL) {
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
*(uchar_t *) qd_d++ = 0;
|
||||
*(uchar_t *) qd_d++ = N1_FAC_Activate;
|
||||
|
@ -2061,14 +2062,14 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
}
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 6, PT_N6_serviceInd, 2, 0)) == NULL) {
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
*((uchar_t *) qd_d) = service >> 8;
|
||||
*(((uchar_t *) qd_d)+1) = service & 0xFF;
|
||||
if (((struct t_info *)conn->p_data)->eaz != 0) {
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 0, PT_N0_origAddr, 2, 0)) == NULL) {
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
*qd_d++ = 0x81;
|
||||
*qd_d++ = ((struct t_info *)conn->p_data)->eaz;
|
||||
|
@ -2081,7 +2082,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
break;
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 0, PT_N0_destAddr, i + 1, 0)) == NULL) {
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
*qd_d++ = 0x81;
|
||||
while (i--)
|
||||
|
@ -2090,7 +2091,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
if (conn->bchan != 0) {
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 0, PT_N0_chanID, (conn->bchan <= 2) ? 1 : 3, 0)) == NULL) {
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
if (conn->bchan <= 2) {
|
||||
*qd_d = 0x80 | conn->bchan;
|
||||
|
@ -2116,7 +2117,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
default:
|
||||
printf("Default %d: ", conn->state);
|
||||
conn->lockit--;
|
||||
return EBUSY;
|
||||
return -EBUSY;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -2146,7 +2147,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
} break;
|
||||
default:
|
||||
printf("BadState1: ");
|
||||
err = EINVAL;
|
||||
err = -EINVAL;
|
||||
}
|
||||
break;
|
||||
case CMD_ANSWER:
|
||||
|
@ -2169,7 +2170,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
data->b_rptr = oldpos;
|
||||
printf("GetEAZAns ");
|
||||
conn->lockit--;
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
((struct t_info *)conn->p_data)->eaz = data->b_rptr[1];
|
||||
} break;
|
||||
|
@ -2181,14 +2182,14 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
|
||||
if ((asn = allocb (32, BPRI_MED)) == NULL) {
|
||||
conn->lockit--;
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (((struct t_info *)conn->p_data)->flags & SVC_PENDING) {
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 0, PT_N0_netSpecFac, 4, 1)) == NULL) {
|
||||
freeb(asn);
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
*(uchar_t *) qd_d++ = 0;
|
||||
*(uchar_t *) qd_d++ = N1_FAC_SVC;
|
||||
|
@ -2196,7 +2197,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 0, PT_N0_netSpecFac, 4, 1)) == NULL) {
|
||||
freeb(asn);
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
*(uchar_t *) qd_d++ = 0;
|
||||
*(uchar_t *) qd_d++ = N1_FAC_Activate;
|
||||
|
@ -2206,14 +2207,14 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 6, PT_N6_serviceInd, 2, 0)) == NULL) {
|
||||
freeb (asn);
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
*((uchar_t *) qd_d) = service >> 8;
|
||||
*(((uchar_t *) qd_d)+1) = service & 0xFF;
|
||||
if (((struct t_info *)conn->p_data)->eaz != 0) {
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 0, PT_N0_origAddr, 2, 0)) == NULL) {
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
*qd_d++ = 0x81;
|
||||
*qd_d++ = ((struct t_info *)conn->p_data)->eaz;
|
||||
|
@ -2246,7 +2247,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
break;
|
||||
default:
|
||||
printf("BadState2 ");
|
||||
err = EINVAL;
|
||||
err = -EINVAL;
|
||||
break;
|
||||
}
|
||||
if (asn != NULL)
|
||||
|
@ -2267,7 +2268,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
|
||||
if (data == NULL) {
|
||||
conn->lockit--;
|
||||
return ENOENT;
|
||||
return -ENOENT;
|
||||
}
|
||||
while (m_getsx (data, &typ) == 0) {
|
||||
switch (typ) {
|
||||
|
@ -2297,7 +2298,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
data->b_rptr = oldpos;
|
||||
printf("EAZ3 ");
|
||||
conn->lockit--;
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
eaz = data->b_rptr[1];
|
||||
eaz2= data->b_rptr[0];
|
||||
|
@ -2319,7 +2320,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
if ((conn->minorstate & MS_CONN_MASK) == MS_CONN_NONE) {
|
||||
printf("NoConnThere ");
|
||||
conn->lockit--;
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
if ((conn->minorstate & MS_CONN_MASK) != MS_CONN_INTERRUPT) {
|
||||
isdn3_setup_conn (conn, EST_WILL_INTERRUPT);
|
||||
|
@ -2333,13 +2334,13 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
|
||||
if ((asn = allocb (32, BPRI_MED)) == NULL) {
|
||||
conn->lockit--;
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 0, PT_N0_netSpecFac, (gotservice || eaz2 != 0) ? ((eaz != 0 || eaz2 != 0) ? 6 : 4) : (eaz != 0) ? 5 : 4, 0)) == NULL) {
|
||||
freeb (asn);
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
qd_d[0] = 0;
|
||||
qd_d[1] = (eaz2 > 0) ? N1_FAC_Dienstwechsel2 : N1_FAC_Dienstwechsel1;
|
||||
|
@ -2377,7 +2378,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
break;
|
||||
default:
|
||||
printf("BadState4 ");
|
||||
err = EINVAL;
|
||||
err = -EINVAL;
|
||||
break;
|
||||
}
|
||||
if (asn != NULL)
|
||||
|
@ -2446,7 +2447,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
break;
|
||||
default:
|
||||
printf("UnknownCmd ");
|
||||
err = EINVAL;
|
||||
err = -EINVAL;
|
||||
break;
|
||||
}
|
||||
if (data != NULL && err == 0)
|
||||
|
@ -2515,6 +2516,6 @@ static void report (isdn3_conn conn, mblk_t *mb)
|
|||
|
||||
struct _isdn3_prot prot_1TR6_1 =
|
||||
{
|
||||
NULL, PD_N1,
|
||||
NULL, SAPI_PHONE_1TR6_1,
|
||||
NULL, &chstate, &report, &recv, NULL, &sendcmd, &killconn, NULL,
|
||||
};
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <sys/types.h>
|
||||
#include "q_data.h"
|
||||
#include "phone_ETSI.h"
|
||||
#include "sapi.h"
|
||||
|
||||
#undef HAS_SUSPEND
|
||||
|
||||
|
@ -306,10 +307,10 @@ Xpr_setstate (isdn3_conn conn, uchar_t state, int deb_line)
|
|||
timer (ET_T310, conn);
|
||||
break;
|
||||
case 6:
|
||||
timer (ET_TALERT, conn);
|
||||
ftimer (ET_TALERT, conn);
|
||||
/* FALL THRU */
|
||||
case 7:
|
||||
timer (ET_TCONN, conn);
|
||||
ftimer (ET_TCONN, conn);
|
||||
break;
|
||||
case 8:
|
||||
timer (ET_T313, conn);
|
||||
|
@ -445,7 +446,7 @@ printf("FooL" ##s " is %d,%d\n",nlen,ilen); \
|
|||
} \
|
||||
nlen -= ilen+2; \
|
||||
if((*qd_data & 0xFF) == (a)) { \
|
||||
int nlen = ilen; \
|
||||
int nlen __attribute__((unused)) = ilen; \
|
||||
qd_data += 2; \
|
||||
b; \
|
||||
} else { \
|
||||
|
@ -747,11 +748,11 @@ report_ET_setup (isdn3_conn conn, uchar_t * data, int len)
|
|||
{
|
||||
int err = 0;
|
||||
|
||||
mblk_t *mb = allocb (128, BPRI_MED);
|
||||
mblk_t *mb = allocb (256, BPRI_MED);
|
||||
|
||||
if (mb == NULL) {
|
||||
pr_setstate (conn, 0);
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
m_putid (mb, IND_INCOMING);
|
||||
conn_info (conn, mb);
|
||||
|
@ -772,11 +773,11 @@ report_ET_generic (isdn3_conn conn, uchar_t * data, int len, ushort_t id)
|
|||
{
|
||||
int err = 0;
|
||||
|
||||
mblk_t *mb = allocb (128, BPRI_MED);
|
||||
mblk_t *mb = allocb (256, BPRI_MED);
|
||||
|
||||
if (mb == NULL) {
|
||||
pr_setstate (conn, 0);
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
m_putid (mb, IND_INFO);
|
||||
m_putid (mb, id);
|
||||
|
@ -803,11 +804,11 @@ report_ET_user_info (isdn3_conn conn, uchar_t * data, int len)
|
|||
int qd_len;
|
||||
uchar_t *qd_data;
|
||||
|
||||
mblk_t *mb = allocb (128, BPRI_MED);
|
||||
mblk_t *mb = allocb (256, BPRI_MED);
|
||||
|
||||
if (mb == NULL) {
|
||||
pr_setstate (conn, 0);
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
m_putid (mb, IND_INFO);
|
||||
m_putid (mb, ID_ET_USER_INFO);
|
||||
|
@ -856,11 +857,11 @@ report_ET_conn (isdn3_conn conn, uchar_t * data, int len)
|
|||
{
|
||||
int err = 0;
|
||||
|
||||
mblk_t *mb = allocb (128, BPRI_MED);
|
||||
mblk_t *mb = allocb (256, BPRI_MED);
|
||||
|
||||
if (mb == NULL) {
|
||||
pr_setstate (conn, 0);
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
m_putid (mb, IND_CONN);
|
||||
conn_info (conn, mb);
|
||||
|
@ -884,11 +885,11 @@ report_ET_conn_ack (isdn3_conn conn, uchar_t * data, int len)
|
|||
{
|
||||
int err = 0;
|
||||
|
||||
mblk_t *mb = allocb (128, BPRI_MED);
|
||||
mblk_t *mb = allocb (256, BPRI_MED);
|
||||
|
||||
if (mb == NULL) {
|
||||
pr_setstate (conn, 0);
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
m_putid (mb, IND_INFO);
|
||||
m_putid (mb, ID_ET_CONN_ACK);
|
||||
|
@ -913,11 +914,11 @@ report_ET_stat (isdn3_conn conn, uchar_t * data, int len)
|
|||
int err = 0;
|
||||
char cval;
|
||||
|
||||
mblk_t *mb = allocb (128, BPRI_MED);
|
||||
mblk_t *mb = allocb (256, BPRI_MED);
|
||||
|
||||
if (mb == NULL) {
|
||||
pr_setstate (conn, 0);
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
m_putid (mb, IND_INFO);
|
||||
m_putid (mb, ID_ET_STAT);
|
||||
|
@ -961,7 +962,7 @@ Xreport_ET_terminate (isdn3_conn conn, uchar_t * data, int len, int deb_line)
|
|||
{
|
||||
int err = 0;
|
||||
|
||||
mblk_t *mb = allocb (128, BPRI_MED);
|
||||
mblk_t *mb = allocb (256, BPRI_MED);
|
||||
|
||||
printf("\nET Terminate at %d.\n",deb_line);
|
||||
if (mb == NULL) {
|
||||
|
@ -1056,7 +1057,7 @@ ET_T304 (isdn3_conn conn)
|
|||
data = NULL;
|
||||
} else {
|
||||
*qd_d++ = 0x80;
|
||||
*qd_d++ = 0x90; /* normal call clearing */
|
||||
*qd_d++ = 0x80 | ET_TimerRecovery;
|
||||
data->b_wptr += qd_len;
|
||||
}
|
||||
}
|
||||
|
@ -1089,8 +1090,25 @@ ET_T308 (isdn3_conn conn)
|
|||
conn->timerflags &= ~RUN_ET_T308;
|
||||
switch (conn->state) {
|
||||
case 19:
|
||||
/* DSS1: Retry! */
|
||||
{
|
||||
mblk_t *data;
|
||||
data = allocb(16,BPRI_MED);
|
||||
if(data != NULL) {
|
||||
unsigned char * qd_d;
|
||||
int qd_len = 0;
|
||||
if ((qd_d = qd_insert ((uchar_t *) data->b_rptr, &qd_len, 0, PT_E0_cause, 2, 0)) == NULL) {
|
||||
freemsg(data);
|
||||
} else {
|
||||
*qd_d++ = 0x80;
|
||||
*qd_d++ = 0x80 | ET_TimerRecovery;
|
||||
data->b_wptr += qd_len;
|
||||
if (phone_sendback (conn, MT_ET_DISC, data) < 0)
|
||||
freemsg(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
pr_setstate(conn,0);
|
||||
break;
|
||||
}
|
||||
et_checkterm (conn, NULL, 0);
|
||||
}
|
||||
|
@ -1124,7 +1142,7 @@ ET_T310 (isdn3_conn conn)
|
|||
data = NULL;
|
||||
} else {
|
||||
*qd_d++ = 0x80;
|
||||
*qd_d++ = 0x90; /* normal call clearing */
|
||||
*qd_d++ = 0x80 | ET_TimerRecovery;
|
||||
data->b_wptr += qd_len;
|
||||
}
|
||||
}
|
||||
|
@ -1155,7 +1173,7 @@ ET_T313 (isdn3_conn conn)
|
|||
data = NULL;
|
||||
} else {
|
||||
*qd_d++ = 0x80;
|
||||
*qd_d++ = 0x90; /* normal call clearing */
|
||||
*qd_d++ = 0x80 | ET_TimerRecovery;
|
||||
data->b_wptr += qd_len;
|
||||
}
|
||||
}
|
||||
|
@ -1350,7 +1368,7 @@ release_postET (isdn3_conn conn, uchar_t minor, char force)
|
|||
data = NULL;
|
||||
} else {
|
||||
*qd_d++ = 0x80;
|
||||
*qd_d++ = 0x90; /* normal call clearing */
|
||||
*qd_d++ = 0x80 | ET_TimerRecovery;
|
||||
data->b_wptr += qd_len;
|
||||
}
|
||||
}
|
||||
|
@ -1487,6 +1505,10 @@ printf (" ET: Recv %x in state %d\n", msgtype, conn->state);
|
|||
report_ET_generic (conn, data, len, ID_ET_INFO);
|
||||
break;
|
||||
|
||||
case MT_ET_FAC:
|
||||
report_ET_generic (conn, data, len, ID_ET_FAC);
|
||||
break;
|
||||
|
||||
case MT_ET_STAT:
|
||||
{
|
||||
int qd_len;
|
||||
|
@ -1509,7 +1531,8 @@ printf (" ET: Recv %x in state %d\n", msgtype, conn->state);
|
|||
goto do_continue;
|
||||
isdn3_setup_conn (conn, EST_DISCONNECT);
|
||||
report_ET_terminate (conn, data, len);
|
||||
if(conn->state == 6 || conn->state == 7)
|
||||
ComEx:
|
||||
if(conn->state == 6 || conn->state == 7 || conn->state == 99)
|
||||
pr_setstate (conn, 99);
|
||||
else
|
||||
pr_setstate (conn, 0);
|
||||
|
@ -1523,8 +1546,7 @@ printf (" ET: Recv %x in state %d\n", msgtype, conn->state);
|
|||
phone_sendback (conn, MT_ET_REL_COM, NULL);
|
||||
isdn3_setup_conn (conn, EST_DISCONNECT);
|
||||
report_ET_terminate (conn, data, len);
|
||||
pr_setstate (conn, 0);
|
||||
break;
|
||||
goto ComEx;
|
||||
case MT_ET_DISC:
|
||||
if (conn->state == 0 || conn->state == 1 || conn->state == 6
|
||||
|| conn->state == 11 || conn->state == 12
|
||||
|
@ -2113,7 +2135,7 @@ chstate (isdn3_conn conn, uchar_t ind, short add)
|
|||
data = NULL;
|
||||
} else {
|
||||
*qd_d++ = 0x80;
|
||||
*qd_d++ = 0x90; /* normal call clearing */
|
||||
*qd_d++ = 0x80 | ET_TempFailure;
|
||||
data->b_wptr += qd_len;
|
||||
}
|
||||
}
|
||||
|
@ -2136,7 +2158,7 @@ chstate (isdn3_conn conn, uchar_t ind, short add)
|
|||
data = NULL;
|
||||
} else {
|
||||
*qd_d++ = 0x80;
|
||||
*qd_d++ = 0x90; /* normal call clearing */
|
||||
*qd_d++ = 0x80 | ET_TempFailure;
|
||||
data->b_wptr += qd_len;
|
||||
}
|
||||
}
|
||||
|
@ -2178,7 +2200,7 @@ send_ET_disc (isdn3_conn conn, char release, mblk_t * data)
|
|||
#ifdef HAS_SUSPEND
|
||||
case 15:
|
||||
case 17:
|
||||
return EBUSY;
|
||||
return -EBUSY;
|
||||
#endif
|
||||
case 12:
|
||||
if (((err = phone_sendback (conn, MT_ET_REL, data)) != 0) && (data != NULL))
|
||||
|
@ -2189,7 +2211,7 @@ send_ET_disc (isdn3_conn conn, char release, mblk_t * data)
|
|||
if (release) {
|
||||
goto common_off_noconn; /* Is this confirming? */
|
||||
} else
|
||||
return EBUSY;
|
||||
return -EBUSY;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
|
@ -2209,7 +2231,7 @@ send_ET_disc (isdn3_conn conn, char release, mblk_t * data)
|
|||
freemsg(owndata);
|
||||
} else {
|
||||
*qd_d++ = 0x80;
|
||||
*qd_d++ = 0x90; /* normal call clearing */
|
||||
*qd_d++ = 0x80 | ET_NormalClear;
|
||||
data->b_wptr += qd_len;
|
||||
}
|
||||
}
|
||||
|
@ -2224,7 +2246,7 @@ send_ET_disc (isdn3_conn conn, char release, mblk_t * data)
|
|||
goto common_off; /* XXX experimental */
|
||||
if ((err = phone_sendback (conn, MT_ET_REL_COM, data)) != 0 && data != NULL)
|
||||
freemsg(data);
|
||||
pr_setstate (conn, 19);
|
||||
pr_setstate (conn, 99); /* was 19 -- mistake */
|
||||
break;
|
||||
case 19:
|
||||
case 99:
|
||||
|
@ -2311,7 +2333,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
data->b_rptr = oldpos;
|
||||
printf("GetX EAZ: ");
|
||||
conn->lockit--;
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
conn->eaz = *data->b_rptr++;
|
||||
} break;
|
||||
|
@ -2344,7 +2366,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
if (data == NULL) {
|
||||
printf("DataNull: ");
|
||||
conn->lockit--;
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
conn->minorstate |= MS_OUTGOING | MS_WANTCONN;
|
||||
|
@ -2363,38 +2385,38 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
if (conn->minor == 0) {
|
||||
printf("ConnMinorZero: ");
|
||||
conn->lockit--;
|
||||
return ENOENT;
|
||||
return -ENOENT;
|
||||
}
|
||||
if (conn->mode == 0)
|
||||
err = ENOEXEC;
|
||||
err = -ENOEXEC;
|
||||
{
|
||||
mblk_t *asn = allocb (128, BPRI_MED);
|
||||
mblk_t *asn = allocb (256, BPRI_MED);
|
||||
int qd_len = 0;
|
||||
uchar_t *qd_d;
|
||||
|
||||
if (asn == NULL) {
|
||||
conn->lockit--;
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (info->bearer_len > 0) {
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 0, PT_E0_bearer_cap, info->bearer_len, 0)) == NULL) {
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
bcopy(info->bearer,qd_d,info->bearer_len);
|
||||
}
|
||||
if (info->llc_len > 0) {
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 0, PT_E0_compatLo, info->llc_len, 0)) == NULL) {
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
bcopy(info->llc,qd_d,info->llc_len);
|
||||
}
|
||||
if (info->ulc_len > 0) {
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 0, PT_E0_compatLo, info->ulc_len, 0)) == NULL) {
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
bcopy(info->ulc,qd_d,info->ulc_len);
|
||||
}
|
||||
|
@ -2424,7 +2446,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
break;
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 0, PT_E0_destAddr, j - i + 1, 0)) == NULL) {
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
*qd_d++ = nrtype | 0x80;
|
||||
qd_d -= i; /* compensate for i-offset of the number */
|
||||
|
@ -2459,7 +2481,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
break;
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 0, PT_E0_origAddr, j - i + 1, 0)) == NULL) {
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
*qd_d++ = nrtype | 0x80;
|
||||
qd_d -= i; /* compensate for i-offset of the number */
|
||||
|
@ -2470,7 +2492,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
int basic = (conn->card ? conn->card->bchans <= 2 : 1);
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 0, PT_E0_chanID, basic ? 1 : 3, 0)) == NULL) {
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
if (basic) {
|
||||
*qd_d = 0x80 | conn->bchan;
|
||||
|
@ -2496,7 +2518,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
default:
|
||||
printf("Default %d: ", conn->state);
|
||||
conn->lockit--;
|
||||
return EBUSY;
|
||||
return -EBUSY;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -2530,7 +2552,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
break;
|
||||
default:
|
||||
printf("BadState1: ");
|
||||
err = EINVAL;
|
||||
err = -EINVAL;
|
||||
}
|
||||
break;
|
||||
case CMD_ANSWER:
|
||||
|
@ -2542,14 +2564,14 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
int qd_len = 0;
|
||||
uchar_t *qd_d;
|
||||
|
||||
if ((asn = allocb (128, BPRI_MED)) == NULL) {
|
||||
if ((asn = allocb (256, BPRI_MED)) == NULL) {
|
||||
conn->lockit--;
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
if (info->llc_len > 0) {
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 6, PT_E0_compatLo, info->llc_len, 0)) == NULL) {
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
bcopy(info->llc,qd_d,info->llc_len);
|
||||
}
|
||||
|
@ -2557,14 +2579,14 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
if (info->ulc_len > 0) {
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 6, PT_E0_compatLo, info->ulc_len, 0)) == NULL) {
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
bcopy(info->ulc,qd_d,info->ulc_len);
|
||||
}
|
||||
if (info->bearer_len > 0) {
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 6, PT_E0_bearer_cap, info->bearer_len, 0)) == NULL) {
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
bcopy(info->bearer,qd_d,info->bearer_len);
|
||||
}
|
||||
|
@ -2575,7 +2597,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
int basic = (conn->card ? conn->card->bchans <= 2 : 1);
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 0, PT_E0_chanID, basic ? 1 : 3, 0)) == NULL) {
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
if (basic) {
|
||||
*qd_d = 0x80 | conn->bchan;
|
||||
|
@ -2625,7 +2647,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
break;
|
||||
default:
|
||||
printf("BadState2 ");
|
||||
err = EINVAL;
|
||||
err = -EINVAL;
|
||||
break;
|
||||
}
|
||||
if (asn != NULL)
|
||||
|
@ -2647,7 +2669,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
|
||||
if (data == NULL) {
|
||||
conn->lockit--;
|
||||
return ENOENT;
|
||||
return -ENOENT;
|
||||
}
|
||||
while (m_getsx (data, &typ) == 0) {
|
||||
switch (typ) {
|
||||
|
@ -2676,7 +2698,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
data->b_rptr = oldpos;
|
||||
printf("EAZ3 ");
|
||||
conn->lockit--;
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
eaz = *data->b_rptr++;
|
||||
} break;
|
||||
|
@ -2686,7 +2708,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
data->b_rptr = oldpos;
|
||||
printf("EAZ4 ");
|
||||
conn->lockit--;
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
eaz2 = *data->b_rptr++;
|
||||
} break;
|
||||
|
@ -2707,7 +2729,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
if ((conn->minorstate & MS_CONN_MASK) == MS_CONN_NONE) {
|
||||
printf("NoConnThere ");
|
||||
conn->lockit--;
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
if ((conn->minorstate & MS_CONN_MASK) != MS_CONN_INTERRUPT) {
|
||||
isdn3_setup_conn (conn, EST_WILL_INTERRUPT);
|
||||
|
@ -2722,13 +2744,13 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
|
||||
if ((asn = allocb (32, BPRI_MED)) == NULL) {
|
||||
conn->lockit--;
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if ((qd_d = qd_insert ((uchar_t *) asn->b_rptr, &qd_len, 0, PT_N0_netSpecFac, (gotservice || eaz2 != 0) ? ((eaz != 0 || eaz2 != 0) ? 6 : 4) : (eaz != 0) ? 5 : 4, 0)) == NULL) {
|
||||
freeb (asn);
|
||||
conn->lockit--;
|
||||
return EIO;
|
||||
return -EIO;
|
||||
}
|
||||
qd_d[0] = 0;
|
||||
qd_d[1] = (eaz2 > 0) ? ET_FAC_Dienstwechsel2 : ET_FAC_Dienstwechsel1;
|
||||
|
@ -2767,7 +2789,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
break;
|
||||
default:
|
||||
printf("BadState4 ");
|
||||
err = EINVAL;
|
||||
err = -EINVAL;
|
||||
break;
|
||||
}
|
||||
if (asn != NULL)
|
||||
|
@ -2835,7 +2857,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
|||
break;
|
||||
default:
|
||||
printf("UnknownCmd ");
|
||||
err = EINVAL;
|
||||
err = -EINVAL;
|
||||
break;
|
||||
}
|
||||
if (data != NULL && err == 0)
|
||||
|
@ -2911,7 +2933,7 @@ static void report (isdn3_conn conn, mblk_t *mb)
|
|||
|
||||
struct _isdn3_prot prot_ETSI =
|
||||
{
|
||||
NULL, PD_Q931,
|
||||
NULL, SAPI_PHONE_DSS1,
|
||||
NULL, &chstate, &report, &recv, NULL, &sendcmd, &killconn, NULL,
|
||||
};
|
||||
|
||||
|
|
39
isdn_3/tei.c
39
isdn_3/tei.c
|
@ -8,8 +8,7 @@
|
|||
#include <sys/time.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#define SAPI_TEI 63
|
||||
#include "sapi.h"
|
||||
|
||||
#define TEI_IDREQ 1
|
||||
#define TEI_IDASS 2
|
||||
|
@ -19,10 +18,13 @@
|
|||
#define TEI_IDREMOVE 6
|
||||
#define TEI_IDVERIFY 7
|
||||
|
||||
#define NR talk_a
|
||||
#define TEI_id talk_b
|
||||
#if NITALK <= 2
|
||||
#error "Need NITALK > 2"
|
||||
#endif
|
||||
#define NR talki[0]
|
||||
#define TEI_id talki[1]
|
||||
#ifdef NEW_TIMEOUT
|
||||
#define timer talk_c
|
||||
#define timer talki[2]
|
||||
#endif
|
||||
#define N201 2
|
||||
#define T201 2
|
||||
|
@ -40,16 +42,18 @@ tei_send_id (isdn3_card card, uchar_t TEI)
|
|||
mblk_t *mb;
|
||||
isdn23_hdr hdr;
|
||||
int err;
|
||||
extern int hdrseq;
|
||||
|
||||
mb = allocb (sizeof (struct _isdn23_hdr), BPRI_MED);
|
||||
|
||||
if (mb == NULL)
|
||||
return EAGAIN;
|
||||
return -EAGAIN;
|
||||
hdr = ((isdn23_hdr) mb->b_wptr)++;
|
||||
#ifdef __CHECKER__
|
||||
bzero(hdr,sizeof(*hdr));
|
||||
#endif
|
||||
hdr->key = HDR_TEI;
|
||||
hdr->seqnum = hdrseq; hdrseq += 2;
|
||||
hdr->hdr_tei.card = card->nr;
|
||||
hdr->hdr_tei.TEI = TEI;
|
||||
if ((err = isdn3_sendhdr (mb)) != 0)
|
||||
|
@ -183,14 +187,14 @@ tei_verify (isdn3_talk talk)
|
|||
static void
|
||||
tei_T201 (isdn3_talk talk)
|
||||
{
|
||||
printf ("Timer TEI T201 %d\n", talk->NR);
|
||||
printf ("Timer TEI T201 %ld\n", talk->NR);
|
||||
if (talk->state & ST_T201) {
|
||||
talk->state &= ~ST_T201;
|
||||
if (!(talk->state & ST_up)) {
|
||||
talk->state |= ST_want_T202;
|
||||
return;
|
||||
}
|
||||
if (talk->NR >= N201 && tei_send_id (talk->card, TEI_BROADCAST) != EAGAIN) {
|
||||
if (talk->NR >= N201 && tei_send_id (talk->card, TEI_BROADCAST) != -EAGAIN) {
|
||||
tei_enquiry(talk);
|
||||
} else {
|
||||
talk->NR++;
|
||||
|
@ -203,7 +207,7 @@ tei_T201 (isdn3_talk talk)
|
|||
static void
|
||||
tei_T202 (isdn3_talk talk)
|
||||
{
|
||||
printf ("Timer TEI T202 %d\n", talk->NR);
|
||||
printf ("Timer TEI T202 %ld\n", talk->NR);
|
||||
if (talk->state & ST_T202) {
|
||||
talk->state &= ~ST_T202;
|
||||
if (!(talk->state & ST_up)) {
|
||||
|
@ -211,7 +215,7 @@ tei_T202 (isdn3_talk talk)
|
|||
return;
|
||||
}
|
||||
if (talk->NR >= N202) {
|
||||
if (tei_send_id (talk->card, TEI_BROADCAST) == EAGAIN) {
|
||||
if (tei_send_id (talk->card, TEI_BROADCAST) == -EAGAIN) {
|
||||
talk->state |= ST_T202;
|
||||
talk->state &=~ ST_want_T202;
|
||||
#ifdef NEW_TIMEOUT
|
||||
|
@ -306,11 +310,11 @@ tei_recv (isdn3_talk talk, char isUI, mblk_t * data)
|
|||
}
|
||||
if (!(isUI & 2)) { /* got to be a broadcast */
|
||||
printf("TEI RejNoBroadcast\n");
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
mb = pullupm (data, 4);
|
||||
if (mb == NULL)
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
/* Do not return nonzero after this point */
|
||||
|
||||
if (*mb->b_rptr++ != 0x0F) {
|
||||
|
@ -455,13 +459,13 @@ static int
|
|||
tei_sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
||||
{
|
||||
printf("TEI SendCmd Foo ");
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int
|
||||
tei_send (isdn3_conn conn, mblk_t * data)
|
||||
{
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -511,9 +515,9 @@ tei_getid (isdn3_card card)
|
|||
isdn3_talk talk;
|
||||
|
||||
if ((hndl = isdn3_findhndl (SAPI_TEI)) == NULL)
|
||||
return ENXIO;
|
||||
return -ENXIO;
|
||||
if ((talk = isdn3_findtalk (card, hndl, NULL, 0)) == NULL)
|
||||
return ENXIO;
|
||||
return -ENXIO;
|
||||
|
||||
if (!talk->state & ST_inited)
|
||||
tei_init (talk);
|
||||
|
@ -529,5 +533,6 @@ tei_getid (isdn3_card card)
|
|||
struct _isdn3_hndl TEI_hndl =
|
||||
{
|
||||
NULL, SAPI_TEI,1,
|
||||
NULL, &tei_newcard, &tei_modeflags, &tei_chstate, NULL, &tei_recv, &tei_send, &tei_sendcmd, &tei_kill, NULL, NULL,
|
||||
NULL, &tei_newcard, &tei_modeflags, &tei_chstate, NULL, &tei_recv,
|
||||
&tei_send, &tei_sendcmd, &tei_kill, NULL, NULL, NULL,
|
||||
};
|
||||
|
|
|
@ -1,47 +1,5 @@
|
|||
SHELL = /bin/sh
|
||||
MAKE = make
|
||||
## =()<P = @<P>@>()=
|
||||
P =
|
||||
|
||||
## =()<CC = @<CCU>@>()=
|
||||
CC = gcc
|
||||
## =()<DEFS = @<CARDDEFS>@ @<DEFS>@ -DLEVEL=@<MLEVEL>@ -I../include >()=
|
||||
DEFS = -DDUMB -I../streams -I../compat -I/usr/src/linux/include -I/usr/include/bsd -DLEVEL=3 -I../include
|
||||
## =()<CFLAGS = @<CFLAGS>@ $(DEFS)>()=
|
||||
CFLAGS = -O2 -Wall $(DEFS)
|
||||
## =()<LDFLAGS = -static @<LDFLAGS>@>()=
|
||||
LDFLAGS = -static -v
|
||||
## =()<LEVEL = @<MLEVEL>@>()=
|
||||
LEVEL = 3
|
||||
## =()<LIBS = @<LIBS>@>()=
|
||||
LIBS = -lbsd
|
||||
|
||||
SOURCES = cf.c conn.c devs.c info.c malldebug.c master.c match.c nr.c \
|
||||
stream.c texts.c util.c work.c loader.c
|
||||
OBJ = cf.o conn.o devs.o info.o malldebug.o master.o match.o nr.o \
|
||||
stream.o texts.o util.o work.o loader.o
|
||||
ALL = master
|
||||
|
||||
all prog: $(OBJ) $(ALL)
|
||||
|
||||
install update: all
|
||||
|
||||
master: $(P) $(OBJ) ../support.a ../isdn_3.a
|
||||
$(CC) $(LDFLAGS) -o $@ $(OBJ) `./libs.sh $(LEVEL)` $(LIBS)
|
||||
lib:
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(ALL) master.old
|
||||
|
||||
indent:
|
||||
../indent.sh $(SOURCES)
|
||||
|
||||
depend: Makefile $(SOURCES)
|
||||
$(CC) -M $(DEFS) $(SOURCES) > .depend
|
||||
|
||||
load:
|
||||
|
||||
ifeq (.depend,$(wildcard .depend))
|
||||
include .depend
|
||||
endif
|
||||
PROGRAM = master
|
||||
EXTRA_LIBS=../isdn_3.a ../support.a
|
||||
|
||||
TOPDIR=..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
|
27
isdn_4/cf.c
27
isdn_4/cf.c
|
@ -9,6 +9,7 @@
|
|||
|
||||
static int seqnum;
|
||||
|
||||
/* Read a line, handle empty lines and continuations. */
|
||||
struct _cf *
|
||||
read_line (FILE * ffile, int *theLine)
|
||||
{
|
||||
|
@ -36,7 +37,7 @@ read_line (FILE * ffile, int *theLine)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (*line == '#') {
|
||||
if (*line == '#' || *line == '\n') {
|
||||
sofar = line;
|
||||
*line = '\0';
|
||||
remain = MAXLINE;
|
||||
|
@ -47,15 +48,13 @@ read_line (FILE * ffile, int *theLine)
|
|||
*sofar = '\0';
|
||||
out = (struct _cf *)malloc (sizeof (struct _cf) + (now = sofar - line + 1));
|
||||
|
||||
chkone(out);
|
||||
bcopy (line, (char *) (out + 1), now);
|
||||
chkone(out);
|
||||
bzero ((char *) out, sizeof (struct _cf));
|
||||
chkone(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
void
|
||||
/* Append a config entry to a list of config entries. */
|
||||
static void
|
||||
app (cf * where, cf who)
|
||||
{
|
||||
char *x = (char *) who + 1;
|
||||
|
@ -74,7 +73,8 @@ app (cf * where, cf who)
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
/* Skip spaces */
|
||||
static int
|
||||
skipsp (char **li)
|
||||
{
|
||||
char *x = *li;
|
||||
|
@ -91,7 +91,7 @@ skipsp (char **li)
|
|||
}
|
||||
|
||||
#ifdef unused
|
||||
void
|
||||
static void
|
||||
skipword (char **li)
|
||||
{
|
||||
char *x = *li;
|
||||
|
@ -102,6 +102,7 @@ skipword (char **li)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Read a config file */
|
||||
void
|
||||
read_file (FILE * ffile, char *errf)
|
||||
{
|
||||
|
@ -122,7 +123,7 @@ read_file (FILE * ffile, char *errf)
|
|||
if (skipsp (&li)) break; c->cclass = li;
|
||||
if (skipsp (&li)) break; c->card = li;
|
||||
if (skipsp (&li)) break; c->type = li;
|
||||
if (skipsp (&li)) break; c->args = li;
|
||||
if (skipsp (&li)) c->args = ""; else c->args = li;
|
||||
chkone(c);
|
||||
c->protocol = str_enter(c->protocol);
|
||||
c->site = str_enter(c->site);
|
||||
|
@ -198,11 +199,13 @@ read_file (FILE * ffile, char *errf)
|
|||
app (&cf_D, c);
|
||||
continue;
|
||||
case CHAR2 ('D', 'L'):
|
||||
/* DL <Karte> <Nummer> <Protokolle> */
|
||||
/* DL <Key> <Karte> <Nummer> <Protokolle> */
|
||||
if (skipsp (&li)) break; c->cclass = li;
|
||||
if (skipsp (&li)) break; c->card = li;
|
||||
if (skipsp (&li)) break; c->arg = li;
|
||||
if (skipsp (&li)) break; c->args = li;
|
||||
if (skipsp (&li)) c->args = ""; else c->args = li;
|
||||
chkone(c);
|
||||
c->cclass = str_enter(c->cclass);
|
||||
c->card = str_enter(c->card);
|
||||
c->arg = str_enter(c->arg);
|
||||
c->args = str_enter(c->args);
|
||||
|
@ -298,12 +301,14 @@ read_file (FILE * ffile, char *errf)
|
|||
continue;
|
||||
case CHAR2 ('C', 'L'):
|
||||
if (skipsp (&li)) break; c->card = li;
|
||||
if (skipsp (&li)) break; c->cclass = li;
|
||||
if (skipsp (&li)) break;
|
||||
if ((c->num = atoi (li)) == 0 && li[0] != '0')
|
||||
break;;
|
||||
if (!skipsp (&li)) c->args = li;
|
||||
chkone(c);
|
||||
c->site = str_enter(c->site);
|
||||
c->cclass = str_enter(c->cclass);
|
||||
c->args = str_enter(c->args);
|
||||
app (&cf_CL, c);
|
||||
continue;
|
||||
|
@ -316,6 +321,7 @@ read_file (FILE * ffile, char *errf)
|
|||
|
||||
char **fileargs;
|
||||
|
||||
/* Read all the files. */
|
||||
void
|
||||
read_args (void *nix)
|
||||
{
|
||||
|
@ -357,6 +363,7 @@ read_args (void *nix)
|
|||
}
|
||||
}
|
||||
|
||||
/* Read all the files and kick off the programs. */
|
||||
void
|
||||
read_args_run(void *nix)
|
||||
{
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
#include "master.h"
|
||||
|
||||
|
||||
/* Clone a connection info record ("conngrab" because I use it to collect
|
||||
all pertinent information to grab data out of the configuration files
|
||||
with), or create a new one. */
|
||||
conngrab Xnewgrab(conngrab master, int lin)
|
||||
{
|
||||
conngrab slave;
|
||||
|
@ -15,9 +18,10 @@ conngrab Xnewgrab(conngrab master, int lin)
|
|||
slave = malloc(sizeof(*slave));
|
||||
if(slave == NULL)
|
||||
return NULL;
|
||||
if(master == NULL)
|
||||
if(master == NULL) {
|
||||
bzero(slave,sizeof(*slave));
|
||||
else {
|
||||
slave->cclass = str_enter("*");
|
||||
} else {
|
||||
if(master->refs == 0 || master->protocol == (char *)0xdeadbeef)
|
||||
panic("FreeGrab");
|
||||
*slave = *master;
|
||||
|
@ -26,12 +30,11 @@ conngrab Xnewgrab(conngrab master, int lin)
|
|||
if(slave->par_in != NULL)
|
||||
slave->par_in = dupmsg(slave->par_in);
|
||||
}
|
||||
if(0)printf("\nNG + %p %d\n",slave,lin);
|
||||
slave->refs = 1;
|
||||
return slave;
|
||||
}
|
||||
|
||||
#define dropgrab(x) Xdropgrab((x),__LINE__)
|
||||
/* Forget one... */
|
||||
void Xdropgrab(conngrab cg,int lin)
|
||||
{
|
||||
if(cg == NULL)
|
||||
|
@ -53,18 +56,18 @@ void Xdropgrab(conngrab cg,int lin)
|
|||
cg->card = (void *)0xdeadbeef;
|
||||
chkone(cg);
|
||||
free(cg);
|
||||
if(0)printf("\nNG - %p %d\n",cg,lin);
|
||||
return;
|
||||
}
|
||||
if(0)printf("\nNG ? %p %d %d\n",cg,lin,cg->refs);
|
||||
}
|
||||
|
||||
/* Set the reference number. For debugging. */
|
||||
void Xsetconnref(const char *deb_file, unsigned int deb_line, conninfo conn, int connref)
|
||||
{
|
||||
printf("-%s:%d: SetConnRef.%p %d/%d/%ld -> %d\n",deb_file,deb_line,conn,conn->minor,conn->fminor,conn->connref,connref);
|
||||
if(0)printf("-%s:%d: SetConnRef.%p %d/%d/%ld -> %d\n",deb_file,deb_line,conn,conn->minor,conn->fminor,conn->connref,connref);
|
||||
conn->connref = connref;
|
||||
}
|
||||
|
||||
/* Print the text foo onto all ATL/ channels. */
|
||||
void connreport(char *foo)
|
||||
{
|
||||
conninfo conn;
|
||||
|
@ -101,6 +104,7 @@ void connreport(char *foo)
|
|||
}
|
||||
}
|
||||
|
||||
/* Print the state of this connection with connreport(). */
|
||||
void ReportConn(conninfo conn)
|
||||
{
|
||||
char sp[200], *spf = sp;
|
||||
|
@ -130,6 +134,8 @@ void ReportConn(conninfo conn)
|
|||
connreport(sp);
|
||||
}
|
||||
|
||||
/* Sets the state of a connection; does all the housekeeping associated
|
||||
with the change. */
|
||||
void Xsetconnstate(const char *deb_file, unsigned int deb_line,conninfo conn, CState state)
|
||||
{
|
||||
chkone(conn);
|
||||
|
@ -239,19 +245,19 @@ void Xsetconnstate(const char *deb_file, unsigned int deb_line,conninfo conn, CS
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* "rdrop" means "really drop". */
|
||||
void rdropconn (struct conninfo *conn, int deb_line) {
|
||||
conn->ignore=2; dropconn(conn); }
|
||||
|
||||
void
|
||||
Xdropconn (struct conninfo *conn, int deb_line)
|
||||
Xdropconn (struct conninfo *conn, const char *deb_file, unsigned int deb_line)
|
||||
{
|
||||
chkone(conn);
|
||||
if(conn->locked) {
|
||||
printf ("DropConn %d: LOCK %d/%d/%ld\n", deb_line, conn->minor, conn->fminor, conn->connref);
|
||||
if(1)printf ("DropConn %s:%d: LOCK %d/%d/%ld\n", deb_file,deb_line, conn->minor, conn->fminor, conn->connref);
|
||||
return;
|
||||
}
|
||||
printf ("DropConn %d: %d/%d/%ld\n", deb_line, conn->minor, conn->fminor, conn->connref);
|
||||
if(1)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);
|
||||
|
@ -261,24 +267,25 @@ Xdropconn (struct conninfo *conn, int deb_line)
|
|||
else
|
||||
ReportConn(conn);
|
||||
#endif
|
||||
timeout(rdropconn,conn,HZ*60*5);
|
||||
timeout(rdropconn,conn,HZ*60*5); /* Drop the record after five minutes */
|
||||
return;
|
||||
} else if(conn->ignore == 1) {
|
||||
} else if(conn->ignore == 1) { /* already going to drop it */
|
||||
setconnstate(conn,c_forceoff);
|
||||
return;
|
||||
} else
|
||||
setconnstate(conn,c_forceoff);
|
||||
if (theconn == conn)
|
||||
theconn = conn->next;
|
||||
else {
|
||||
struct conninfo *sconn;
|
||||
|
||||
for (sconn = theconn; sconn != NULL; sconn = sconn->next) {
|
||||
if (sconn->next == conn) {
|
||||
sconn->next = conn->next;
|
||||
{ /* unchain the conn from the list */
|
||||
/* Could use a doubly-linked list here, but what the ... */
|
||||
struct conninfo **pconn = &theconn;
|
||||
while(*pconn != NULL) {
|
||||
if(*pconn == conn) {
|
||||
*pconn = conn->next;
|
||||
break;
|
||||
}
|
||||
pconn = &(*pconn)->next;
|
||||
}
|
||||
|
||||
}
|
||||
{
|
||||
struct proginfo *run;
|
||||
|
@ -289,7 +296,7 @@ Xdropconn (struct conninfo *conn, int deb_line)
|
|||
run->master = NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
{ /* Say that we forgot the thing. */
|
||||
char xs[10];
|
||||
sprintf(xs,"-%d",conn->seqnum);
|
||||
connreport(xs);
|
||||
|
@ -315,7 +322,7 @@ void retime(struct conninfo *conn)
|
|||
m_putid (mb, PROTO_ENABLE);
|
||||
xlen = mb->b_wptr - mb->b_rptr;
|
||||
DUMPW (mb->b_rptr, xlen);
|
||||
(void) strwrite (xs_mon, (uchar_t *) mb->b_rptr, &xlen, 1);
|
||||
(void) strwrite (xs_mon, (uchar_t *) mb->b_rptr, xlen, 1);
|
||||
freemsg(mb);
|
||||
}
|
||||
}
|
||||
|
@ -335,6 +342,7 @@ void time_reconn(struct conninfo *conn)
|
|||
}
|
||||
}
|
||||
|
||||
/* Reestablish a connection, eg. because data are to be transmitted. */
|
||||
void try_reconn(struct conninfo *conn)
|
||||
{
|
||||
mblk_t *md;
|
||||
|
@ -412,7 +420,7 @@ void try_reconn(struct conninfo *conn)
|
|||
m_putid (mb, PROTO_DISABLE);
|
||||
xlen = mb->b_wptr - mb->b_rptr;
|
||||
DUMPW (mb->b_rptr, xlen);
|
||||
(void) strwrite (xs_mon, (uchar_t *) mb->b_rptr, &xlen, 1);
|
||||
(void) strwrite (xs_mon, (uchar_t *) mb->b_rptr, xlen, 1);
|
||||
freeb(mb);
|
||||
}
|
||||
} else {
|
||||
|
@ -434,7 +442,7 @@ printf("DropThis, %s\n",ret);
|
|||
|
||||
xlen=md->b_wptr-md->b_rptr;
|
||||
DUMPW (md->b_rptr, xlen);
|
||||
(void) strwrite (xs_mon, md->b_rptr, &xlen, 1);
|
||||
(void) strwrite (xs_mon, md->b_rptr, xlen, 1);
|
||||
freeb(md);
|
||||
} else
|
||||
setconnstate(conn,c_off);
|
||||
|
|
|
@ -58,7 +58,6 @@ idevname (short minor)
|
|||
|
||||
|
||||
/* Check a lock file. */
|
||||
|
||||
void
|
||||
checkdev(int dev)
|
||||
{
|
||||
|
@ -84,7 +83,7 @@ checkdev(int dev)
|
|||
else
|
||||
sbuf[len]='\0';
|
||||
pid = atoi(sbuf);
|
||||
if(pid <= 0 || (kill(pid,0) == -1 && errno == ESRCH)) {
|
||||
if(pid <= 0 || (kill(pid,0) == -1 && errno == -ESRCH)) {
|
||||
if(0)syslog(LOG_WARNING,"Checking %s: unkillable, pid %d, deleted, %m",permtt1, pid);
|
||||
unlink(permtt1);
|
||||
}
|
||||
|
@ -105,7 +104,7 @@ checkdev(int dev)
|
|||
else
|
||||
sbuf[len]='\0';
|
||||
pid = atoi(sbuf);
|
||||
if(pid <= 0 || (kill(pid,0) == -1 && errno == ESRCH)) {
|
||||
if(pid <= 0 || (kill(pid,0) == -1 && errno == -ESRCH)) {
|
||||
if(0)syslog(LOG_WARNING,"Checking %s: unkillable, pid %d, deleted, %m",permtt2, pid);
|
||||
unlink(permtt2);
|
||||
}
|
||||
|
@ -116,7 +115,6 @@ checkdev(int dev)
|
|||
|
||||
|
||||
/* Lock a device. One failure, for externally-opened devices (cu), may be tolerated. */
|
||||
|
||||
int
|
||||
lockdev(int dev, char onefailok)
|
||||
{
|
||||
|
@ -173,7 +171,6 @@ lockdev(int dev, char onefailok)
|
|||
|
||||
|
||||
/* ... and unlock it. */
|
||||
|
||||
void
|
||||
unlockdev(int dev)
|
||||
{
|
||||
|
|
435
isdn_4/info.c
435
isdn_4/info.c
File diff suppressed because it is too large
Load Diff
|
@ -1,10 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$1" = "2" ] ; then
|
||||
echo ../isdn_3.a ../isdn_2.a ../support.a
|
||||
elif [ "$1" = "3" ] ; then
|
||||
echo ../isdn_3.a ../support.a
|
||||
else
|
||||
echo ../support.a
|
||||
fi
|
||||
|
105
isdn_4/loader.c
105
isdn_4/loader.c
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "master.h"
|
||||
|
||||
#if 0
|
||||
#if 0 /* master.h */
|
||||
struct loader {
|
||||
char *card;
|
||||
FILE *file;
|
||||
|
@ -18,15 +18,62 @@ struct loader {
|
|||
/* cf_LF: num2: sequence number; num: block size */
|
||||
#endif
|
||||
|
||||
void card_load(struct loader *ld)
|
||||
static void
|
||||
card_load_close(struct loader *ld)
|
||||
{
|
||||
if(ld->name != NULL)
|
||||
ld->card->name = ld->name;
|
||||
if(ld->file != NULL)
|
||||
fclose(ld->file);
|
||||
if(ld->timer)
|
||||
untimeout(card_load,ld);
|
||||
{
|
||||
struct loader **ldp = &isdn4_loader;
|
||||
while(*ldp != NULL) {
|
||||
if(*ldp == ld) {
|
||||
*ldp = ld->next;
|
||||
break;
|
||||
}
|
||||
ldp = &(*ldp)->next;
|
||||
}
|
||||
}
|
||||
free(ld);
|
||||
}
|
||||
|
||||
void
|
||||
card_load_fail(struct loader *ld, int err)
|
||||
{
|
||||
mblk_t *mj = allocb (32, BPRI_LO);
|
||||
int len;
|
||||
|
||||
syslog(LOG_ERR,"Card %s was not loaded: Error at file %d, pos %d\n",ld->card,ld->nrfile,ld->foffset);
|
||||
|
||||
/* Tell lower layer to forget the thing */
|
||||
|
||||
if (mj != NULL) {
|
||||
m_putid (mj, CMD_NOCARD);
|
||||
m_putsx (mj, ARG_CARD);
|
||||
m_putsz (mj, ld->name);
|
||||
len = mj->b_wptr - mj->b_rptr;
|
||||
DUMPW (mj->b_rptr, len);
|
||||
(void) strwrite (xs_mon, (uchar_t *) mj->b_rptr, len, 1);
|
||||
freeb (mj);
|
||||
}
|
||||
|
||||
card_load_close(ld);
|
||||
}
|
||||
|
||||
void
|
||||
card_load(struct loader *ld)
|
||||
{
|
||||
cf dl,lf;
|
||||
int do_again;
|
||||
|
||||
ld->timer = 0;
|
||||
again:
|
||||
do_again = 0;
|
||||
for(lf = cf_LF; lf != NULL; lf++) {
|
||||
if(!wildmatch(ld->card,lf->card))
|
||||
for(lf = cf_LF; lf != NULL; lf = lf->next) {
|
||||
if(!wildmatch(ld->name,lf->card))
|
||||
continue;
|
||||
if(ld->seqnum != 0 && ld->seqnum != lf->num2) {
|
||||
if(ld->seqnum < lf->num2 && (do_again == 0 || do_again > lf->num2))
|
||||
|
@ -37,7 +84,7 @@ void card_load(struct loader *ld)
|
|||
}
|
||||
if(lf == NULL) {
|
||||
if(ld->seqnum == 0) {
|
||||
syslog(LOG_ERR, "Card loader for %s dropped us (seq %d)!\n",ld->card,ld->seqnum);
|
||||
syslog(LOG_ERR, "Card loader for %s has a config problem (seq %d)!\n",ld->card,ld->seqnum);
|
||||
goto ex_load;
|
||||
}
|
||||
if(do_again) {
|
||||
|
@ -52,7 +99,7 @@ void card_load(struct loader *ld)
|
|||
mblk_t xx;
|
||||
struct datab db;
|
||||
struct iovec io[3];
|
||||
streamchar ans[30];
|
||||
streamchar ans[50];
|
||||
|
||||
if(ld->file != NULL) {
|
||||
buf = malloc(lf->num);
|
||||
|
@ -61,9 +108,8 @@ void card_load(struct loader *ld)
|
|||
goto ex_load;
|
||||
}
|
||||
|
||||
foffset = ftell(ld->file);
|
||||
if(foffset < 0) {
|
||||
syslog(LOG_ERR, "Card loader for %s: ftell returned %m\n",ld->card);
|
||||
if(fseek(ld->file,ld->foffset,0) < 0) {
|
||||
syslog(LOG_ERR, "Card loader for %s: fseek returned %m\n",ld->card);
|
||||
goto ex_load;
|
||||
}
|
||||
len = fread(buf,1,lf->num,ld->file);
|
||||
|
@ -72,18 +118,24 @@ void card_load(struct loader *ld)
|
|||
free(buf);
|
||||
goto ex_load;
|
||||
}
|
||||
foffset = ld->foffset;
|
||||
ld->foffset += len;
|
||||
} else {
|
||||
len = 0;
|
||||
foffset = 0;
|
||||
ld->foffset = 0;
|
||||
}
|
||||
if(!do_again && (ld->file == NULL))
|
||||
++ld->nrfile; /* last file; we're finished */
|
||||
xx.b_rptr = xx.b_wptr = ans;
|
||||
xx.b_datap = &db;
|
||||
db.db_base = ans;
|
||||
db.db_lim = ans + sizeof (ans);
|
||||
m_putid (&xx, CMD_LOADFILE);
|
||||
m_putsx(&xx,ARG_CARD);
|
||||
m_putsz(&xx,ld->card);
|
||||
m_putsz(&xx,ld->name);
|
||||
m_putsx(&xx,ARG_SEQNUM);
|
||||
m_puti(&xx,ld->seqnum);
|
||||
m_puti(&xx,ld->nrfile);
|
||||
m_putsx(&xx,ARG_OFFSET);
|
||||
m_puti(&xx,foffset);
|
||||
|
||||
|
@ -92,8 +144,8 @@ void card_load(struct loader *ld)
|
|||
DUMPW (ans, xlen);
|
||||
io[0].iov_base = ans;
|
||||
io[0].iov_len = xlen;
|
||||
io[1].iov_base = ":: ";
|
||||
io[1].iov_len = 3;
|
||||
io[1].iov_base = "::";
|
||||
io[1].iov_len = 2;
|
||||
if(len > 0) {
|
||||
io[2].iov_base = buf;
|
||||
io[2].iov_len = len;
|
||||
|
@ -103,23 +155,27 @@ void card_load(struct loader *ld)
|
|||
if(ld->file != NULL) {
|
||||
fclose(ld->file);
|
||||
ld->file = NULL;
|
||||
ld->seqnum++;
|
||||
}
|
||||
}
|
||||
(void) strwritev (xs_mon, io,len, 1);
|
||||
free(buf);
|
||||
if(do_again) {
|
||||
timeout(card_load,ld,HZ/5);
|
||||
ld->timer = 1;
|
||||
timeout(card_load,ld,ld->file ? HZ : HZ*(ld->nrfile+2));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
ld->seqnum = lf->num2;
|
||||
ld->nrfile++;
|
||||
ld->file = fopen(lf->arg,"r");
|
||||
ld->foffset = 0;
|
||||
if(ld->file == NULL) {
|
||||
syslog(LOG_ERR, "Card loader for %s: file %s: %m\n",ld->card,lf->arg);
|
||||
goto ex_load;
|
||||
}
|
||||
timeout(card_load,ld,HZ);
|
||||
ld->timer = 1;
|
||||
timeout(card_load,ld,HZ*2);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -130,14 +186,15 @@ void card_load(struct loader *ld)
|
|||
struct datab db;
|
||||
streamchar ans[30];
|
||||
|
||||
if(!wildmatch(dl->card,ld->card))
|
||||
if(!wildmatch(dl->card,ld->name))
|
||||
continue;
|
||||
xx.b_rptr = xx.b_wptr = ans;
|
||||
xx.b_datap = &db;
|
||||
db.db_base = ans;
|
||||
db.db_lim = ans + sizeof (ans);
|
||||
m_putid (&xx, CMD_DOCARD);
|
||||
m_putsx(&xx,ARG_CARD);
|
||||
m_putsz(&xx,ld->card);
|
||||
m_putsz(&xx,ld->name);
|
||||
|
||||
*xx.b_wptr++ = ' ';
|
||||
len = xx.b_wptr - xx.b_rptr;
|
||||
|
@ -147,8 +204,8 @@ void card_load(struct loader *ld)
|
|||
len = 1;
|
||||
if(dl->args != NULL) {
|
||||
printf ("+ ");
|
||||
io[len].iov_base = ":: ";
|
||||
io[len].iov_len = 3;
|
||||
io[len].iov_base = "::";
|
||||
io[len].iov_len = 2;
|
||||
len++;
|
||||
io[len].iov_base = dl->args;
|
||||
io[len].iov_len = strlen(dl->args);
|
||||
|
@ -156,12 +213,14 @@ void card_load(struct loader *ld)
|
|||
len++;
|
||||
}
|
||||
(void) strwritev (xs_mon, io,len, 1);
|
||||
break;
|
||||
card_load_close(ld);
|
||||
|
||||
do_run_now++;
|
||||
timeout(run_now,NULL,HZ/3);
|
||||
return;
|
||||
}
|
||||
|
||||
ex_load:
|
||||
if(ld->file != NULL)
|
||||
fclose(ld->file);
|
||||
free(ld);
|
||||
card_load_fail(ld,-EIO);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -16,20 +16,20 @@ main (int argc, char *argv[])
|
|||
extern int optind;
|
||||
|
||||
char *devnam = "/dev/isdnmon";
|
||||
char *execf = NULL;
|
||||
int pushlog = 0;
|
||||
int debug = 0;
|
||||
int x;
|
||||
|
||||
#ifdef linux
|
||||
reboot(0xfee1dead,0x17392634,1); /* Magic to make me nonswappable */
|
||||
/* TODO: 1.3.xx kernel / libc: use appropriate system call */
|
||||
#endif
|
||||
#ifdef DO_DEBUG_MALLOC
|
||||
mcheck(NULL);
|
||||
mmtrace();
|
||||
#endif
|
||||
chkall();
|
||||
setlinebuf(stdout); setlinebuf(stderr);
|
||||
setlinebuf(stdout); setlinebuf(stderr); /* no(t much) buffering */
|
||||
|
||||
progname = strrchr (*argv, '/'); /* basename */
|
||||
if (progname == NULL)
|
||||
|
@ -37,8 +37,12 @@ main (int argc, char *argv[])
|
|||
else
|
||||
progname++;
|
||||
|
||||
while ((x = getopt (argc, argv, "iItf:x:dlLwWqQ"))!= EOF) {
|
||||
while ((x = getopt (argc, argv, "iIf:dlLwWqQ"))!= 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 'l':
|
||||
pushlog |= 1;
|
||||
break;
|
||||
|
@ -57,43 +61,37 @@ main (int argc, char *argv[])
|
|||
case 'Q':
|
||||
pushlog |= 32;
|
||||
break;
|
||||
case 'd':
|
||||
|
||||
case 'd': /* do not fork */
|
||||
debug = 1;
|
||||
break;
|
||||
case 't':
|
||||
testonly = 1;
|
||||
break;
|
||||
case 'x':
|
||||
if (execf != NULL)
|
||||
goto usage;
|
||||
execf = optarg;
|
||||
break;
|
||||
case 'I':
|
||||
case 'I': /* for testing */
|
||||
igstdin = 0;
|
||||
break;
|
||||
case 'i':
|
||||
igstdin = 1;
|
||||
break;
|
||||
case 'f':
|
||||
case 'f': /* alternate device to open */
|
||||
if (getuid ()!= 0)
|
||||
goto usage;
|
||||
devnam = optarg;
|
||||
break;
|
||||
default:
|
||||
usage:
|
||||
fprintf (stderr, "Usage: %s -t[est] -x Data -l[ogging] -F epromfile -f devfile\n"
|
||||
"\t-M load+direct+Leo -m direct+Leo \n", progname);
|
||||
fprintf (stderr, "Usage: %s -WQLwql[ogging] [ -f device ] \n"
|
||||
"\t-d[ebug]", progname);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
openlog (progname, debug ? LOG_PERROR : 0, LOG_LOCAL7);
|
||||
|
||||
/* Remember all files to scan */
|
||||
fileargs = &argv[optind];
|
||||
read_args (NULL);
|
||||
read_args (NULL); /* This also schedules starting all configured programs */
|
||||
|
||||
seteuid (getuid ());
|
||||
|
||||
if (!debug) {
|
||||
if (!debug) { /* Disassociate */
|
||||
switch (fork ()){
|
||||
case -1:
|
||||
xquit ("fork", NULL);
|
||||
|
@ -118,7 +116,6 @@ main (int argc, char *argv[])
|
|||
for (i=getdtablesize()-1;i>=0;i--)
|
||||
(void) close(i);
|
||||
}
|
||||
igstdin=1;
|
||||
open("/dev/null",O_RDWR);
|
||||
dup(0); dup(0);
|
||||
#ifdef HAVE_SETPGRP_2
|
||||
|
@ -130,7 +127,7 @@ main (int argc, char *argv[])
|
|||
}
|
||||
|
||||
#ifdef linux
|
||||
{
|
||||
{ /* (Re)Create all our device files */
|
||||
FILE * fd;
|
||||
if((fd = fopen("/proc/devices","r")) == NULL)
|
||||
syslog(LOG_ERR,"Reading device numbers: %m");
|
||||
|
@ -184,60 +181,43 @@ main (int argc, char *argv[])
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Standard signal handling -- TODO: Use sigaction() instead. */
|
||||
signal (SIGALRM, (sigfunc__t) alarmsig);
|
||||
signal (SIGPIPE, SIG_IGN);
|
||||
if(signal(SIGHUP,SIG_IGN) != SIG_IGN)
|
||||
signal (SIGHUP, SIG_DFL);
|
||||
if(signal(SIGINT,SIG_IGN) != SIG_IGN)
|
||||
signal (SIGINT, do_quitnow);
|
||||
signal (SIGINT, (void *)do_quitnow); /* Always these "incompatible" pointers... */
|
||||
signal (SIGQUIT, (sigfunc__t) do_quitnow);
|
||||
signal (SIGUSR1, (sigfunc__t) kill_progs);
|
||||
signal (SIGCHLD, (sigfunc__t) deadkid);
|
||||
|
||||
chkall();
|
||||
/* Create a stream within the program */
|
||||
xs_mon = stropen (0);
|
||||
if (xs_mon == NULL)
|
||||
xquit ("xs_mon = NULL", "");
|
||||
|
||||
if (!testonly) {
|
||||
/* Open the device and push kernel stream modules */
|
||||
fd_mon = open (devnam, O_RDWR);
|
||||
if (fd_mon < 0)
|
||||
xquit ("Open Dev", devnam);
|
||||
if (ioctl (fd_mon, I_SRDOPT, RMSGN) < 0)
|
||||
if (errno != ENOTTY)
|
||||
if (ioctl (fd_mon, I_SRDOPT, RMSGN) < 0) /* Message mode */
|
||||
xquit ("SetStrOpt", "");
|
||||
|
||||
if (pushlog & 2)
|
||||
if (ioctl (fd_mon, I_PUSH, "strlog") < 0)
|
||||
if (errno != ENOTTY)
|
||||
xquit ("Push", "strlog 1");
|
||||
if (pushlog & 8)
|
||||
if (ioctl (fd_mon, I_PUSH, "logh") < 0)
|
||||
if (errno != ENOTTY)
|
||||
xquit ("Push", "strlog 1");
|
||||
if (pushlog & 32)
|
||||
if (ioctl (fd_mon, I_PUSH, "qinfo") < 0)
|
||||
if (errno != ENOTTY)
|
||||
xquit ("Push", "strlog 1");
|
||||
#if LEVEL < 4
|
||||
if (xnkernel) {
|
||||
if (ioctl (fd_mon, I_PUSH, "isdn_3") < 0) {
|
||||
syslog (LOG_ERR, "No kernel ISDN module: %m");
|
||||
xnkernel = 0;
|
||||
} else {
|
||||
if (pushlog & 1)
|
||||
if (ioctl (fd_mon, I_PUSH, "strlog") < 0)
|
||||
xquit ("Push", "strlog 1");
|
||||
if (pushlog & 4)
|
||||
if (ioctl (fd_mon, I_PUSH, "logh") < 0)
|
||||
xquit ("Push", "strlog 1");
|
||||
if (pushlog & 16)
|
||||
if (ioctl (fd_mon, I_PUSH, "qinfo") < 0)
|
||||
xquit ("Push", "strlog 1");
|
||||
}
|
||||
}
|
||||
#if LEVEL > 3
|
||||
if (ioctl (fd_mon, I_PUSH, "isdn_3") < 0)
|
||||
xquit ("ISDN_3 module");
|
||||
#endif
|
||||
} {
|
||||
{ /* Associate the kernel stream with the user stream */
|
||||
typedef int (*F) ();
|
||||
extern void isdn3_init (void);
|
||||
extern void isdn_init (void);
|
||||
|
@ -264,31 +244,25 @@ main (int argc, char *argv[])
|
|||
#endif
|
||||
register_strmod (&strloginfo);
|
||||
register_strmod (&loghinfo);
|
||||
|
||||
#if LEVEL < 4
|
||||
if (!xnkernel || testonly) {
|
||||
/* push user-mode streams modules */
|
||||
if (pushlog & 1)
|
||||
strioctl (xs_mon, I_PUSH, (long) "log");
|
||||
strioctl (xs_mon, I_PUSH, (long) "strlog");
|
||||
if (pushlog & 4)
|
||||
strioctl (xs_mon, I_PUSH, (long) "logh");
|
||||
if (pushlog & 16)
|
||||
strioctl (xs_mon, I_PUSH, (long) "qinfo");
|
||||
strioctl (xs_mon, I_PUSH, (long) "isdn_3");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if(0)callout_async ();
|
||||
timeout (log_idle, NULL, 5 * HZ);
|
||||
timeout (queue_idle, NULL, HZ);
|
||||
if (execf != NULL) {
|
||||
FILE *efile = fopen (execf, "r");
|
||||
|
||||
if (efile == NULL)
|
||||
xquit ("Exec File", execf);
|
||||
}
|
||||
syspoll ();
|
||||
if(0)callout_async (); /* We prefer to do everything synchronously */
|
||||
timeout (log_idle, NULL, 5 * HZ); /* Tell everybody that we're still alive */
|
||||
timeout (queue_idle, NULL, HZ/3); /* process the user-mode streams */
|
||||
syspoll (); /* Now go and do some work */
|
||||
|
||||
/* Shut down. Ungracefully. Graceful shutdown of active cards TODO. */
|
||||
strclose (xs_mon, 0);
|
||||
exit (0);
|
||||
return 0;
|
||||
return 0; /* -> exit(0) */
|
||||
}
|
||||
|
|
|
@ -167,11 +167,8 @@ EXTERN int isdnterm INIT(0); /* major number of the terminal driver */
|
|||
EXTERN int isdnstd INIT(0); /* major number of the standard driver */
|
||||
#endif
|
||||
|
||||
EXTERN char *cardlist[NCARDS]; /* List of available ISDN interfaces */
|
||||
EXTERN short cardnrbchan[NCARDS]; /* Nr of B channels */
|
||||
EXTERN short cardnum INIT(0); /* Number of registered interfaces */
|
||||
EXTERN short cardidx INIT(0); /* Used to cycle among interfaces */
|
||||
EXTERN short numidx INIT(0); /* Ditto */
|
||||
EXTERN short numidx INIT(0); /* Used to cycle among numbers */
|
||||
|
||||
EXTERN void *locputchar INIT(NULL); /* Glue */
|
||||
|
||||
|
@ -201,6 +198,7 @@ EXTERN struct string {
|
|||
char *str_enter(char *master);
|
||||
char *wildmatch(char *a, char *b);
|
||||
char *classmatch(char *a, char *b);
|
||||
char *strippat(char *a);
|
||||
|
||||
|
||||
/* List of cards */
|
||||
|
@ -296,7 +294,7 @@ typedef struct conninfo {
|
|||
unsigned got_hd:2; /* disconnect... */
|
||||
unsigned got_id:2;
|
||||
unsigned char locked;
|
||||
unsigned ignore:3;
|
||||
unsigned ignore:3; /* 0: normal; 1: did drop it; 2: kill it; 3: reporter */
|
||||
} *conninfo;
|
||||
|
||||
/* Special flags. */
|
||||
|
@ -308,7 +306,7 @@ typedef struct conninfo {
|
|||
#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_IGNOREBUSY 0400
|
||||
#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 */
|
||||
|
@ -442,15 +440,6 @@ void chkone(void *foo);
|
|||
void chkall(void);
|
||||
#endif /* DO_DEBUG_MALLOC */
|
||||
|
||||
struct _cf * read_line (FILE * ffile, int *theLine);
|
||||
void app (cf * where, cf who);
|
||||
|
||||
int skipsp (char **li);
|
||||
|
||||
#ifdef unused
|
||||
static void skipword (char **li);
|
||||
#endif
|
||||
|
||||
void read_file (FILE * ffile, char *errf);
|
||||
|
||||
EXTERN char **fileargs;
|
||||
|
@ -460,11 +449,9 @@ void read_args_run(void *nix);
|
|||
|
||||
const char *CauseInfo(int cause, char *pri);
|
||||
|
||||
void Xdropconn (struct conninfo *conn, int deb_line);
|
||||
#define dropconn(x) Xdropconn((x),__LINE__)
|
||||
|
||||
void Xdropconn (struct conninfo *conn, const char *deb_file, unsigned int deb_line);
|
||||
#define dropconn(x) Xdropconn((x),__FILE__,__LINE__)
|
||||
void rdropconn (struct conninfo *conn, int deb_line);
|
||||
void Xdropconn (struct conninfo *conn, int deb_line);
|
||||
void deadkid (void);
|
||||
|
||||
int matchflag(long flags, char *ts);
|
||||
|
@ -517,11 +504,26 @@ void kill_progs(struct conninfo *xconn);
|
|||
|
||||
|
||||
struct loader {
|
||||
char *card;
|
||||
char *name;
|
||||
struct isdncard *card;
|
||||
FILE *file;
|
||||
long seqnum; /* position in config file(s) */
|
||||
int nrfile; /* loaded to card */
|
||||
long foffset; /* position in load file */
|
||||
struct loader *next;
|
||||
int cardnum;
|
||||
unsigned timer:1;
|
||||
};
|
||||
void card_load(struct loader *ld);
|
||||
void card_load_fail(struct loader *ld, int err); /* error */
|
||||
EXTERN struct loader *isdn4_loader INIT(NULL);
|
||||
|
||||
struct isdncard {
|
||||
struct isdncard *next;
|
||||
char *name;
|
||||
long cap;
|
||||
ushort_t nrbchan;
|
||||
};
|
||||
EXTERN struct isdncard *isdn4_card INIT(NULL);
|
||||
|
||||
#endif
|
||||
|
|
195
isdn_4/match.c
195
isdn_4/match.c
|
@ -6,9 +6,10 @@
|
|||
*/
|
||||
|
||||
#include "master.h"
|
||||
#include "isdn_12.h" /* CHM_INTELLIGENT */
|
||||
|
||||
|
||||
|
||||
/* Verify that the connection mode matches the stated flags. */
|
||||
int
|
||||
matchflag(long flags, char *ts)
|
||||
{
|
||||
|
@ -36,7 +37,7 @@ matchflag(long flags, char *ts)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Check if this P-line matches a connection request */
|
||||
char *
|
||||
pmatch1 (cf prot, conngrab *cgm)
|
||||
{
|
||||
|
@ -45,16 +46,19 @@ pmatch1 (cf prot, conngrab *cgm)
|
|||
conngrab cg = *cgm;
|
||||
|
||||
chkone(prot); chkone(cg);
|
||||
/* Basic preprocessing */
|
||||
sit = wildmatch(cg->site, prot->site); if(sit == NULL) return "7ERR Match SITE";
|
||||
pro = wildmatch(cg->protocol,prot->protocol);if(pro == NULL) return "6ERR Match PROTOCOL";
|
||||
car = wildmatch(cg->card, prot->card); if(car == NULL) return "6ERR Match CARD";
|
||||
cla =classmatch(cg->cclass, prot->cclass); if(cla == NULL) return "6ERR Match CLASS";
|
||||
|
||||
/* OK, that fits. Make a copy to assign the values to. */
|
||||
cg = newgrab(cg);
|
||||
if(cg == NULL)
|
||||
return "0OUT OF MEMORY";
|
||||
cg->site = sit; cg->protocol = pro; cg->card = car; cg->cclass = cla;
|
||||
|
||||
/* Now scan this line's, and all matching followup lines', flags. */
|
||||
for (first = 1; prot != NULL; prot = prot->next, first = 0) {
|
||||
#define ARG_IN 01
|
||||
#define ARG_OUT 02
|
||||
|
@ -66,12 +70,12 @@ pmatch1 (cf prot, conngrab *cgm)
|
|||
|
||||
if(!matchflag(cg->flags,prot->type)) { if(first) { dropgrab(cg); return "5ERR BadFlag"; } else continue;}
|
||||
if (first) {
|
||||
if (strchr (prot->type, 'M')) {
|
||||
if (strchr (prot->type, 'M')) { /* First Match not allowed. */
|
||||
dropgrab(cg);
|
||||
return "7ERR FIND NotFirst";
|
||||
}
|
||||
} else {
|
||||
if (strchr (prot->type, 'R'))
|
||||
if (strchr (prot->type, 'R')) /* First Match only. */
|
||||
goto Ex;
|
||||
|
||||
sit = wildmatch(cg->site, prot->site); if(sit==NULL) continue;
|
||||
|
@ -79,6 +83,8 @@ pmatch1 (cf prot, conngrab *cgm)
|
|||
car = wildmatch(cg->card, prot->card); if(car==NULL) continue;
|
||||
cla =classmatch(cg->cclass, prot->cclass); if(cla==NULL) continue;
|
||||
}
|
||||
/* Now make another copy for the parameters. If they don't fit
|
||||
we'll have to undo everything. */
|
||||
cgc = newgrab(cg);
|
||||
if(cgc == NULL) {
|
||||
dropgrab(cg);
|
||||
|
@ -87,7 +93,7 @@ pmatch1 (cf prot, conngrab *cgm)
|
|||
if(!first) {
|
||||
cgc->site = sit; cgc->protocol = pro; cgc->card = car; cgc->cclass = cla;
|
||||
}
|
||||
if(cgc->par_out == NULL) {
|
||||
if(cgc->par_out == NULL) { /* No outgoing parameter list? Yet! */
|
||||
if ((cgc->par_out = allocb(256,BPRI_LO)) == NULL) {
|
||||
dropgrab(cgc); dropgrab(cg);
|
||||
return "0OUT of MEMORY";
|
||||
|
@ -95,14 +101,17 @@ pmatch1 (cf prot, conngrab *cgm)
|
|||
}
|
||||
#define DG(str) { if(first) { Xbreak(); dropgrab(cgc); dropgrab(cg); return str; } goto Ex; }
|
||||
|
||||
/* Remember pointers into the parameter strings. */
|
||||
mbs_in = ((cgc->par_in !=NULL)? cgc->par_in->b_rptr : NULL);
|
||||
mbs_out= ((cgc->par_out!=NULL)? cgc->par_out->b_rptr: NULL);
|
||||
|
||||
/* Allocate a new candidate string for outgoing parameters. */
|
||||
cand = allocsb (strlen (prot->args), (streamchar *)prot->args);
|
||||
if(cand == NULL)
|
||||
goto Ex;
|
||||
while (m_getsx (cand, &id) == 0) {
|
||||
|
||||
/* Check that an incoming parameter matches. */
|
||||
#define CHKI(_what,_t) \
|
||||
({ __label__ ex; long xx,yy; ushort_t id2; \
|
||||
yy = 0; \
|
||||
|
@ -116,11 +125,13 @@ pmatch1 (cf prot, conngrab *cgm)
|
|||
if(0)if(!strchr(prot->type,'F') && !first) break;\
|
||||
cgc->par_in->b_rptr = mbs_in; \
|
||||
freeb(cand); \
|
||||
if(1)printf("MatchI %x: %lx vs %lx\n",id,xx,yy); \
|
||||
if(0)printf("MatchI %x: %lx vs %lx\n",id,xx,yy); \
|
||||
dropgrab(cgc); dropgrab(cg); return "3ERR FIND Match Arg"; \
|
||||
} \
|
||||
} \
|
||||
ex:; }) /**/
|
||||
|
||||
/* Dto., outgoing parameter; if it's not there yet and we need it, add it. */
|
||||
#define CHKO(_what,_t) \
|
||||
({ __label__ ex; long xx,yy; ushort_t id2; \
|
||||
yy = 0; \
|
||||
|
@ -134,7 +145,7 @@ pmatch1 (cf prot, conngrab *cgm)
|
|||
if(0)if(!strchr(prot->type,'F') && !first) break;\
|
||||
cgc->par_out->b_rptr = mbs_out; \
|
||||
freeb(cand); \
|
||||
if(1)printf("MatchO %x: %lx vs %lx\n",id,xx,yy); \
|
||||
if(0)printf("MatchO %x: %lx vs %lx\n",id,xx,yy); \
|
||||
dropgrab(cgc); dropgrab(cg); return "3ERR FIND Match Arg"; \
|
||||
} \
|
||||
if(!(cgc->flags & F_OUTCOMPLETE)) { \
|
||||
|
@ -143,10 +154,14 @@ pmatch1 (cf prot, conngrab *cgm)
|
|||
} \
|
||||
} \
|
||||
ex:; }) /**/
|
||||
|
||||
/* Put it all together. */
|
||||
#define CHK(_what,_t) { \
|
||||
if((nrt & ARG_OUT)&& (cgc->par_out!= NULL)) CHKO(_what,_t); \
|
||||
if((nrt & ARG_IN) && (cgc->par_in != NULL)) CHKI(_what,_t); } break
|
||||
|
||||
/* Same as above, but for vectorized parameters with optional bitmasks. */
|
||||
/* You are not supposed to understand this code. */
|
||||
#define CHKVI() \
|
||||
({ __label__ ex; int xx,yy,xm; streamchar *vx,*vy,*vm; ushort_t id2; \
|
||||
yy = m_gethexlen(cand); \
|
||||
|
@ -171,7 +186,7 @@ pmatch1 (cf prot, conngrab *cgm)
|
|||
if(0)if(!strchr(prot->type,'F') && !first) continue; \
|
||||
cgc->par_in->b_rptr = mbs_in; \
|
||||
freeb(cand); \
|
||||
if(1)printf("MatchVI %x: %s vs %s\n",id,vx,vy); \
|
||||
if(0)printf("MatchVI %x: %s vs %s\n",id,vx,vy); \
|
||||
free(vx); free(vy); if(xm>0)free(vm); \
|
||||
dropgrab(cgc); dropgrab(cg); return "3ERR FIND Match Arg"; \
|
||||
} \
|
||||
|
@ -201,7 +216,7 @@ pmatch1 (cf prot, conngrab *cgm)
|
|||
{ free(vx); free(vy); if(xm>0)free(vm); goto ex; } \
|
||||
if(0)if(!strchr(prot->type,'F') && !first) continue; \
|
||||
cgc->par_out->b_rptr = mbs_out; \
|
||||
if(1)printf("MatchVO %x: %s vs %s\n",id,vx,vy); \
|
||||
if(0)printf("MatchVO %x: %s vs %s\n",id,vx,vy); \
|
||||
freeb(cand); \
|
||||
free(vx); free(vy); if(xm>0)free(vm); \
|
||||
dropgrab(cgc); dropgrab(cg); return "3ERR FIND Match Arg"; \
|
||||
|
@ -217,6 +232,8 @@ pmatch1 (cf prot, conngrab *cgm)
|
|||
#define CHKV() { \
|
||||
if((nrt & ARG_OUT)&& (cgc->par_out!= NULL)) CHKVO(); \
|
||||
if((nrt & ARG_IN) && (cgc->par_in != NULL)) CHKVI(); } break
|
||||
|
||||
/* Simple one-shot labels that can't be undone (and don't need to be). */
|
||||
#define CHKX() \
|
||||
({ __label__ ex; ushort_t id2; \
|
||||
if(cgc->par_out != NULL) { \
|
||||
|
@ -230,25 +247,32 @@ pmatch1 (cf prot, conngrab *cgm)
|
|||
ex:; }); break /**/
|
||||
|
||||
switch (id) {
|
||||
/* Direction-specific arguments. */
|
||||
case ARG_INNUMS : nrt=ARG_IN; break;
|
||||
case ARG_OUTNUMS : nrt=ARG_OUT; break;
|
||||
case ARG_BOTHNUMS: nrt=ARG_IN|ARG_OUT; break;
|
||||
|
||||
/* Flags, ob lokale / entfernte Nummern präsent sein sollen
|
||||
oder nicht. Logischerweise nur bei ankommenden Anrufen
|
||||
interessant. */
|
||||
case ARG_NEEDNOLOCAL:
|
||||
if(cg->lnr != NULL)
|
||||
if((cg->flags & F_INCOMING) && (cg->lnr != NULL))
|
||||
DG("3LocalNrGiven");
|
||||
break;
|
||||
case ARG_NEEDNOREMOTE:
|
||||
if(cg->nr != NULL)
|
||||
if((cg->flags & F_INCOMING) && (cg->nr != NULL))
|
||||
DG("3RemoteNrGiven");
|
||||
break;
|
||||
case ARG_NEEDLOCAL:
|
||||
if(cg->lnr == NULL)
|
||||
if((cg->flags & F_INCOMING) && (cg->lnr == NULL))
|
||||
DG("3LocalNrRequired");
|
||||
break;
|
||||
case ARG_NEEDREMOTE:
|
||||
if(cg->nr == NULL)
|
||||
if((cg->flags & F_INCOMING) && (cg->nr == NULL))
|
||||
DG("3RemoteNrRequired");
|
||||
break;
|
||||
|
||||
/* Suffix fuer entfernte Nummer. */
|
||||
case ARG_NUMBER:
|
||||
{
|
||||
char yy[MAXNR + 2];
|
||||
|
@ -272,6 +296,8 @@ pmatch1 (cf prot, conngrab *cgm)
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* Suffix fuer lokale Nummer. */
|
||||
case ARG_LNUMBER:
|
||||
{
|
||||
char yy[MAXNR + 2];
|
||||
|
@ -295,6 +321,8 @@ pmatch1 (cf prot, conngrab *cgm)
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* Protokollkrempel... */
|
||||
case ARG_LLC:
|
||||
CHKV ();
|
||||
case ARG_ULC:
|
||||
|
@ -309,6 +337,9 @@ pmatch1 (cf prot, conngrab *cgm)
|
|||
CHK (i, long);
|
||||
case ARG_CHANNEL:
|
||||
CHK (i, long);
|
||||
|
||||
/* Flags... */
|
||||
case ARG_CHANBUSY: cgc->flags |= F_CHANBUSY; goto argdup;
|
||||
case ARG_FASTREDIAL: cgc->flags |= F_FASTREDIAL; goto argdup;
|
||||
case ARG_FASTDROP: cgc->flags |= F_FASTDROP; break;
|
||||
case ARG_IGNORELIMIT:cgc->flags |= F_IGNORELIMIT;goto argdup;
|
||||
|
@ -322,28 +353,33 @@ pmatch1 (cf prot, conngrab *cgm)
|
|||
argdup:
|
||||
CHKX();
|
||||
}
|
||||
/* Reset der Stringpointer. */
|
||||
if(cgc->par_in != NULL) cgc->par_in->b_rptr = mbs_in;
|
||||
if(cgc->par_out!= NULL) cgc->par_out->b_rptr= mbs_out;
|
||||
}
|
||||
/* At this point, everything fit (so far). Kill the intermediate copy. */
|
||||
dropgrab(cg);
|
||||
cg = cgc;
|
||||
cgc = NULL;
|
||||
Ex:
|
||||
if(cand != NULL)
|
||||
freeb (cand);
|
||||
if (strchr(prot->type,'X'))
|
||||
if (strchr(prot->type,'X')) /* Cut off here. */
|
||||
break;
|
||||
if(cgc != NULL) {
|
||||
if(cgc != NULL) { /* If we have an intermediate copy, toss it. */
|
||||
if(cgc->par_in != NULL) cgc->par_in->b_rptr = mbs_in;
|
||||
if(cgc->par_out!= NULL) cgc->par_out->b_rptr= mbs_out;
|
||||
dropgrab(cgc);
|
||||
}
|
||||
}
|
||||
|
||||
/* Done. Return the result. */
|
||||
dropgrab(*cgm);
|
||||
*cgm = cg;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Scan all the P lines, search for a matching block of entries and incorporate into *cgm. */
|
||||
char *
|
||||
pmatch (conngrab *cgm)
|
||||
{
|
||||
|
@ -363,7 +399,7 @@ pmatch (conngrab *cgm)
|
|||
return errstr;
|
||||
}
|
||||
|
||||
|
||||
/* Scan the configuration, incorporate matching entries into *foo. */
|
||||
char *
|
||||
findsite (conngrab *foo)
|
||||
{
|
||||
|
@ -378,13 +414,17 @@ findsite (conngrab *foo)
|
|||
|
||||
chkone(cg);
|
||||
cg->refs++;
|
||||
for (dl = cf_DL; dl != NULL; dl = dl->next) {
|
||||
for (dl = cf_DL; dl != NULL; dl = dl->next) { /* find a matching local number. */
|
||||
char *matcrd;
|
||||
char *matclass;
|
||||
|
||||
if(0)printf("%s.%s.!.",cg->site,cg->card);
|
||||
if(0)printf("%s.%s.!.",cg->site,cg->card); /* I hate debugging. */
|
||||
|
||||
if ((matclass = classmatch (cg->cclass, dl->cclass)) == NULL)
|
||||
continue;
|
||||
if ((matcrd = wildmatch (cg->card, dl->card)) == NULL)
|
||||
continue;
|
||||
if(!(cg->flags & F_LEASED)) {
|
||||
if(!(cg->flags & F_LEASED)) { /* ... and a working dial prefix. */
|
||||
char *crd;
|
||||
for (dp = cf_DP; dp != NULL; dp = dp->next) {
|
||||
if ((crd = wildmatch (cg->card, dp->card)) != NULL)
|
||||
|
@ -395,8 +435,17 @@ if(0)printf("%s.%s.!.",cg->site,cg->card);
|
|||
continue;
|
||||
}
|
||||
matcrd = crd;
|
||||
}
|
||||
for (d = cf_D, numwrap = 1; d != NULL || numwrap > 0; d = (numwrap ? d->next : d)) {
|
||||
} /* if everybody had DSS1, we could skip the prefix nonsense... */
|
||||
|
||||
/* Now find a site to call out to. */
|
||||
/* The numwrap stuff makes sure that we restart where we left off last
|
||||
time, which ensures that calling a system with more than one
|
||||
number does what it's supposed to. */
|
||||
/* Incoming calls start at the beginning and don't hit the
|
||||
wraparound. */
|
||||
for (d = cf_D, numwrap = (cg->flags & F_INCOMING);
|
||||
(d != NULL) || (numwrap > 0);
|
||||
d = (numwrap ? d->next : d)) {
|
||||
char *matcla;
|
||||
char *matsit;
|
||||
char *matcar;
|
||||
|
@ -411,8 +460,10 @@ if(0)printf("%s.%s.!.",cg->site,cg->card);
|
|||
continue;
|
||||
else if(numwrap == 0)
|
||||
numwrap = -1;
|
||||
if(!(cg->flags & F_INCOMING))
|
||||
numidx++;
|
||||
|
||||
/* Yes, we did increment the refcount, above. */
|
||||
dropgrab(cg);
|
||||
cg = *foo;
|
||||
cg->refs++;
|
||||
|
@ -421,8 +472,10 @@ if(0)printf("%s.%s.!.",cg->site,cg->card);
|
|||
if((matpro = wildmatch(cg->protocol,d->protocol)) == NULL) continue;
|
||||
if((matcar = wildmatch(matcrd,d->card)) == NULL) continue;
|
||||
if((matcla = classmatch(cg->cclass,d->cclass)) == NULL) continue;
|
||||
if((matcla = classmatch(matcla,matclass)) == NULL) continue;
|
||||
if(!matchflag(cg->flags,d->type)) continue;
|
||||
|
||||
/* Preliminary match OK, remember the data so far. */
|
||||
dropgrab(cg);
|
||||
cg = newgrab(*foo);
|
||||
if(cg == NULL) return "0OUT OF MEM";
|
||||
|
@ -432,9 +485,9 @@ if(0)printf("%s.%s.!.",cg->site,cg->card);
|
|||
if(0)printf("%s...",matsit);
|
||||
|
||||
if(!(cg->flags & F_LEASED)) {
|
||||
/* Now figure out the numbers... */
|
||||
if(cg->nr != NULL) {
|
||||
cg->nrsuf = match_nr(cg->nr,d->arg, ((cg->flags&F_INCOMING) && (dp->args != NULL)) ? dp->args : dp->arg);
|
||||
if(0)printf("Match %s,%s,%s -> %s\n",cg->nr,d->arg, ((cg->flags&F_INCOMING) && (dp->args != NULL)) ? dp->args : dp->arg, cg->nrsuf);
|
||||
if(cg->nrsuf == NULL) {
|
||||
if(*errstr > '8') {
|
||||
dropgrab(errcg); errcg = cg; cg->refs++;
|
||||
|
@ -444,7 +497,6 @@ if(0)printf("%s.%s.!.",cg->site,cg->card);
|
|||
}
|
||||
} else if(!(cg->flags & F_INCOMING)) {
|
||||
cg->nr = build_nr(d->arg,dl->arg,((cg->flags&F_INCOMING) && (dp->args != NULL)) ? dp->args : dp->arg, 0);
|
||||
if(0)printf("Build %s,%s,%s,%d -> %s\n",d->arg,dl->arg,((cg->flags&F_INCOMING) && (dp->args != NULL)) ? dp->args : dp->arg, 0, cg->nr);
|
||||
if(cg->nr == NULL) {
|
||||
if(*errstr > '8') {
|
||||
dropgrab(errcg); errcg = cg; cg->refs++;
|
||||
|
@ -458,7 +510,6 @@ if(0)printf("%s.%s.!.",cg->site,cg->card);
|
|||
}
|
||||
if(cg->lnr != NULL) {
|
||||
cg->lnrsuf = match_nr(cg->lnr,dl->arg, ((cg->flags&F_INCOMING) && (dp->args != NULL)) ? dp->args : dp->arg);
|
||||
if(0)printf("MatchL %s,%s,%s -> %s\n",cg->lnr,dl->arg, ((cg->flags&F_INCOMING) && (dp->args != NULL)) ? dp->args : dp->arg, cg->lnrsuf);
|
||||
if(cg->lnrsuf == NULL) {
|
||||
if(*errstr > '3') {
|
||||
dropgrab(errcg); errcg = cg; cg->refs++;
|
||||
|
@ -468,7 +519,6 @@ if(0)printf("%s.%s.!.",cg->site,cg->card);
|
|||
}
|
||||
} else if(0) { /* Hmmm... */
|
||||
cg->lnr = build_nr(dl->arg,dl->arg,((cg->flags&F_INCOMING) && (dp->args != NULL)) ? dp->args : dp->arg, 0);
|
||||
if(0)printf("BuildL %s,%s,%s,%d -> %s\n",dl->arg,dl->arg,((cg->flags&F_INCOMING) && (dp->args != NULL)) ? dp->args : dp->arg, 0, cg->lnr);
|
||||
if(cg->lnr == NULL) {
|
||||
if(*errstr > '4') {
|
||||
dropgrab(errcg); errcg = cg; cg->refs++;
|
||||
|
@ -479,45 +529,31 @@ if(0)printf("%s.%s.!.",cg->site,cg->card);
|
|||
}
|
||||
}
|
||||
|
||||
if ((errstrx = pmatch (&cg)) == NULL) {
|
||||
goto gotit;
|
||||
}
|
||||
if(*errstr > *errstrx) {
|
||||
errstr = errstrx;
|
||||
errcg = cg; cg->refs++;
|
||||
}
|
||||
/* p->b_rptr = olds; */
|
||||
}
|
||||
dropgrab(cg);
|
||||
if(errcg != NULL) {
|
||||
dropgrab(*foo); *foo = errcg;
|
||||
}
|
||||
if(errstr != NULL)
|
||||
printf("A>%s; ",errstr);
|
||||
return errstr;
|
||||
|
||||
gotit:
|
||||
{
|
||||
/* Do we have a matching P line? */
|
||||
if ((errstrx = pmatch (&cg)) == NULL) { /* We have what we need. Now figure out if we can use it. */
|
||||
struct conninfo *conn;
|
||||
cf cl = NULL;
|
||||
int nrconn = 0, naconn = 0;
|
||||
int nrbchan = 0;
|
||||
|
||||
/* Check if there's a limiter. */
|
||||
for(cl = cf_CL; cl != NULL; cl = cl->next) {
|
||||
if(classmatch(cg->cclass,cl->cclass) == NULL)
|
||||
continue;
|
||||
if(wildmatch(cg->card, cl->card))
|
||||
break;
|
||||
}
|
||||
/* Check if we know how many B channels the card has */
|
||||
{
|
||||
int ci;
|
||||
for(ci=0; ci < cardnum; ci++) {
|
||||
if(!strcmp(cg->card, cardlist[ci])) {
|
||||
nrbchan = cardnrbchan[ci];
|
||||
struct isdncard *ca;
|
||||
|
||||
for(ca = isdn4_card; ca != NULL; ca = ca->next) {
|
||||
if(!strcmp(cg->card, ca->name)) {
|
||||
nrbchan = ca->nrbchan;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cl != NULL) {
|
||||
printf("Limit for %s:%d:%d %s:%s:%s %s\n",cg->card,cl->num,nrbchan,cg->site,cg->protocol,cg->cclass,cg->nr ? cg->nr : "-");
|
||||
for(conn = theconn; conn != NULL; conn = conn->next) {
|
||||
if(conn->ignore || !conn->cg)
|
||||
continue;
|
||||
|
@ -525,36 +561,41 @@ printf("Limit for %s:%d:%d %s:%s:%s %s\n",cg->card,cl->num,nrbchan,cg->site,cg->
|
|||
wildmatch(conn->cg->protocol,cg->protocol))
|
||||
continue;
|
||||
if((conn->state >= c_going_up) && wildmatch(conn->cg->card, cg->card)) {
|
||||
printf("Share line with %s:%d:%d %s:%s:%s %s\n",conn->cg->card,cl->num,nrbchan,conn->cg->site,conn->cg->protocol,conn->cg->cclass,conn->cg->nr ? conn->cg->nr : "-");
|
||||
nrconn ++;
|
||||
if(!(conn->flags & F_IGNORELIMIT))
|
||||
naconn++;
|
||||
}
|
||||
}
|
||||
if(((nrbchan > 0) && (nrconn >= nrbchan)) || ((naconn >= cl->num) && !(cg->flags & F_IGNORELIMIT))) {
|
||||
printf("BUSY: nrb %d, nrc %d, nac %d, num %d, flag %o ::",nrbchan,nrconn,naconn,cl->num,cg->flags);
|
||||
if(((nrbchan > 0) && (nrconn >= nrbchan)) || ((cl != NULL) && (naconn >= cl->num) && !(cg->flags & F_IGNORELIMIT))) {
|
||||
errstr = "0BUSY";
|
||||
dropgrab(errcg); errcg = cg; cg->refs++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (cg->par_out != NULL && strchr(d->type, 'H') != NULL && !(cg->flags & F_OUTCOMPLETE))
|
||||
m_putsx (cg->par_out, ARG_SUPPRESS);
|
||||
dropgrab(errcg);
|
||||
dropgrab(*foo); *foo = cg;
|
||||
return NULL;
|
||||
}
|
||||
/* No go. Remember the error, if appropriate. */
|
||||
if(*errstr > *errstrx) {
|
||||
errstr = errstrx;
|
||||
errcg = cg; cg->refs++;
|
||||
}
|
||||
/* p->b_rptr = olds; */
|
||||
}
|
||||
}
|
||||
/* Nothing matched. Grrr. */
|
||||
dropgrab(cg);
|
||||
if(errcg != NULL) {
|
||||
dropgrab(*foo);
|
||||
*foo = errcg;
|
||||
}
|
||||
if(errstr != NULL)
|
||||
printf("B>%s; ",errstr);
|
||||
return errstr;
|
||||
}
|
||||
|
||||
/* Wrapper stuff. Take numbers out of the incoming argument vector, find
|
||||
the card, et al. */
|
||||
char *
|
||||
findit (conngrab *foo)
|
||||
{
|
||||
|
@ -562,7 +603,7 @@ findit (conngrab *foo)
|
|||
mblk_t *p;
|
||||
char *errstr = "9NO CARD";
|
||||
char *errstrx;
|
||||
short c;
|
||||
struct isdncard *c;
|
||||
char *card;
|
||||
conngrab cg = newgrab(*foo);
|
||||
conngrab errcg = NULL;
|
||||
|
@ -606,25 +647,39 @@ findit (conngrab *foo)
|
|||
cg->site = str_enter("unknown");
|
||||
}
|
||||
|
||||
cardlim = cardnum+cardidx;
|
||||
for (c = cardidx; c < cardlim; c++) {
|
||||
cardlim = 0;
|
||||
|
||||
if(isdn4_card != NULL) {
|
||||
for(c = isdn4_card; (c != NULL) || (cardlim < cardidx); c = c->next) {
|
||||
cf crd;
|
||||
if(!wildmatch(card,cardlist[c % cardnum]))
|
||||
continue;
|
||||
cg->card = cardlist[c % cardnum];
|
||||
if(cg->flags & F_INCOMING)
|
||||
numidx = 1;
|
||||
if ((errstrx = findsite (&cg)) == NULL) {
|
||||
cardidx = (c+1)%cardnum;
|
||||
|
||||
cardlim++;
|
||||
|
||||
if(c == NULL) { /* Wraparound */
|
||||
c = isdn4_card;
|
||||
if(cardlim < cardidx)
|
||||
cardidx %= cardlim;
|
||||
}
|
||||
if(!wildmatch(card,c->name))
|
||||
continue;
|
||||
if(cg->flags & F_INCOMING) /* never skip */
|
||||
cardidx = 1;
|
||||
if(cardlim < cardidx)
|
||||
continue;
|
||||
cg->card = c->name;
|
||||
if ((errstrx = findsite (&cg)) == NULL) { /* Found it */
|
||||
cardidx++;
|
||||
dropgrab(*foo);
|
||||
*foo = cg;
|
||||
cg->flags |= F_OUTCOMPLETE;
|
||||
if(c->cap & CHM_INTELLIGENT)
|
||||
return NULL;
|
||||
for (crd = cf_CM; crd != NULL; crd = crd->next) {
|
||||
if (!wildmatch (cardlist[c % cardnum], crd->card))
|
||||
if (!wildmatch (c->name, crd->card))
|
||||
continue;
|
||||
return NULL;
|
||||
}
|
||||
errstrx = "0CARDMATCH";
|
||||
errstrx = "0CM line missing";
|
||||
}
|
||||
if(*errstrx < *errstr) {
|
||||
errstr = errstrx;
|
||||
|
@ -632,6 +687,9 @@ findit (conngrab *foo)
|
|||
errcg->refs++;
|
||||
}
|
||||
}
|
||||
} else
|
||||
errstr = "0No card in the system";
|
||||
|
||||
if(errcg != NULL) {
|
||||
dropgrab(*foo);
|
||||
*foo = errcg;
|
||||
|
@ -639,3 +697,4 @@ findit (conngrab *foo)
|
|||
dropgrab(cg);
|
||||
return errstr;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,9 @@ read_data ()
|
|||
case HDR_UIDATA:
|
||||
xREAD (uidata);
|
||||
break;
|
||||
case HDR_LOAD:
|
||||
xREAD (load);
|
||||
break;
|
||||
case HDR_RAWDATA:
|
||||
xREAD (rawdata);
|
||||
break;
|
||||
|
@ -132,12 +135,15 @@ static void backtime(void *nix) {
|
|||
backtimeout = 1;
|
||||
}
|
||||
|
||||
/* Do something until fd becomes active or timeout */
|
||||
/* Also process alerts */
|
||||
/* fd==-1: one-shot */
|
||||
/* fd==-2: continuous loop */
|
||||
int
|
||||
backrun (int fd, int timeo)
|
||||
{
|
||||
int err;
|
||||
fd_set rdx;
|
||||
time_t tx = time(NULL);
|
||||
|
||||
if(!testonly && !FD_ISSET(fd_mon,&rd))
|
||||
xquit("RD fd_set cleared",NULL);
|
||||
|
@ -182,7 +188,7 @@ backrun (int fd, int timeo)
|
|||
return backtimeout;
|
||||
}
|
||||
|
||||
|
||||
/* Main Program Loop */
|
||||
void
|
||||
syspoll (void)
|
||||
{
|
||||
|
@ -196,6 +202,7 @@ syspoll (void)
|
|||
}
|
||||
|
||||
|
||||
/* Upper stream read */
|
||||
void
|
||||
do_h (queue_t * q)
|
||||
{
|
||||
|
@ -203,17 +210,18 @@ do_h (queue_t * q)
|
|||
int len = sizeof (data) - 1;
|
||||
int err;
|
||||
|
||||
while ((err = strread (xs_mon, (streamchar *) data, &len, 1)) == 0 && len > 0) {
|
||||
do_info (data, len);
|
||||
while ((err = strread (xs_mon, (streamchar *) data, len, 1)) > 0) {
|
||||
do_info (data, err);
|
||||
len = sizeof (data) - 1;
|
||||
}
|
||||
if (err != 0) {
|
||||
errno = err;
|
||||
if (err < 0) {
|
||||
errno = -err;
|
||||
syslog (LOG_ERR, "Read H: %m");
|
||||
} else
|
||||
q->q_flag |= QWANTR;
|
||||
}
|
||||
|
||||
/* Lower stream read */
|
||||
void
|
||||
do_l (queue_t * q)
|
||||
{
|
||||
|
@ -224,9 +232,8 @@ do_l (queue_t * q)
|
|||
while (1) {
|
||||
struct iovec io[3];
|
||||
int iovlen = 1;
|
||||
int len = sizeof (struct _isdn23_hdr);
|
||||
|
||||
if ((err = strread (xs_mon, (streamchar *) &h, &len, 0)) == 0 && len == sizeof (struct _isdn23_hdr)) ;
|
||||
if ((err = strread (xs_mon, (streamchar *) &h, sizeof (struct _isdn23_hdr), 0)) == sizeof (struct _isdn23_hdr)) ;
|
||||
|
||||
else
|
||||
break;
|
||||
|
@ -243,21 +250,22 @@ do_l (queue_t * q)
|
|||
case HDR_DATA:
|
||||
case HDR_UIDATA:
|
||||
case HDR_PROTOCMD:
|
||||
case HDR_LOAD:
|
||||
io[iovlen].iov_base = (caddr_t) data;
|
||||
io[iovlen].iov_len = len = h.hdr_atcmd.len;
|
||||
if ((err = strread (xs_mon, (streamchar *) data, &len, 0)) != 0 || len != h.hdr_atcmd.len) {
|
||||
syslog (LOG_ERR, "do_l: Fault, %d, %m", len);
|
||||
io[iovlen].iov_len = h.hdr_atcmd.len;
|
||||
if ((err = strread (xs_mon, (streamchar *) data, h.hdr_atcmd.len, 0)) != h.hdr_atcmd.len) {
|
||||
syslog (LOG_ERR, "do_l: Fault, %d, %m", err);
|
||||
return;
|
||||
}
|
||||
io[iovlen].iov_base = (caddr_t) data;
|
||||
io[iovlen].iov_len = len;
|
||||
io[iovlen].iov_len = err;
|
||||
iovlen++;
|
||||
break;
|
||||
case HDR_INVAL:
|
||||
io[iovlen].iov_base = (caddr_t) data;
|
||||
io[iovlen].iov_len = len = sizeof (struct _isdn23_hdr);
|
||||
if ((err = strread (xs_mon, (streamchar *) data, &len, 0)) != 0 || len != sizeof (struct _isdn23_hdr)) {
|
||||
syslog (LOG_ERR, "do_l: Fault, %d, %m", len);
|
||||
io[iovlen].iov_len = sizeof (struct _isdn23_hdr);
|
||||
if ((err = strread (xs_mon, (streamchar *) data, sizeof (struct _isdn23_hdr), 0)) != sizeof (struct _isdn23_hdr)) {
|
||||
syslog (LOG_ERR, "do_l: Fault, %m");
|
||||
return;
|
||||
}
|
||||
iovlen++;
|
||||
|
@ -277,7 +285,7 @@ do_l (queue_t * q)
|
|||
}
|
||||
}
|
||||
if (err != 0) {
|
||||
errno = err;
|
||||
errno = -err;
|
||||
syslog (LOG_ERR, "Read L: %m");
|
||||
} else
|
||||
q->q_flag |= QWANTR;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "master.h"
|
||||
|
||||
|
||||
/* Textual representation of a connection state */
|
||||
char *state2str(CState state) {
|
||||
switch(state) {
|
||||
case c_up: return "up";
|
||||
|
@ -21,7 +21,7 @@ char *state2str(CState state) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Textual representation of a L2<->3 information element */
|
||||
char *HdrName (int hdr)
|
||||
{
|
||||
switch(hdr) {
|
||||
|
@ -48,6 +48,7 @@ char *HdrName (int hdr)
|
|||
}
|
||||
}
|
||||
|
||||
/* Textual representation of flags */
|
||||
char *FlagInfo(int flag)
|
||||
{
|
||||
static char fbuf[30];
|
||||
|
@ -62,7 +63,7 @@ char *FlagInfo(int flag)
|
|||
if (flag & F_FASTREDIAL) strcat(fbuf, ":fr");
|
||||
if (flag & F_PERMANENT) strcat(fbuf, ":dP");
|
||||
if (flag & F_LEASED) strcat(fbuf, ":dL");
|
||||
if (flag & F_IGNOREBUSY) strcat(fbuf, ":ib");
|
||||
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");
|
||||
|
@ -78,6 +79,8 @@ char *FlagInfo(int flag)
|
|||
strcpy(fbuf,"-");
|
||||
return fbuf;
|
||||
}
|
||||
|
||||
/* Textual representation of ISDN causes */
|
||||
const char *CauseInfo(int cause, char *pri)
|
||||
{
|
||||
if (cause == 999999) return "-";
|
||||
|
|
137
isdn_4/util.c
137
isdn_4/util.c
|
@ -7,7 +7,10 @@
|
|||
|
||||
#include "master.h"
|
||||
|
||||
|
||||
/* Too many strings to keep track of, no time for garbage collection. */
|
||||
/* Enter them in a binary tree... */
|
||||
/* str_enter MUST NOT be called while any string in the tree is temporarily
|
||||
modified. No string in the tree may be permanently modified in ANY way. */
|
||||
char *str_enter(char *master)
|
||||
{
|
||||
struct string **str = &stringdb;
|
||||
|
@ -39,6 +42,10 @@ char *str_enter(char *master)
|
|||
return st->data;
|
||||
}
|
||||
|
||||
/* Simpleminded, bidirectional wildmat().
|
||||
If both strings are patterns, this doesn't work. Unfortunately, pattern
|
||||
joining is obviously NP-complete, and I don't know any algorithms to do it
|
||||
anyway. */
|
||||
char *wildmatch(char *a, char *b)
|
||||
{
|
||||
if(a == NULL)
|
||||
|
@ -53,27 +60,141 @@ char *wildmatch(char *a, char *b)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
char *classmatch(char *a, char *b)
|
||||
/* Given a string aaa+bbb, return aaa. */
|
||||
char *
|
||||
strippat(char *a)
|
||||
{
|
||||
char aa[30];
|
||||
char *aplus = strchr(a,'+');
|
||||
|
||||
if(aplus == NULL)
|
||||
return a;
|
||||
*aplus = '\0';
|
||||
strcpy(aa,a);
|
||||
*aplus = '+';
|
||||
return str_enter(aa);
|
||||
}
|
||||
|
||||
/* Given strings +aaa+bbb and +ccc+aaa, return +aaa+bbb+ccc. */
|
||||
static char *
|
||||
pluscat(char *a, char *b)
|
||||
{
|
||||
if(a == NULL)
|
||||
return b;
|
||||
else if(b == NULL)
|
||||
if(b == NULL)
|
||||
return a;
|
||||
else if(*b == '*')
|
||||
return a;
|
||||
else if(*a == '*')
|
||||
if(*a != '+')
|
||||
return b;
|
||||
else {
|
||||
if(*b != '+')
|
||||
return a;
|
||||
{
|
||||
char classpat[50];
|
||||
char *classind = classpat;
|
||||
strcpy(classpat,a);
|
||||
while(*classind) {
|
||||
if(*classind == '+')
|
||||
*classind = '\0';
|
||||
classind++;
|
||||
}
|
||||
{
|
||||
char *bnext = b;
|
||||
do {
|
||||
b = bnext + 1;
|
||||
bnext = strchr(b,'+');
|
||||
if(bnext != NULL) *bnext = '\0';
|
||||
for(a = classpat+1; a < classind; a += strlen(a)+1)
|
||||
if(strcmp(a,b) == 0)
|
||||
break;
|
||||
if(a >= classind) {
|
||||
strcpy(classind+1,b);
|
||||
classind += strlen(b)+1;
|
||||
}
|
||||
if(bnext != NULL) *bnext = '+';
|
||||
} while(bnext != NULL);
|
||||
for(a = classpat; a < classind; a += strlen(a))
|
||||
*a++ = '+';
|
||||
*a = '\0';
|
||||
return str_enter(classpat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* "abc" "bcd" -> "bc" */
|
||||
/* "abc+bc" "bcd+b" -> "bc+bc+b" */
|
||||
/* "abc+bc" "bcd+d" -> NULL */
|
||||
/* It is of course possible to optimize all of this, but it's not worth the
|
||||
work. */
|
||||
char *
|
||||
classmatch(char *a, char *b)
|
||||
{
|
||||
if(a == NULL)
|
||||
return NULL;
|
||||
if(b == NULL)
|
||||
return NULL;
|
||||
if(*b == '*' || *b == '\0')
|
||||
return a;
|
||||
if(*a == '*' || *a == '\0')
|
||||
return b;
|
||||
if(*a == '+' || *b == '+') {
|
||||
if(*a == '+' && *b == '+') {
|
||||
char classpat[50];
|
||||
if(strcmp(a,b) == 0)
|
||||
return a;
|
||||
strcpy(classpat,a);
|
||||
strcat(classpat,b);
|
||||
return str_enter(classpat);
|
||||
} else {
|
||||
char *aorig,*bplus;
|
||||
if(*a != '+') {
|
||||
char *tmp = a; a = b; b = tmp;
|
||||
}
|
||||
if((bplus=strchr(b,'+')) != NULL) *bplus='\0';
|
||||
aorig = a;
|
||||
if(strlen(a) == 2) { /* Obvious optimization */
|
||||
a = classmatch(b,a+1);
|
||||
if(bplus != NULL) *bplus = '+';
|
||||
return a;
|
||||
}
|
||||
do {
|
||||
while(*++a != '\0' && *a != '+') {
|
||||
if(strchr(b,*a) != NULL)
|
||||
break;
|
||||
}
|
||||
if(*a == '\0' || *a == '+') {
|
||||
if(bplus != NULL) *bplus='+';
|
||||
return NULL;
|
||||
}
|
||||
} while((a = strchr(a,'+')) != NULL);
|
||||
{
|
||||
char classpat[50];
|
||||
strcpy(classpat,b);
|
||||
if(bplus != NULL)
|
||||
*bplus='+';
|
||||
strcat(classpat,pluscat(aorig,bplus));
|
||||
return str_enter(classpat);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
char classpat[30];
|
||||
char *classind = classpat;
|
||||
char *aplus, *bplus;
|
||||
if((aplus=strchr(a,'+')) != NULL) *aplus='\0';
|
||||
if((bplus=strchr(b,'+')) != NULL) *bplus='\0';
|
||||
while(*a != 0) {
|
||||
if(strchr(b,*a) != NULL)
|
||||
*classind++ = *a;
|
||||
a++;
|
||||
}
|
||||
if(aplus != NULL) *aplus='+';
|
||||
if(bplus != NULL) *bplus='+';
|
||||
if(classpat == classind)
|
||||
return NULL;
|
||||
*classind = 0;
|
||||
/* If the class is one character long, there's not much point
|
||||
in carrying around all the baggage. */
|
||||
if((classind > classpat+1) && (aplus != NULL || bplus != NULL))
|
||||
return classmatch(str_enter(classpat),pluscat(aplus,bplus));
|
||||
else
|
||||
return str_enter(classpat);
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +221,7 @@ xquit (const char *s, const char *t)
|
|||
{
|
||||
if (s != NULL)
|
||||
syslog (LOG_WARNING, "%s %s: %m", s, t ? t : "");
|
||||
exit (4);
|
||||
abort();
|
||||
}
|
||||
|
||||
void panic(const char *x, ...)
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
*/
|
||||
|
||||
#include "master.h"
|
||||
#include "isdn_12.h"
|
||||
|
||||
|
||||
/* Handle dead processes */
|
||||
void
|
||||
deadkid (void)
|
||||
{
|
||||
|
@ -69,6 +70,7 @@ deadkid (void)
|
|||
}
|
||||
|
||||
|
||||
/* Push protocols onto stream */
|
||||
int
|
||||
pushprot (conngrab cg, int minor, char update)
|
||||
{
|
||||
|
@ -84,7 +86,7 @@ pushprot (conngrab cg, int minor, char update)
|
|||
break;
|
||||
}
|
||||
if (prot == NULL)
|
||||
return ENOENT;
|
||||
return -ENOENT;
|
||||
if(update)
|
||||
cg->flags = (cg->flags & ~F_SETINITIAL) | F_SETLATER;
|
||||
else
|
||||
|
@ -93,8 +95,7 @@ pushprot (conngrab cg, int minor, char update)
|
|||
char *sp1, *sp2;
|
||||
char *sx;
|
||||
|
||||
if(!update) {
|
||||
mblk_t *mj = allocb (40 + strlen (prot->args), BPRI_LO);
|
||||
mblk_t *mj = allocb (60 + strlen (prot->args), BPRI_LO);
|
||||
int len;
|
||||
mods = prot->args;
|
||||
|
||||
|
@ -102,17 +103,22 @@ pushprot (conngrab cg, int minor, char update)
|
|||
m_putsx (mj, ARG_MINOR);
|
||||
m_puti (mj, minor);
|
||||
m_putdelim (mj);
|
||||
if(update)
|
||||
m_putid (mj, PROTO_UPDATEMODLIST);
|
||||
else
|
||||
m_putid (mj, PROTO_MODLIST);
|
||||
m_putsx (mj, ARG_MODE); /* set card mode */
|
||||
m_putsz (mj, prot->arg);
|
||||
m_putdelim (mj);
|
||||
m_putsz(mj, mods);
|
||||
len = mj->b_wptr - mj->b_rptr;
|
||||
DUMPW (mj->b_rptr, len);
|
||||
(void) strwrite (xs_mon, (uchar_t *) mj->b_rptr, &len, 1);
|
||||
(void) strwrite (xs_mon, (uchar_t *) mj->b_rptr, len, 1);
|
||||
freeb (mj);
|
||||
}
|
||||
|
||||
sx = (char *)malloc (strlen (prot->args) + 5 + strlen (PROTO_NAME));
|
||||
if (sx == NULL)
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
sprintf (sx, " %s %s", prot->args, PROTO_NAME);
|
||||
sp1 = sx;
|
||||
while (*sp1 != '\0' && !isspace (*sp1))
|
||||
|
@ -129,7 +135,7 @@ pushprot (conngrab cg, int minor, char update)
|
|||
*sp2++ = '\0';
|
||||
if ((mi = allocb (256, BPRI_MED)) == NULL) {
|
||||
free (sx);
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
}
|
||||
for (cm = cf_MP; cm != NULL; cm = cm->next) {
|
||||
ushort_t id;
|
||||
|
@ -209,7 +215,7 @@ pushprot (conngrab cg, int minor, char update)
|
|||
int len;
|
||||
|
||||
if (mj == NULL)
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
m_putid (mj, CMD_PROT);
|
||||
m_putsx (mj, ARG_MINOR);
|
||||
m_puti (mj, minor);
|
||||
|
@ -217,7 +223,7 @@ pushprot (conngrab cg, int minor, char update)
|
|||
m_putc (mj, PROTO_MODE);
|
||||
len = mj->b_wptr - mj->b_rptr;
|
||||
DUMPW (mj->b_rptr, len);
|
||||
(void) strwrite (xs_mon, (uchar_t *) mj->b_rptr, &len, 1);
|
||||
(void) strwrite (xs_mon, (uchar_t *) mj->b_rptr, len, 1);
|
||||
freeb (mj);
|
||||
}
|
||||
|
||||
|
@ -226,12 +232,21 @@ pushprot (conngrab cg, int minor, char update)
|
|||
}
|
||||
|
||||
|
||||
/* Set ISDN card mode */
|
||||
int
|
||||
pushcardprot (conngrab cg, int minor)
|
||||
{
|
||||
cf prot;
|
||||
cf cmod = NULL;
|
||||
int num = 0; /* Grrr, GCC */
|
||||
struct isdncard *card;
|
||||
|
||||
for(card = isdn4_card; card != NULL; card = card->next) {
|
||||
if(wildmatch(cg->card,card->name))
|
||||
break;
|
||||
}
|
||||
if(card == NULL)
|
||||
return -ENOENT;
|
||||
for (prot = cf_ML; prot != NULL; prot = prot->next) {
|
||||
if(!matchflag(cg->flags,prot->type)) continue;
|
||||
if (!wildmatch (cg->site, prot->site)) continue;
|
||||
|
@ -239,38 +254,46 @@ pushcardprot (conngrab cg, int minor)
|
|||
if (!wildmatch (cg->card, prot->card)) continue;
|
||||
if (!classmatch (cg->cclass, prot->cclass)) continue;
|
||||
|
||||
if(card->cap & CHM_INTELLIGENT) {
|
||||
num = 1;
|
||||
} else {
|
||||
for (cmod = cf_CM; cmod != NULL; cmod = cmod->next) {
|
||||
if (!wildmatch (cg->card, cmod->card)) continue;
|
||||
if (!wildmatch(prot->arg,cmod->arg)) continue;
|
||||
break;
|
||||
}
|
||||
if (cmod != NULL)
|
||||
if (cmod == NULL)
|
||||
return -ENOENT;
|
||||
num = cmod->num;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (prot == NULL)
|
||||
return ENOENT;
|
||||
return -ENOENT;
|
||||
|
||||
if (minor != 0) {
|
||||
mblk_t *mj = allocb (32, BPRI_LO);
|
||||
int len;
|
||||
|
||||
if (mj == NULL)
|
||||
return ENOMEM;
|
||||
return -ENOMEM;
|
||||
m_putid (mj, CMD_CARDSETUP);
|
||||
m_putsx (mj, ARG_MINOR);
|
||||
m_puti (mj, minor);
|
||||
m_putdelim (mj);
|
||||
m_putc (mj, PROTO_MODE);
|
||||
m_puti (mj, cmod->num);
|
||||
m_puti (mj, num);
|
||||
m_puti (mj, prot->num);
|
||||
len = mj->b_wptr - mj->b_rptr;
|
||||
DUMPW (mj->b_rptr, len);
|
||||
(void) strwrite (xs_mon, (uchar_t *) mj->b_rptr, &len, 1);
|
||||
(void) strwrite (xs_mon, (uchar_t *) mj->b_rptr, len, 1);
|
||||
freeb (mj);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Startup a connection... */
|
||||
struct conninfo *
|
||||
startconn(conngrab cg, int fminor, int connref, char **ret)
|
||||
{
|
||||
|
@ -341,6 +364,7 @@ startconn(conngrab cg, int fminor, int connref, char **ret)
|
|||
}
|
||||
if(conn == NULL) {
|
||||
dropgrab(cg);
|
||||
*ret = "Internal error: Connection not found";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -490,7 +514,6 @@ printf("Start: %s:%s #%s...",cg->site,cg->protocol,cg->nr);
|
|||
* Start a new program.
|
||||
* - if foo is NULL (and conn isn't), start a subprogram.
|
||||
*/
|
||||
|
||||
char *
|
||||
runprog (cf cfr, struct conninfo **rconn, conngrab *foo)
|
||||
{
|
||||
|
@ -778,7 +801,7 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo)
|
|||
if(conn->cg->protocol != NULL)
|
||||
putenv2 ("PROTOCOL", conn->cg->protocol);
|
||||
if(conn->cg->cclass != NULL)
|
||||
putenv2 ("CLASS", conn->cg->cclass);
|
||||
putenv2 ("CLASS", strippat(conn->cg->cclass));
|
||||
if(conn->cg->nr != NULL)
|
||||
putenv2 ("PHONE", conn->cg->nr);
|
||||
if(conn->cg->lnr != NULL)
|
||||
|
@ -824,7 +847,7 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo)
|
|||
else
|
||||
(*arg)++;
|
||||
alarm(0);
|
||||
execv (ap, arg);
|
||||
execvp (ap, arg);
|
||||
syslog (LOG_ERR, "Could not execute %s for %s/%s: %m", *arg,cg->site,cg->protocol);
|
||||
if (cfr != NULL && cg != NULL)
|
||||
write (pip[1], "EXEC", 4);
|
||||
|
@ -894,9 +917,6 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo)
|
|||
syslog (LOG_INFO, "exec %x:%x %d %s/%s %s", dev, dev2, pid, cfr->site,cfr->protocol, cfr->args);
|
||||
printf ("* PID %d\n", pid);
|
||||
|
||||
if (conn != NULL) {
|
||||
}
|
||||
|
||||
if(prog != NULL) {
|
||||
prog->next = conn->run;
|
||||
conn->run = prog;
|
||||
|
@ -916,7 +936,7 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo)
|
|||
m_puti (&yy, conn->minor);
|
||||
xlen = yy.b_wptr - yy.b_rptr;
|
||||
DUMPW (yy.b_rptr, xlen);
|
||||
(void) strwrite (xs_mon, (uchar_t *) yy.b_rptr, &xlen, 1);
|
||||
(void) strwrite (xs_mon, (uchar_t *) yy.b_rptr, xlen, 1);
|
||||
yy.b_wptr = yy.b_rptr;
|
||||
|
||||
if (conn->fminor != 0 && conn->fminor != conn->minor) {
|
||||
|
@ -925,7 +945,7 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo)
|
|||
m_puti (&yy, conn->fminor);
|
||||
xlen = yy.b_wptr - yy.b_rptr;
|
||||
DUMPW (yy.b_rptr, xlen);
|
||||
(void) strwrite (xs_mon, (uchar_t *) yy.b_rptr, &xlen, 1);
|
||||
(void) strwrite (xs_mon, (uchar_t *) yy.b_rptr, xlen, 1);
|
||||
yy.b_wptr = yy.b_rptr;
|
||||
}
|
||||
m_putid (&yy, CMD_PROT);
|
||||
|
@ -943,7 +963,7 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo)
|
|||
|
||||
xlen = yy.b_wptr - yy.b_rptr;
|
||||
DUMPW (yy.b_rptr, xlen);
|
||||
(void) strwrite (xs_mon, (uchar_t *) yy.b_rptr, &xlen, 1);
|
||||
(void) strwrite (xs_mon, (uchar_t *) yy.b_rptr, xlen, 1);
|
||||
yy.b_wptr = yy.b_rptr;
|
||||
|
||||
if(conn->fminor != 0 && conn->fminor != conn->minor) {
|
||||
|
@ -957,11 +977,13 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo)
|
|||
m_putsx (&yy, PROTO_ONLINE);
|
||||
xlen = yy.b_wptr - yy.b_rptr;
|
||||
DUMPW (yy.b_rptr, xlen);
|
||||
(void) strwrite (xs_mon, (uchar_t *) yy.b_rptr, &xlen, 1);
|
||||
(void) strwrite (xs_mon, (uchar_t *) yy.b_rptr, xlen, 1);
|
||||
yy.b_wptr = yy.b_rptr;
|
||||
}
|
||||
|
||||
if(cg != NULL && (cg->flags & (F_INCOMING|F_OUTGOING))) {
|
||||
char *msg = NULL;
|
||||
|
||||
cg->refs++;
|
||||
dropgrab(conn->cg);
|
||||
conn->cg = cg;
|
||||
|
@ -973,10 +995,10 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo)
|
|||
else
|
||||
cg->delay = 0;
|
||||
}
|
||||
if(startconn(conn->cg,0,0, NULL) == conn)
|
||||
if(startconn(conn->cg,0,0, &msg) == conn)
|
||||
setconnstate(conn,c_going_up);
|
||||
else {
|
||||
syslog(LOG_CRIT,"Bug in runprog->startconn for %s:%s",cg->site,cg->protocol);
|
||||
syslog(LOG_CRIT,"Bug in runprog->startconn (%s) for %s:%s",msg ? msg : "(unknown reason)", cg->site,cg->protocol);
|
||||
dropgrab(conn->cg);
|
||||
conn->cg = NULL;
|
||||
chkone(conn);
|
||||
|
@ -990,7 +1012,7 @@ printf("NoProtoEnable NotPushprot\n");
|
|||
m_puti (&yy, conn->minor);
|
||||
xlen = yy.b_wptr - yy.b_rptr;
|
||||
DUMPW (yy.b_rptr, xlen);
|
||||
(void) strwrite (xs_mon, (uchar_t *) yy.b_rptr, &xlen, 1);
|
||||
(void) strwrite (xs_mon, (uchar_t *) yy.b_rptr, xlen, 1);
|
||||
conn->minor = 0;
|
||||
if(conn->pid == 0)
|
||||
dropconn(conn);
|
||||
|
@ -1006,7 +1028,7 @@ printf("NoProtoEnable NotPushprot\n");
|
|||
m_putid(&yy,PROTO_ENABLE);
|
||||
xlen = yy.b_wptr - yy.b_rptr;
|
||||
DUMPW (yy.b_rptr, xlen);
|
||||
(void) strwrite (xs_mon, (uchar_t *) yy.b_rptr, &xlen, 1);
|
||||
(void) strwrite (xs_mon, (uchar_t *) yy.b_rptr, xlen, 1);
|
||||
}
|
||||
else printf("NoProtoEnable NotPermanent\n");
|
||||
cg->card = str_enter("*"); /* cosmetic */
|
||||
|
@ -1021,6 +1043,8 @@ else printf("NoProtoEnable NotPermanent\n");
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Kill applicable subprograms */
|
||||
void
|
||||
kill_rp(struct conninfo *conn, char whatnot)
|
||||
{
|
||||
|
@ -1053,6 +1077,7 @@ kill_rp(struct conninfo *conn, char whatnot)
|
|||
}
|
||||
}
|
||||
|
||||
/* Start applicable subprograms. */
|
||||
void
|
||||
run_rp(struct conninfo *conn, char what)
|
||||
{
|
||||
|
@ -1099,6 +1124,8 @@ run_rp(struct conninfo *conn, char what)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Find the next program to run */
|
||||
void
|
||||
run_now(void *nix)
|
||||
{
|
||||
|
@ -1184,6 +1211,8 @@ printf("exist %s:%s\n",conn->cg->site,conn->cg->protocol);
|
|||
do_run_now = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Any programs still running? */
|
||||
int
|
||||
has_progs(void)
|
||||
{
|
||||
|
@ -1201,6 +1230,7 @@ has_progs(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Kill one program / all programs */
|
||||
void
|
||||
kill_progs(struct conninfo *xconn)
|
||||
{
|
||||
|
@ -1227,7 +1257,7 @@ kill_progs(struct conninfo *xconn)
|
|||
|
||||
xlen = mb->b_wptr - mb->b_rptr;
|
||||
DUMPW (mb->b_rptr, xlen);
|
||||
(void) strwrite (xs_mon, mb->b_rptr, &xlen, 1);
|
||||
(void) strwrite (xs_mon, mb->b_rptr, xlen, 1);
|
||||
freemsg(mb);
|
||||
conn->minor = 0;
|
||||
if(xconn != NULL)
|
||||
|
|
|
@ -1,54 +1,4 @@
|
|||
SHELL = /bin/sh
|
||||
MAKE = make
|
||||
## =()<P = @<P>@>()=
|
||||
P =
|
||||
|
||||
## =()<CC = @<CC>@>()=
|
||||
CC = gcc
|
||||
## =()<DEFS = @<DEFKERNEL>@ @<KERNEL>@ -I../include >()=
|
||||
DEFS = -I../streams -I../compat -I/usr/src/linux/include -fomit-frame-pointer -DKERNEL -D__KERNEL__ -DMODULE -DCONFIG_MODVERSIONS -I../include
|
||||
## =()<CFLAGS = @<CFLAGS>@ $(DEFS)>()=
|
||||
CFLAGS = -O2 -Wall $(DEFS)
|
||||
|
||||
## =()<SYS = @<SYS>@>()=
|
||||
SYS = linux
|
||||
|
||||
SOURCES = count.c dump.c log.c logh.c proto.c qinfo.c smallq.c streamlib.c x75lib.c
|
||||
OBJ = count.o dump.o log.o logh.o proto.o qinfo.o smallq.o streamlib.o x75lib.o
|
||||
ALL =
|
||||
|
||||
all: $(OBJ) $(ALL)
|
||||
|
||||
lib:
|
||||
|
||||
install: all
|
||||
@sh ../iftrue.sh "-d $(SYS)" "cd $(SYS); make"
|
||||
|
||||
update: all
|
||||
@sh ../iftrue.sh "-d $(SYS)" "cd $(SYS); make update"
|
||||
|
||||
indent:
|
||||
../indent.sh $(SOURCES)
|
||||
|
||||
clean:
|
||||
rm -f $(ALL) $(OBJ)
|
||||
@sh ../iftrue.sh "-d $(SYS)" "cd $(SYS); make clean"
|
||||
|
||||
depend: Makefile $(SOURCES)
|
||||
$(CC) -M $(DEFS) $(SOURCES) > .depend
|
||||
|
||||
load:
|
||||
insmod streamlib.o
|
||||
insmod smallq.o
|
||||
insmod dump.o
|
||||
insmod log.o
|
||||
insmod logh.o
|
||||
insmod count.o
|
||||
insmod proto.o
|
||||
insmod qinfo.o
|
||||
insmod x75lib.o
|
||||
|
||||
ifeq (.depend,$(wildcard .depend))
|
||||
include .depend
|
||||
endif
|
||||
KERNEL=1
|
||||
|
||||
TOPDIR=..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
|
132
ksupport/dump.c
132
ksupport/dump.c
|
@ -1,5 +1,6 @@
|
|||
#include "f_module.h"
|
||||
#include "primitives.h"
|
||||
#include "kernel.h"
|
||||
#include "isdn_23.h"
|
||||
#ifdef KERNEL
|
||||
#define putchar(x) printf("%c",(x))
|
||||
|
@ -174,113 +175,146 @@ conv_ind (unsigned char xx)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
dump_hdr (isdn23_hdr hdr, const char *what, uchar_t * data)
|
||||
static void
|
||||
dump_one_hdr (isdn23_hdr hdr)
|
||||
{
|
||||
#define DUMP() do { dumpaschex(data,hdr->hdr_data.len); printf("\n");} while(0)
|
||||
|
||||
if(what != NULL)
|
||||
printf (" %s: ", what);
|
||||
|
||||
printf("=%x_",hdr->seqnum);
|
||||
if(hdr->key & HDR_NOERROR)
|
||||
printf("NoErr:");
|
||||
printf("NoErr_");
|
||||
switch (hdr->key & ~HDR_FLAGS) {
|
||||
default:
|
||||
#ifdef KERNEL
|
||||
printf("??? Unknown header ID %d\n",hdr->key);
|
||||
break;
|
||||
#else
|
||||
syslog (LOG_ERR, "Unknown header ID %d", hdr->key);
|
||||
abort ();
|
||||
printf("Unknown header ID %d", hdr->key);
|
||||
#endif
|
||||
break;
|
||||
case HDR_ATCMD:
|
||||
printf ("AT Cmd from %d: ", hdr->hdr_atcmd.minor);
|
||||
if(data != NULL)
|
||||
dumpascii (data, hdr->hdr_data.len);
|
||||
printf ("\n");
|
||||
printf ("ATcmd from %d", hdr->hdr_atcmd.minor);
|
||||
break;
|
||||
case HDR_PROTOCMD:
|
||||
printf ("Protocol Cmd from %d: ", hdr->hdr_atcmd.minor);
|
||||
if(data != NULL)
|
||||
dumpascii (data, hdr->hdr_data.len);
|
||||
printf ("\n");
|
||||
printf ("ProtocolCmd from %d", hdr->hdr_atcmd.minor);
|
||||
break;
|
||||
case HDR_XDATA:
|
||||
printf ("XData from %d:\n ", hdr->hdr_xdata.minor);
|
||||
if(data != NULL)
|
||||
DUMP ();
|
||||
printf ("XData from %d", hdr->hdr_xdata.minor);
|
||||
break;
|
||||
case HDR_DATA:
|
||||
printf ("I Data from %d/%02x\n ", hdr->hdr_data.card, hdr->hdr_data.SAPI);
|
||||
if(data != NULL)
|
||||
DUMP ();
|
||||
printf ("Idata from %d/%02x", hdr->hdr_data.card, hdr->hdr_data.SAPI);
|
||||
break;
|
||||
case HDR_UIDATA:
|
||||
printf ("UI Data from %d/%02x\n ", hdr->hdr_data.card, hdr->hdr_data.SAPI);
|
||||
if(data != NULL)
|
||||
DUMP ();
|
||||
printf ("UIdata from %d/%02x", hdr->hdr_data.card, hdr->hdr_data.SAPI);
|
||||
break;
|
||||
case HDR_RAWDATA:
|
||||
printf ("Raw Data from %d\n ", hdr->hdr_data.card);
|
||||
if(data != NULL)
|
||||
DUMP ();
|
||||
printf ("RawData from %d", hdr->hdr_data.card);
|
||||
break;
|
||||
case HDR_LOAD:
|
||||
printf("Boot from %d, stage %d, offset %d\n",hdr->hdr_load.card,hdr->hdr_load.seqnum,hdr->hdr_load.foffset);
|
||||
if(data != NULL)
|
||||
DUMP ();
|
||||
printf("Boot from %d, stage %d, offset %d len %d",hdr->hdr_load.card,hdr->hdr_load.seqnum,hdr->hdr_load.foffset,hdr->hdr_load.len);
|
||||
break;
|
||||
case HDR_TEI:
|
||||
printf ("TEI: card %d, TEI %d\n", hdr->hdr_tei.card, hdr->hdr_tei.TEI);
|
||||
printf ("TEI card %d, TEI %d", hdr->hdr_tei.card, hdr->hdr_tei.TEI);
|
||||
break;
|
||||
case HDR_OPEN:
|
||||
printf ("Open port %d, flags %o\n", hdr->hdr_open.minor, hdr->hdr_open.flags);
|
||||
printf ("Open port %d, flags %o", hdr->hdr_open.minor, hdr->hdr_open.flags);
|
||||
break;
|
||||
case HDR_CLOSE:
|
||||
printf ("Close port %d, errno %d\n", hdr->hdr_close.minor, hdr->hdr_close.error);
|
||||
printf ("Close port %d, errno %d", hdr->hdr_close.minor, hdr->hdr_close.error);
|
||||
break;
|
||||
case HDR_ATTACH:
|
||||
printf ("Attach chan %d/%d to port %d, mode %d, %s%s\n",
|
||||
printf ("Attach chan %d/%d to port %d, mode %d, %s%s",
|
||||
hdr->hdr_attach.card, hdr->hdr_attach.chan, hdr->hdr_attach.minor,
|
||||
hdr->hdr_attach.mode, (hdr->hdr_attach.listen & 1) ? "listen" : "talk",
|
||||
(hdr->hdr_attach.listen & 2) ? " force" : "");
|
||||
break;
|
||||
case HDR_DETACH:
|
||||
printf ("Detach port %d, errno %d, force %d\n", hdr->hdr_detach.minor,
|
||||
printf ("Detach port %d, errno %d, force %d", hdr->hdr_detach.minor,
|
||||
hdr->hdr_detach.error,hdr->hdr_detach.perm);
|
||||
break;
|
||||
case HDR_CARD:
|
||||
printf ("Card %d online (%d B channels, flag 0%o)\n", hdr->hdr_card.card, hdr->hdr_card.bchans,hdr->hdr_card.flags);
|
||||
printf ("Card %d online (%d B channels, flag 0%o)", hdr->hdr_card.card, hdr->hdr_card.bchans,hdr->hdr_card.flags);
|
||||
break;
|
||||
case HDR_NOCARD:
|
||||
printf ("Card %d offline.\n", hdr->hdr_nocard.card);
|
||||
printf ("Card %d offline.", hdr->hdr_nocard.card);
|
||||
break;
|
||||
case HDR_OPENPROT:
|
||||
printf ("OpenProtocol %d/%02x, Ind %s\n", hdr->hdr_openprot.card, hdr->hdr_openprot.SAPI, conv_ind(hdr->hdr_openprot.ind));
|
||||
printf ("OpenProtocol %d/%02x, Ind %s", hdr->hdr_openprot.card, hdr->hdr_openprot.SAPI, conv_ind(hdr->hdr_openprot.ind));
|
||||
break;
|
||||
case HDR_CLOSEPROT:
|
||||
printf ("CloseProtocol %d/%02x, Ind %s\n", hdr->hdr_closeprot.card, hdr->hdr_closeprot.SAPI, conv_ind(hdr->hdr_closeprot.ind));
|
||||
printf ("CloseProtocol %d/%02x, Ind %s", hdr->hdr_closeprot.card, hdr->hdr_closeprot.SAPI, conv_ind(hdr->hdr_closeprot.ind));
|
||||
break;
|
||||
case HDR_NOTIFY:
|
||||
printf ("State Change %d/%02x, Ind %s:%x\n", hdr->hdr_notify.card, hdr->hdr_notify.SAPI, conv_ind(hdr->hdr_notify.ind), hdr->hdr_notify.add);
|
||||
printf ("State Change %d/%02x, Ind %s:%x", hdr->hdr_notify.card, hdr->hdr_notify.SAPI, conv_ind(hdr->hdr_notify.ind), hdr->hdr_notify.add);
|
||||
break;
|
||||
case HDR_INVAL:
|
||||
#ifdef KERNEL
|
||||
if(hdr->hdr_inval.error != 0)
|
||||
printf ("Invalid header, errno %d\n ", hdr->hdr_inval.error);
|
||||
printf ("Error %d", hdr->hdr_inval.error);
|
||||
else
|
||||
printf ("Command OK:\n ");
|
||||
printf ("Command OK");
|
||||
#else
|
||||
if(hdr->hdr_inval.error != 0)
|
||||
printf ("Invalid header: %s\n ", strerror(hdr->hdr_inval.error));
|
||||
printf ("Error %s", strerror(hdr->hdr_inval.error));
|
||||
else
|
||||
printf ("Command OK:\n ");
|
||||
printf ("Command OK");
|
||||
#endif
|
||||
if(data != NULL)
|
||||
dumphex (data, sizeof (struct _isdn23_hdr));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
dump_hdr (isdn23_hdr hdr, const char *what, uchar_t * data)
|
||||
{
|
||||
if(what != NULL)
|
||||
printf (" %s: ", what);
|
||||
|
||||
dump_one_hdr(hdr);
|
||||
switch (hdr->key & ~HDR_FLAGS) {
|
||||
default:
|
||||
dumpaschex((uchar_t *)hdr,sizeof(*hdr));
|
||||
printf("\n");
|
||||
#ifndef KERNEL
|
||||
abort();
|
||||
#endif
|
||||
break;
|
||||
case HDR_ATCMD:
|
||||
case HDR_PROTOCMD:
|
||||
case HDR_XDATA:
|
||||
if(data != NULL) {
|
||||
printf (": ");
|
||||
dumpascii (data, hdr->hdr_data.len);
|
||||
}
|
||||
printf ("\n");
|
||||
break;
|
||||
case HDR_DATA:
|
||||
case HDR_UIDATA:
|
||||
case HDR_RAWDATA:
|
||||
if(data != NULL) {
|
||||
printf (": ");
|
||||
dumphex (data, hdr->hdr_data.len);
|
||||
}
|
||||
printf("\n");
|
||||
break;
|
||||
case HDR_LOAD:
|
||||
case HDR_TEI:
|
||||
case HDR_OPEN:
|
||||
case HDR_CLOSE:
|
||||
case HDR_ATTACH:
|
||||
case HDR_DETACH:
|
||||
case HDR_CARD:
|
||||
case HDR_NOCARD:
|
||||
case HDR_OPENPROT:
|
||||
case HDR_CLOSEPROT:
|
||||
case HDR_NOTIFY:
|
||||
printf("\n");
|
||||
break;
|
||||
case HDR_INVAL:
|
||||
printf(" <");
|
||||
if(data != NULL)
|
||||
dump_one_hdr ((isdn23_hdr) data);
|
||||
else
|
||||
dump_one_hdr(hdr+1);
|
||||
printf (">\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,9 +27,7 @@
|
|||
#endif
|
||||
#endif
|
||||
#include <netinet/tcp.h>
|
||||
#ifndef KERNEL
|
||||
#include "kernel.h"
|
||||
#endif
|
||||
|
||||
#define MAXB 100
|
||||
|
||||
|
@ -88,7 +86,7 @@ log_open (queue_t * q, dev_t dev, int flag, int sflag ERR_DECL)
|
|||
log->flags = LOG_INUSE | LOG_READ | LOG_WRITE;
|
||||
log->nr = nr++;
|
||||
if (1)
|
||||
printf (KERN_DEBUG "Log driver %d opened.\n", log->nr);
|
||||
printf ("%sLog driver %d opened.\n", KERN_DEBUG,log->nr);
|
||||
MORE_USE;
|
||||
|
||||
return 0;
|
||||
|
@ -100,16 +98,21 @@ log_printmsg (void *xlog, const char *text, mblk_t * mp, const char *prefix)
|
|||
{
|
||||
struct _log *log = (struct _log *)xlog;
|
||||
/* int ms = splstr (); */
|
||||
static char pprefix[100];
|
||||
|
||||
if(prefix != NULL)
|
||||
printf("%s",prefix);
|
||||
if(prefix != NULL) {
|
||||
strcpy(pprefix,prefix);
|
||||
printf("%s",pprefix);
|
||||
} else
|
||||
*pprefix = '\0';
|
||||
if (log != NULL)
|
||||
printf ("Log %d: ", log->nr);
|
||||
#if defined(linux) && defined(KERNEL)
|
||||
printf("%ld ",jiffies);
|
||||
#endif
|
||||
if(text != NULL)
|
||||
printf ("%s", text);
|
||||
#ifdef KERNEL
|
||||
#ifdef CONFIG_DEBUG_STREAMS
|
||||
if(msgdsize(mp) < 0)
|
||||
return;
|
||||
#endif
|
||||
|
@ -255,12 +258,6 @@ log_printmsg (void *xlog, const char *text, mblk_t * mp, const char *prefix)
|
|||
}
|
||||
}
|
||||
printf ("\n");
|
||||
#ifdef KERNEL
|
||||
if(msgdsize(mp) < 0)
|
||||
return;
|
||||
#else
|
||||
if(msgdsize(mp) < 100)
|
||||
#endif
|
||||
{
|
||||
int j;
|
||||
mblk_t *mp1;
|
||||
|
@ -275,9 +272,18 @@ log_printmsg (void *xlog, const char *text, mblk_t * mp, const char *prefix)
|
|||
int k;
|
||||
int l = (uchar_t *) mp1->b_wptr - dp;
|
||||
|
||||
printf ("%s ",prefix?prefix:"");
|
||||
printf ("%s%03x ",pprefix,i);
|
||||
#ifdef KERNEL
|
||||
if(i >= 3*BLOCKSIZE && l > 4*BLOCKSIZE) { /* Skip the stuff in the middle */
|
||||
l -= 3*BLOCKSIZE + (l % BLOCKSIZE);
|
||||
printf("[... %d bytes (0x%x) skipped ...]\n",l,l);
|
||||
dp += l;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
for (k = 0; k < BLOCKSIZE && k < l; k++)
|
||||
printf ("%c%c ", ctab[dp[k] >> 4], ctab[dp[k] & 0x0F]);
|
||||
i += k;
|
||||
for (; k < BLOCKSIZE; k++)
|
||||
printf (" ");
|
||||
printf (" : ");
|
||||
|
@ -363,7 +369,7 @@ log_close (queue_t * q, int dummy)
|
|||
flushq (q, FLUSHALL);
|
||||
flushq (WR (q), FLUSHALL);
|
||||
if(1)
|
||||
printf (KERN_DEBUG "Log driver %d closed.\n", log->nr);
|
||||
printf ("%sLog driver %d closed.\n", KERN_DEBUG,log->nr);
|
||||
free(log);
|
||||
LESS_USE;
|
||||
return;
|
||||
|
|
|
@ -11,9 +11,7 @@
|
|||
#include <sys/stropts.h>
|
||||
#include "streamlib.h"
|
||||
#include "isdn_23.h"
|
||||
#ifndef KERNEL
|
||||
#include "kernel.h"
|
||||
#endif
|
||||
|
||||
#define MAXB 10
|
||||
|
||||
|
@ -65,7 +63,7 @@ logh_open (queue_t * q, dev_t dev, int flag, int sflag ERR_DECL)
|
|||
q->q_ptr = (char *) log;
|
||||
|
||||
log->flags = LOG_INUSE | LOG_READ | LOG_WRITE;
|
||||
printf ("Log driver %d opened.\n", nr);
|
||||
printf ("%sLog driver %d opened.\n",KERN_DEBUG, nr);
|
||||
log->nr = nr++;
|
||||
MORE_USE;
|
||||
|
||||
|
@ -79,9 +77,9 @@ logh_printmsg (void *xlog, const char *text, mblk_t * mp)
|
|||
struct _log *log = (struct _log *)xlog;
|
||||
|
||||
if (log != NULL)
|
||||
printf ("* * ");
|
||||
printf ("%s* * ",KERN_DEBUG);
|
||||
else
|
||||
printf ("** ");
|
||||
printf ("%s** ",KERN_DEBUG);
|
||||
|
||||
if ((DATA_TYPE(mp) == M_DATA)
|
||||
#ifdef M_EXDATA
|
||||
|
@ -108,17 +106,16 @@ logh_printmsg (void *xlog, const char *text, mblk_t * mp)
|
|||
printf ("DupNull\n");
|
||||
break;
|
||||
}
|
||||
mn = pullupm (mm, sizeof(struct _isdn23_hdr));
|
||||
mn = pullupm (mm, -1);
|
||||
if (mn == NULL) {
|
||||
printf ("NoPullup\n");
|
||||
freemsg (mm);
|
||||
break;
|
||||
}
|
||||
dump_hdr ((isdn23_hdr) mn->b_rptr, text, NULL);
|
||||
dump_hdr ((isdn23_hdr) mn->b_rptr, text, mn->b_rptr+sizeof(struct _isdn23_hdr));
|
||||
|
||||
freemsg (mn);
|
||||
} while(0);
|
||||
log_printmsg (NULL, text, mp, KERN_DEBUG);
|
||||
splx (ms);
|
||||
}
|
||||
|
||||
|
@ -170,7 +167,7 @@ logh_close (queue_t * q, int dummy)
|
|||
|
||||
flushq (q, FLUSHALL);
|
||||
flushq (WR (q), FLUSHALL);
|
||||
printf ("LogH driver %d closed.\n", log->nr);
|
||||
printf ("%sLogH driver %d closed.\n",KERN_DEBUG, log->nr);
|
||||
free(log);
|
||||
LESS_USE;
|
||||
return;
|
||||
|
|
|
@ -81,7 +81,7 @@ static void setmode(struct _proto *proto, enum Pmode mode)
|
|||
case P_LISTEN : x = "listen" ; break;
|
||||
case P_CONN : x = "connect"; break;
|
||||
}
|
||||
if(proto->mode != mode) printf("Switch mode to %s, talk %d\n",x,proto->talker);
|
||||
if(proto->mode != mode) printf("%sSwitch mode to %s, talk %d\n",KERN_DEBUG,x,proto->talker);
|
||||
proto->mode = mode;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ proto_open (queue_t * q, dev_t dev, int flag, int sflag ERR_DECL)
|
|||
|
||||
if (q->q_ptr) {
|
||||
if (0)
|
||||
printf ("Protocol: already open?\n");
|
||||
printf ("%sProtocol: already open?\n",KERN_DEBUG);
|
||||
return 0;
|
||||
}
|
||||
proto = malloc(sizeof(*proto));
|
||||
|
@ -133,7 +133,7 @@ static void mm_reply (struct _proto *proto, queue_t * q, mblk_t * mp, int err)
|
|||
mblk_t *mq = allocb (err ? 17 : 9, BPRI_HI);
|
||||
|
||||
if (mq == NULL) {
|
||||
printf("* NoMem m_reply %d\n",err);
|
||||
printf("%s* NoMem m_reply %d\n",KERN_DEBUG,err);
|
||||
freemsg (mq);
|
||||
return;
|
||||
}
|
||||
|
@ -722,7 +722,7 @@ proto_wsrv (queue_t * q)
|
|||
int realq = 1;
|
||||
|
||||
while ((mp = getq (q)) != NULL || (realq = 0) || (mp = S_dequeue(&proto->write_delay)) != NULL) {
|
||||
if(!realq)printf("FromDel %p\n", &proto->write_delay);
|
||||
if(!realq)printf("%sFromDel %p\n",KERN_DEBUG, &proto->write_delay);
|
||||
switch (DATA_TYPE(mp)) {
|
||||
case MSG_PROTO:
|
||||
freemsg (mp);
|
||||
|
@ -900,7 +900,7 @@ if(!realq)printf("FromDel %p\n", &proto->write_delay);
|
|||
|
||||
iocb = (struct iocblk *) mp->b_rptr;
|
||||
|
||||
if(0)printf("Proto IOC %x\n",iocb->ioc_cmd);
|
||||
if(0)printf("%sProto IOC %x\n",KERN_DEBUG,iocb->ioc_cmd);
|
||||
switch (iocb->ioc_cmd) {
|
||||
#if 1 /* ndef linux */
|
||||
#ifdef TCGETA
|
||||
|
@ -1046,7 +1046,7 @@ if(!realq)printf("FromDel %p\n", &proto->write_delay);
|
|||
int ms;
|
||||
|
||||
if (mp->b_cont == NULL || iocb->ioc_count != sizeof (struct termios)) {
|
||||
printf("termios: want %d, got %d\n",sizeof(struct termios),iocb->ioc_count);
|
||||
printf("%stermios: want %d, got %d\n",KERN_DEBUG,sizeof(struct termios),iocb->ioc_count);
|
||||
goto iocnak;
|
||||
}
|
||||
ms = splstr ();
|
||||
|
@ -1214,7 +1214,7 @@ proto_close (queue_t * q, int dummy)
|
|||
|
||||
flushq (q, FLUSHALL);
|
||||
flushq (WR (q), FLUSHALL);
|
||||
if(0)printf("FlushDel %p\n", &proto->write_delay);
|
||||
if(0)printf("%sFlushDel %p\n",KERN_DEBUG, &proto->write_delay);
|
||||
S_flush (&proto->write_delay);
|
||||
|
||||
proto->qptr = NULL;
|
||||
|
|
|
@ -176,7 +176,7 @@ mblk_t *pullupm(mblk_t *p_msg, short length)
|
|||
return NULL;
|
||||
|
||||
#ifdef CONFIG_DEBUG_STREAMS
|
||||
if(msgdsize(p_msg) < 0)
|
||||
if(deb_msgdsize(deb_file,deb_line,p_msg) < 0)
|
||||
return NULL;
|
||||
#endif
|
||||
while(p_msg != NULL && p_msg->b_rptr >= p_msg->b_wptr && p_msg->b_cont != NULL) {
|
||||
|
@ -270,7 +270,7 @@ putbqf (queue_t * q, mblk_t * mp)
|
|||
qflag = q->q_flag;
|
||||
q->q_flag |= QENAB;
|
||||
#ifdef CONFIG_DEBUG_STREAMS
|
||||
if(0)printf(KERN_DEBUG "PutBQF %p:%p at %s:%d\n",q,mp,deb_file,deb_line);
|
||||
if(0)printf("%sPutBQF %p:%p at %s:%d\n",KERN_DEBUG,q,mp,deb_file,deb_line);
|
||||
deb_putbq (deb_file,deb_line, q, mp);
|
||||
#else
|
||||
putbq (q, mp);
|
||||
|
@ -652,12 +652,21 @@ m_putx (mblk_t * mb, ulong_t id)
|
|||
|
||||
|
||||
|
||||
void
|
||||
m_getnskip (mblk_t * mb)
|
||||
{
|
||||
if (mb == NULL)
|
||||
return;
|
||||
while ((mb->b_rptr < mb->b_wptr) && !isspace (*mb->b_rptr))
|
||||
mb->b_rptr++;
|
||||
}
|
||||
|
||||
void
|
||||
m_getskip (mblk_t * mb)
|
||||
{
|
||||
if (mb == NULL)
|
||||
return;
|
||||
while (mb->b_rptr < mb->b_wptr && isspace (*mb->b_rptr))
|
||||
while ((mb->b_rptr < mb->b_wptr) && isspace (*mb->b_rptr))
|
||||
mb->b_rptr++;
|
||||
}
|
||||
|
||||
|
@ -670,12 +679,12 @@ m_getid (mblk_t * mb, ushort_t * id)
|
|||
#endif
|
||||
|
||||
if (mb == NULL)
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
m_getskip (mb);
|
||||
while (mb->b_rptr < mb->b_wptr && *mb->b_rptr == ':')
|
||||
mb->b_rptr++;
|
||||
if (mb->b_rptr + sizeof(ushort_t) > mb->b_wptr)
|
||||
return ESRCH;
|
||||
return -ESRCH;
|
||||
#ifdef ALIGNED_ONLY
|
||||
for (i = 0; i < sizeof(ushort_t); i++)
|
||||
xid = xid << 8 | (*mb->b_rptr++ & 0xFF);
|
||||
|
@ -695,23 +704,23 @@ m_getsx (mblk_t * mb, ushort_t * id)
|
|||
#endif
|
||||
|
||||
if (mb == NULL)
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
while (1) {
|
||||
m_getskip (mb);
|
||||
if (mb->b_rptr + sizeof(ushort_t) >= mb->b_wptr)
|
||||
return ESRCH;
|
||||
if (mb->b_rptr >= mb->b_wptr)
|
||||
return -ESRCH;
|
||||
if (*mb->b_rptr == ':') {
|
||||
mb->b_rptr++;
|
||||
break;
|
||||
} else {
|
||||
while (mb->b_rptr + 2 < mb->b_wptr && *mb->b_rptr != ' ')
|
||||
mb->b_rptr++;
|
||||
}
|
||||
m_getnskip(mb);
|
||||
}
|
||||
if (*mb->b_rptr == ':') {
|
||||
mb->b_rptr++;
|
||||
return EAGAIN;
|
||||
return -EAGAIN;
|
||||
}
|
||||
if (mb->b_rptr + sizeof(ushort_t) > mb->b_wptr)
|
||||
return -ESRCH;
|
||||
#ifdef ALIGNED_ONLY
|
||||
for (i = 0; i < sizeof(ushort_t); i++)
|
||||
xid = (xid << 8) | (*mb->b_rptr++ & 0xFF);
|
||||
|
@ -731,12 +740,12 @@ m_getlx (mblk_t * mb, ulong_t * id)
|
|||
#endif
|
||||
|
||||
if (mb == NULL)
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
m_getskip (mb);
|
||||
if (*mb->b_rptr == ':')
|
||||
return ENOENT;
|
||||
return -ENOENT;
|
||||
if (mb->b_rptr + sizeof(ulong_t) > mb->b_wptr)
|
||||
return ESRCH;
|
||||
return -ESRCH;
|
||||
#ifdef ALIGNED_ONLY
|
||||
for (i = 0; i < sizeof(ulong_t); i++)
|
||||
xid = (xid << 8) | (*mb->b_rptr++ & 0xFF);
|
||||
|
@ -755,22 +764,22 @@ m_geti (mblk_t * mb, long *id)
|
|||
streamchar *oldp;
|
||||
|
||||
if (mb == NULL)
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
m_getskip (mb);
|
||||
if (mb->b_rptr >= mb->b_wptr)
|
||||
return ESRCH;
|
||||
return -ESRCH;
|
||||
if (*mb->b_rptr == '-') {
|
||||
neg = 1;
|
||||
if (++mb->b_rptr >= mb->b_wptr)
|
||||
return ESRCH;
|
||||
return -ESRCH;
|
||||
}
|
||||
oldp = mb->b_rptr;
|
||||
if (*oldp == ':')
|
||||
return ENOENT;
|
||||
return -ENOENT;
|
||||
while ((mb->b_rptr < mb->b_wptr) && (*mb->b_rptr >= '0' && *mb->b_rptr <= '9'))
|
||||
x = x * 10 + *mb->b_rptr++ - '0';
|
||||
if (oldp == mb->b_rptr)
|
||||
return ESRCH;
|
||||
return -ESRCH;
|
||||
if (neg)
|
||||
*id = -x;
|
||||
else
|
||||
|
@ -787,14 +796,14 @@ m_getx (mblk_t * mb, ulong_t * id)
|
|||
char ch;
|
||||
|
||||
if (mb == NULL)
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
m_getskip (mb);
|
||||
if (mb->b_rptr >= mb->b_wptr)
|
||||
return ESRCH;
|
||||
return -ESRCH;
|
||||
|
||||
oldp = mb->b_rptr;
|
||||
if (*oldp == ':')
|
||||
return ENOENT;
|
||||
return -ENOENT;
|
||||
while (ch = *mb->b_rptr, ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f'))) {
|
||||
if (ch <= '9')
|
||||
ch -= '0';
|
||||
|
@ -808,7 +817,7 @@ m_getx (mblk_t * mb, ulong_t * id)
|
|||
break;
|
||||
}
|
||||
if (oldp == mb->b_rptr)
|
||||
return ESRCH;
|
||||
return -ESRCH;
|
||||
*id = x;
|
||||
return 0;
|
||||
}
|
||||
|
@ -821,16 +830,16 @@ m_gethex (mblk_t * mb, uchar_t * id, int len)
|
|||
char upper = 1;
|
||||
|
||||
if (mb == NULL)
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
m_getskip (mb);
|
||||
if (mb->b_rptr >= mb->b_wptr)
|
||||
return 0;
|
||||
|
||||
if (*mb->b_rptr == ':')
|
||||
return ENOENT;
|
||||
return -ENOENT;
|
||||
while (len > 0) {
|
||||
if (mb->b_rptr >= mb->b_wptr)
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
ch = *mb->b_rptr++;
|
||||
switch(ch)
|
||||
{
|
||||
|
@ -903,14 +912,14 @@ m_getstr (mblk_t * mb, char *str, int maxlen)
|
|||
streamchar *lim;
|
||||
|
||||
if (mb == NULL)
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
m_getskip (mb);
|
||||
if (mb->b_rptr >= mb->b_wptr)
|
||||
return ESRCH;
|
||||
return -ESRCH;
|
||||
|
||||
p = mb->b_rptr;
|
||||
if (*p == ':')
|
||||
return ENOENT;
|
||||
return -ENOENT;
|
||||
lim = mb->b_wptr;
|
||||
while (!isspace (*p)) {
|
||||
if (maxlen == 0 || p == lim)
|
||||
|
@ -924,28 +933,54 @@ m_getstr (mblk_t * mb, char *str, int maxlen)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
m_getstrlen (mblk_t * mb)
|
||||
{
|
||||
streamchar *p;
|
||||
streamchar *lim;
|
||||
int len = 0;
|
||||
|
||||
if (mb == NULL)
|
||||
return -EINVAL;
|
||||
m_getskip (mb);
|
||||
if (mb->b_rptr >= mb->b_wptr)
|
||||
return -ESRCH;
|
||||
|
||||
p = mb->b_rptr;
|
||||
if (*p == ':')
|
||||
return -ENOENT;
|
||||
lim = mb->b_wptr;
|
||||
while (!isspace (*p)) {
|
||||
if (p == lim)
|
||||
break;
|
||||
len++;
|
||||
p++;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
m_getc (mblk_t * mb, char *c)
|
||||
{
|
||||
if (mb == NULL)
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
m_getskip (mb);
|
||||
if (mb->b_rptr >= mb->b_wptr)
|
||||
return ESRCH;
|
||||
return -ESRCH;
|
||||
|
||||
if (*mb->b_rptr == ':')
|
||||
return ENOENT;
|
||||
return -ENOENT;
|
||||
*c = *mb->b_rptr++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
mblk_t *
|
||||
#ifdef CONFIG_DEBUG_STREAMS
|
||||
deb_md_reply (const char *deb_file, unsigned int deb_line,queue_t * q, mblk_t * mb, int err)
|
||||
deb_make_reply (const char *deb_file, unsigned int deb_line, int err)
|
||||
#else
|
||||
md_reply (queue_t * q, mblk_t * mb, int err)
|
||||
make_reply (int err)
|
||||
#endif
|
||||
{
|
||||
#ifdef CONFIG_DEBUG_STREAMS
|
||||
|
@ -956,12 +991,11 @@ md_reply (queue_t * q, mblk_t * mb, int err)
|
|||
|
||||
if (mq == NULL) {
|
||||
#ifdef CONFIG_DEBUG_STREAMS
|
||||
printf("* NoMem md_reply %s:%d %d\n",deb_file,deb_line,err);
|
||||
printf("* NoMem make_reply %s:%d %d\n",deb_file,deb_line,err);
|
||||
#else
|
||||
printf("* NoMem md_reply %d\n",err);
|
||||
printf("* NoMem make_reply %d\n",err);
|
||||
#endif
|
||||
freemsg (mb);
|
||||
return;
|
||||
return NULL;
|
||||
}
|
||||
if (err == 0) {
|
||||
m_putid (mq, PROTO_NOERROR);
|
||||
|
@ -971,8 +1005,27 @@ md_reply (queue_t * q, mblk_t * mb, int err)
|
|||
m_puti (mq, err);
|
||||
}
|
||||
m_putdelim (mq);
|
||||
linkb (mq, mb);
|
||||
return mq;
|
||||
}
|
||||
|
||||
void
|
||||
#ifdef CONFIG_DEBUG_STREAMS
|
||||
deb_md_reply (const char *deb_file, unsigned int deb_line,queue_t * q, mblk_t * mb, int err)
|
||||
#else
|
||||
md_reply (queue_t * q, mblk_t * mb, int err)
|
||||
#endif
|
||||
{
|
||||
#ifdef CONFIG_DEBUG_STREAMS
|
||||
mblk_t *mq = deb_make_reply(deb_file,deb_line,err);
|
||||
#else
|
||||
mblk_t *mq = make_reply(err);
|
||||
#endif
|
||||
|
||||
if (mq == NULL) {
|
||||
freemsg (mb);
|
||||
return;
|
||||
}
|
||||
linkb (mq, mb);
|
||||
putnext (OTHERQ (q), mq);
|
||||
}
|
||||
|
||||
|
@ -985,33 +1038,17 @@ m_reply (queue_t * q, mblk_t * mb, int err)
|
|||
#endif
|
||||
{
|
||||
#ifdef CONFIG_DEBUG_STREAMS
|
||||
mblk_t *mq = deb_allocb (deb_file,deb_line,err ? 16 : 8, BPRI_HI);
|
||||
mblk_t *mq = deb_make_reply(deb_file,deb_line,err);
|
||||
#else
|
||||
mblk_t *mq = allocb (err ? 16 : 8, BPRI_HI);
|
||||
mblk_t *mq = make_reply(err);
|
||||
#endif
|
||||
|
||||
if (mq == NULL) {
|
||||
#ifdef CONFIG_DEBUG_STREAMS
|
||||
printf("* NoMem m_reply %s:%d %d\n",deb_file,deb_line,err);
|
||||
#else
|
||||
printf("* NoMem m_reply %d\n",err);
|
||||
#endif
|
||||
freemsg (mb);
|
||||
return;
|
||||
}
|
||||
if (err == 0) {
|
||||
m_putid (mq, PROTO_NOERROR);
|
||||
} else {
|
||||
m_putid (mq, PROTO_ERROR);
|
||||
m_putsx (mq, PROTO_ERROR);
|
||||
if(err < 0)
|
||||
err = -err;
|
||||
m_puti (mq, err);
|
||||
}
|
||||
m_putdelim (mq);
|
||||
linkb (mq, mb);
|
||||
DATA_TYPE(mq) = MSG_PROTO;
|
||||
|
||||
putnext (OTHERQ (q), mq);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ x75_setstate (x75 state, x75_status status)
|
|||
{
|
||||
|
||||
if (state->debug & 0x02)
|
||||
printf (KERN_DEBUG "x75.%d Setstate %d/%s -> %d/%s\n", state->debugnr, state->status, x75_sname[state->status], status, x75_sname[status]);
|
||||
printf ("%sx75.%d Setstate %d/%s -> %d/%s\n", KERN_DEBUG,state->debugnr, state->status, x75_sname[state->status], status, x75_sname[status]);
|
||||
if(state->status != S_free) {
|
||||
state->status = status;
|
||||
if(state->status == S_down)
|
||||
|
@ -73,7 +73,7 @@ x75_setstate (x75 state, x75_status status)
|
|||
if(state->T##xx) { \
|
||||
state->T##xx = 0; \
|
||||
if(state->debug & 0x08) \
|
||||
printf(KERN_DEBUG "Stop%d T"#xx" %d\n",state->debugnr,__LINE__); \
|
||||
printf("%sStop%d T"#xx" %d\n",KERN_DEBUG,state->debugnr,__LINE__); \
|
||||
untimeout((void *)x75_T##xx,state); \
|
||||
} splx(_ms); \
|
||||
(er)=0; \
|
||||
|
@ -84,7 +84,7 @@ x75_setstate (x75 state, x75_status status)
|
|||
if(! state->T##xx) { \
|
||||
state->T##xx = 1; \
|
||||
if(state->debug & 0x08) \
|
||||
printf(KERN_DEBUG "Start%d T"#xx" %d %d\n",state->debugnr,state->RUN_T##xx, __LINE__); \
|
||||
printf("%sStart%d T"#xx" %d %d\n",KERN_DEBUG,state->debugnr,state->RUN_T##xx, __LINE__); \
|
||||
timeout((void *)x75_T##xx,state,(state->RUN_T##xx * HZ) / 10); \
|
||||
} splx(_ms); \
|
||||
(er)=0; \
|
||||
|
@ -96,7 +96,7 @@ x75_setstate (x75 state, x75_status status)
|
|||
untimeout((void *)x75_T##xx,state); \
|
||||
state->T##xx = 1; \
|
||||
if(state->debug & 0x08) \
|
||||
printf(KERN_DEBUG "Restart%d T"#xx" %d %d\n",state->debugnr,state->RUN_T##xx, __LINE__); \
|
||||
printf("%sRestart%d T"#xx" %d %d\n",KERN_DEBUG,state->debugnr,state->RUN_T##xx, __LINE__); \
|
||||
timeout((void *)x75_T##xx,state,(state->RUN_T##xx * HZ) / 10); \
|
||||
splx(_ms); \
|
||||
} while(0)
|
||||
|
@ -108,7 +108,7 @@ x75_setstate (x75 state, x75_status status)
|
|||
if(state->T##xx) { \
|
||||
state->T##xx = 0; \
|
||||
if(state->debug & 0x08) \
|
||||
printf(KERN_DEBUG "Stop%d T"#xx" %d\n",state->debugnr,__LINE__); \
|
||||
printf("%sStop%d T"#xx" %d\n",KERN_DEBUG,state->debugnr,__LINE__); \
|
||||
untimeout(state->timer_T##xx); \
|
||||
} splx(_ms); \
|
||||
(er)=0; \
|
||||
|
@ -119,7 +119,7 @@ x75_setstate (x75 state, x75_status status)
|
|||
if(! state->T##xx) { \
|
||||
state->T##xx = 1; \
|
||||
if(state->debug & 0x08) \
|
||||
printf(KERN_DEBUG "Start%d T"#xx" %d %d\n",state->debugnr,state->RUN_T##xx,__LINE__); \
|
||||
printf("%sStart%d T"#xx" %d %d\n",KERN_DEBUG,state->debugnr,state->RUN_T##xx,__LINE__); \
|
||||
state->timer_T##xx = timeout((void *)x75_T##xx,state,(state->RUN_T##xx * HZ) / 10); \
|
||||
} splx(_ms); \
|
||||
(er)=0; \
|
||||
|
@ -131,7 +131,7 @@ x75_setstate (x75 state, x75_status status)
|
|||
untimeout(state->timer_T##xx); \
|
||||
state->T##xx = 1; \
|
||||
if(state->debug & 0x08) \
|
||||
printf(KERN_DEBUG "Restart%d T"#xx" %d %d\n",state->debugnr,state->RUN_T##xx,__LINE__); \
|
||||
printf("%sRestart%d T"#xx" %d %d\n",KERN_DEBUG,state->debugnr,state->RUN_T##xx,__LINE__); \
|
||||
state->timer_T##xx = timeout((void *)x75_T##xx,state,(state->RUN_T##xx * HZ) / 10); \
|
||||
splx(_ms); \
|
||||
(er)=0; \
|
||||
|
@ -223,11 +223,11 @@ xmit3 (x75 state, char cmd, uchar_t what)
|
|||
int err;
|
||||
|
||||
if (state->debug & 0x80)
|
||||
printf (KERN_DEBUG "X%d%c%x ", state->debugnr, cmd ? 'c' : 'r', what);
|
||||
printf ("%sX%d%c%x ", KERN_DEBUG,state->debugnr, cmd ? 'c' : 'r', what);
|
||||
mb = allocb (state->offset + 1, BPRI_HI);
|
||||
if (mb == NULL) {
|
||||
if(state->debug & 0x01)
|
||||
printf(KERN_WARNING "NX4 NoMem ");
|
||||
printf("%sNX4 NoMem ",KERN_WARNING);
|
||||
return -ENOENT;
|
||||
}
|
||||
mb->b_rptr += state->offset;
|
||||
|
@ -249,11 +249,11 @@ xmit4 (x75 state, char cmd, uchar_t what1, uchar_t what2)
|
|||
int err;
|
||||
|
||||
if (state->debug & 0x80)
|
||||
printf (KERN_DEBUG "X%d%c%x.%x ", state->debugnr, cmd ? 'c' : 'r', what1, what2);
|
||||
printf ("%sX%d%c%x.%x ", KERN_DEBUG,state->debugnr, cmd ? 'c' : 'r', what1, what2);
|
||||
mb = allocb (state->offset + 2, BPRI_HI);
|
||||
if (mb == NULL) {
|
||||
if(state->debug & 0x01)
|
||||
printf(KERN_WARNING "NX4 NoMem ");
|
||||
printf("%sNX4 NoMem ",KERN_WARNING);
|
||||
return -ENOENT;
|
||||
}
|
||||
mb->b_rptr += state->offset;
|
||||
|
@ -275,7 +275,7 @@ Xestablish (x75 state, int line)
|
|||
int err, err2;
|
||||
|
||||
if (state->debug & 0x10)
|
||||
printf (KERN_EMERG "Establish%d %d\n", state->debugnr, line);
|
||||
printf ("%sEstablish%d %d\n", KERN_EMERG,state->debugnr, line);
|
||||
if(state->broadcast) {
|
||||
return -ENXIO;
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ Xestablish (x75 state, int line)
|
|||
x75_setstate(state, S_await_up);
|
||||
if((state->errors += 10) >= 100) {
|
||||
x75_setstate(state, S_down);
|
||||
printf(KERN_INFO "ERR_G 1, %d\n",state->errors);
|
||||
printf("%sERR_G 1, %d\n",KERN_INFO,state->errors);
|
||||
state->errors = 0;
|
||||
msg_up (state, MDL_ERROR_IND, ERR_G);
|
||||
msg_up (state, DL_RELEASE_IND, 0);
|
||||
|
@ -323,7 +323,7 @@ Xrecover_NR (x75 state, int line)
|
|||
|
||||
if (state->flush != NULL)
|
||||
(*state->flush) (state->ref);
|
||||
printf(KERN_INFO "ERR_J 1\n");
|
||||
printf("%sERR_J 1\n",KERN_INFO);
|
||||
msg_up (state, MDL_ERROR_IND, ERR_J);
|
||||
err = Xestablish (state, line);
|
||||
state->L3_req = 0;
|
||||
|
@ -377,7 +377,7 @@ x75_T1 (x75 state)
|
|||
|
||||
state->T1 = 0;
|
||||
if (state->debug & 0x10)
|
||||
printf (KERN_DEBUG "T%d.1 %d RC %d\n", state->debugnr, state->status, state->RC);
|
||||
printf ("%sT%d.1 %d RC %d\n", KERN_DEBUG,state->debugnr, state->status, state->RC);
|
||||
switch (state->status) {
|
||||
case S_await_up:
|
||||
if (state->RC != 0) { /* temporary kludge */
|
||||
|
@ -386,7 +386,7 @@ x75_T1 (x75 state)
|
|||
|
||||
if(!state->wide) {
|
||||
#ifdef linux
|
||||
printf(KERN_DEBUG "Xtimeout %ld\n",jiffies);
|
||||
printf("%sXtimeout %ld\n",KERN_DEBUG,jiffies);
|
||||
#endif
|
||||
#if 0
|
||||
{
|
||||
|
@ -405,7 +405,7 @@ x75_T1 (x75 state)
|
|||
start_T (1, err2);
|
||||
} else {
|
||||
flush_I (state);
|
||||
printf(KERN_INFO "ERR_G 2, %d\n",state->N1);
|
||||
printf("%sERR_G 2, %d\n",KERN_INFO,state->N1);
|
||||
msg_up (state, MDL_ERROR_IND, ERR_G);
|
||||
msg_up (state, DL_RELEASE_IND, 0);
|
||||
x75_setstate(state, S_down);
|
||||
|
@ -432,7 +432,7 @@ x75_T1 (x75 state)
|
|||
xmit3 (state, 1, L2_DISC | L2_PF_U);
|
||||
start_T (1, err2);
|
||||
} else {
|
||||
printf(KERN_INFO "ERR_H 1\n");
|
||||
printf("%sERR_H 1\n",KERN_INFO);
|
||||
msg_up (state, MDL_ERROR_IND, ERR_H);
|
||||
msg_up (state, DL_RELEASE_CONF, 0);
|
||||
x75_setstate(state, S_down);
|
||||
|
@ -444,7 +444,7 @@ x75_T1 (x75 state)
|
|||
state->RC++;
|
||||
start_T (1, err2);
|
||||
} else {
|
||||
printf(KERN_INFO "ERR_I 1\n");
|
||||
printf("%sERR_I 1\n",KERN_INFO);
|
||||
msg_up (state, MDL_ERROR_IND, ERR_I);
|
||||
establish (state);
|
||||
state->L3_req = 0;
|
||||
|
@ -465,7 +465,7 @@ x75_T3 (x75 state)
|
|||
{
|
||||
state->T3 = 0;
|
||||
if (state->debug & 0x10)
|
||||
printf (KERN_DEBUG "T%d.3 %d\n", state->debugnr, state->status);
|
||||
printf ("%sT%d.3 %d\n", KERN_DEBUG,state->debugnr, state->status);
|
||||
switch (state->status) {
|
||||
case S_up:
|
||||
x75_setstate(state, S_recover);
|
||||
|
@ -529,13 +529,13 @@ x75_check_pending (x75 state, char fromLow)
|
|||
|
||||
#if 0 /* def CONFIG_DEBUG_ISDN */
|
||||
if(state->debug & 1)
|
||||
printf(KERN_DEBUG "CP%d %s:%d ",state->debugnr,deb_file,deb_line);
|
||||
printf("%sCP%d %s:%d ",KERN_DEBUG,state->debugnr,deb_file,deb_line);
|
||||
#ifdef CONFIG_DEBUG_STREAMS
|
||||
cS_check(deb_file,deb_line,&state->UI,NULL);
|
||||
#endif
|
||||
#else
|
||||
if(state->debug & 1)
|
||||
printf(KERN_DEBUG "CP%d ",state->debugnr);
|
||||
printf("%sCP%d ",KERN_DEBUG,state->debugnr);
|
||||
#endif
|
||||
|
||||
if(state->status == S_free)
|
||||
|
@ -556,7 +556,7 @@ x75_check_pending (x75 state, char fromLow)
|
|||
mb = mb2;
|
||||
*--mb->b_rptr = L2_UI;
|
||||
if (state->debug & 1)
|
||||
printf (KERN_DEBUG "X%dc%x ", state->debugnr, mb->b_wptr[-1] & 0xFF);
|
||||
printf ("%sX%dc%x ", KERN_DEBUG,state->debugnr, mb->b_wptr[-1] & 0xFF);
|
||||
if ((err = (*state->send) (state->ref, state->asBroadcast ? 3 : 1, mb)) != 0) {
|
||||
if (err == -EAGAIN) { /* Undo the above */
|
||||
mb->b_rptr++;
|
||||
|
@ -574,7 +574,7 @@ x75_check_pending (x75 state, char fromLow)
|
|||
*/
|
||||
if (state->status != S_up) {
|
||||
if(state->I.first != NULL)
|
||||
printf(KERN_DEBUG "x75.%d: State %d/%s, pending\n",state->debugnr,state->status,x75_sname[state->status]);
|
||||
printf("%sx75.%d: State %d/%s, pending\n",KERN_DEBUG,state->debugnr,state->status,x75_sname[state->status]);
|
||||
if ((state->status == S_await_up) && fromLow) {
|
||||
stop_T(1,err);
|
||||
x75_T1(state);
|
||||
|
@ -610,11 +610,11 @@ x75_check_pending (x75 state, char fromLow)
|
|||
*--mb->b_rptr = state->v_r << 1;
|
||||
*--mb->b_rptr = state->v_s << 1;
|
||||
if (state->debug & 1)
|
||||
printf (KERN_DEBUG "X%dc%x.%x ", state->debugnr, mb->b_rptr[0] & 0xFF, mb->b_rptr[1] & 0xFF);
|
||||
printf ("%sX%dc%x.%x ", KERN_DEBUG,state->debugnr, mb->b_rptr[0] & 0xFF, mb->b_rptr[1] & 0xFF);
|
||||
} else {
|
||||
*--mb->b_rptr = (state->v_s << 1) | (state->v_r << 5);
|
||||
if (state->debug & 1)
|
||||
printf (KERN_DEBUG "X%dc%x ", state->debugnr, mb->b_rptr[0] & 0xFF);
|
||||
printf ("%sX%dc%x ", KERN_DEBUG,state->debugnr, mb->b_rptr[0] & 0xFF);
|
||||
}
|
||||
state->v_s = (state->v_s + 1) & (state->wide ? 0x7F : 0x07);
|
||||
if ((err = (*state->send) (state->ref, 1, mb)) != 0) {
|
||||
|
@ -659,8 +659,8 @@ x75_check_pending (x75 state, char fromLow)
|
|||
err = err2;
|
||||
}
|
||||
#if 0 /* def CONFIG_DEBUG_ISDN */
|
||||
else if(did) printf(KERN_DEBUG "NX send ");
|
||||
else printf(KERN_DEBUG "NX NoAckPend ");
|
||||
else if(did) printf("%sNX send ",KERN_DEBUG );
|
||||
else printf("%sNX NoAckPend ",KERN_DEBUG );
|
||||
#endif
|
||||
/*
|
||||
* Ugly Hack time. Continuously ask the remote side what's going on while
|
||||
|
@ -690,7 +690,7 @@ checkV (x75 state, uchar_t n_r)
|
|||
if ((n_r == state->v_a) && (n_r == state->v_s))
|
||||
return 1;
|
||||
if (state->debug & 0x08)
|
||||
printf (KERN_DEBUG "Chk%d %d <= %d <= %d\n", state->debugnr, state->v_a, n_r, state->v_s);
|
||||
printf ("%sChk%d %d <= %d <= %d\n",KERN_DEBUG,state->debugnr, state->v_a, n_r, state->v_s);
|
||||
if (state->v_a <= state->v_s) {
|
||||
if (state->v_a <= n_r && n_r <= state->v_s)
|
||||
return 1;
|
||||
|
@ -698,7 +698,7 @@ checkV (x75 state, uchar_t n_r)
|
|||
if (state->v_a <= n_r || n_r <= state->v_s)
|
||||
return 1;
|
||||
}
|
||||
printf (KERN_WARNING "\n*** X75-%d Sequence error: V_A %d, N_R %d, V_S %d\n",
|
||||
printf ("\n%s*** X75-%d Sequence error: V_A %d, N_R %d, V_S %d\n",KERN_WARNING,
|
||||
state->debugnr, state->v_a, n_r, state->v_s);
|
||||
return 0;
|
||||
}
|
||||
|
@ -723,7 +723,7 @@ pull_up (x75 state, uchar_t n_r)
|
|||
state->v_a = (state->v_a + 1) & (state->wide ? 0x7F : 0x07);
|
||||
}
|
||||
if (state->v_a != n_r) {
|
||||
printf (KERN_WARNING "x75.%d consistency problem: v_a %d, n_r %d, v_s %d, nblk %d, firstblk %p\n",
|
||||
printf ("%sx75.%d consistency problem: v_a %d, n_r %d, v_s %d, nblk %d, firstblk %p\n",KERN_WARNING,
|
||||
state->debugnr, state->v_a, n_r, state->v_s, state->I.nblocks, state->I.first);
|
||||
splx (ms);
|
||||
return -EFAULT;
|
||||
|
@ -770,15 +770,15 @@ x75_recv (x75 state, char cmd, mblk_t * mb)
|
|||
if (state->debug & 0x80) {
|
||||
if (state->wide) {
|
||||
if ((x1 & L2_m_SU) == L2_is_U) {
|
||||
printf (KERN_DEBUG "R%d%c%x ", state->debugnr, cmd ? 'c' : 'r', x1);
|
||||
printf ("%sR%d%c%x ",KERN_DEBUG, state->debugnr, cmd ? 'c' : 'r', x1);
|
||||
} else {
|
||||
if (mb != NULL)
|
||||
printf (KERN_DEBUG "R%d%c%x.%x ", state->debugnr, cmd ? 'c' : 'r', x1, *mb->b_rptr & 0xFF);
|
||||
printf ("%sR%d%c%x.%x ", KERN_DEBUG,state->debugnr, cmd ? 'c' : 'r', x1, *mb->b_rptr & 0xFF);
|
||||
else
|
||||
printf (KERN_DEBUG "R%d.half %x ", state->debugnr, x1);
|
||||
printf ("%sR%d.half %x ",KERN_DEBUG, state->debugnr, x1);
|
||||
}
|
||||
} else {
|
||||
printf (KERN_DEBUG "R%d%c%x ", state->debugnr, cmd ? 'c' : 'r', x1);
|
||||
printf ("%sR%d%c%x ",KERN_DEBUG, state->debugnr, cmd ? 'c' : 'r', x1);
|
||||
}
|
||||
}
|
||||
mb = pullupm(mb,0);
|
||||
|
@ -984,7 +984,7 @@ x75_recv (x75 state, char cmd, mblk_t * mb)
|
|||
* force-poll-while-RNR hack. Yes it _is_
|
||||
* ugly. I know that. */
|
||||
if (!(state->RNR && state->poll)) {
|
||||
printf(KERN_INFO "ERR_A 1, RNR %d poll %d\n",state->RNR,state->poll);
|
||||
printf("%sERR_A 1, RNR %d poll %d\n",KERN_INFO,state->RNR,state->poll);
|
||||
err2 = msg_up (state, MDL_ERROR_IND, ERR_A);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
|
@ -1086,7 +1086,7 @@ x75_recv (x75 state, char cmd, mblk_t * mb)
|
|||
} else {
|
||||
if (pf) {
|
||||
if (!(state->poll && state->RNR)) {
|
||||
printf(KERN_INFO "ERR_A 2\n");
|
||||
printf("%sERR_A 2\n",KERN_INFO );
|
||||
err2 = msg_up (state, MDL_ERROR_IND, ERR_A);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
|
@ -1177,7 +1177,7 @@ x75_recv (x75 state, char cmd, mblk_t * mb)
|
|||
} else {
|
||||
if (pf) {
|
||||
if (!(state->poll && state->RNR)) {
|
||||
printf(KERN_INFO "ERR_A 3\n");
|
||||
printf("%sERR_A 3\n",KERN_INFO );
|
||||
err2 = msg_up (state, MDL_ERROR_IND, ERR_A);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
|
@ -1262,7 +1262,7 @@ x75_recv (x75 state, char cmd, mblk_t * mb)
|
|||
err2 = send_FRMR (state, pf, x1, x2, cmd, 1, 0, 0, 0);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
printf(KERN_INFO "ERR_L 1\n");
|
||||
printf("%sERR_L 1\n",KERN_INFO);
|
||||
err2 = msg_up (state, MDL_ERROR_IND, ERR_L);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
|
@ -1292,7 +1292,7 @@ x75_recv (x75 state, char cmd, mblk_t * mb)
|
|||
err2 = send_FRMR (state, pf, x1, 0, cmd, 1, 1, 0, 0);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
printf(KERN_INFO "ERR_N 1\n");
|
||||
printf("%sERR_N 1\n",KERN_INFO );
|
||||
err2 = msg_up (state, MDL_ERROR_IND, ERR_N);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
|
@ -1300,7 +1300,7 @@ x75_recv (x75 state, char cmd, mblk_t * mb)
|
|||
}
|
||||
if ((code == L2_SABME) != (state->wide != 0)) {
|
||||
/* Configured extended mode, got normal mode, or vice versa */
|
||||
printf(KERN_INFO "ERR_? 1\n");
|
||||
printf("%sERR_? 1\n", KERN_INFO );
|
||||
err2 = send_FRMR (state, pf, x1, 0, cmd, 1, 0, 0, 0);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
|
@ -1357,7 +1357,7 @@ x75_recv (x75 state, char cmd, mblk_t * mb)
|
|||
err2 = clr_except (state);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
printf(KERN_INFO "ERR_F 1\n");
|
||||
printf("%sERR_F 1\n",KERN_INFO );
|
||||
err2 = msg_up (state, MDL_ERROR_IND, ERR_F);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
|
@ -1389,7 +1389,7 @@ x75_recv (x75 state, char cmd, mblk_t * mb)
|
|||
err2 = send_FRMR (state, pf, x1, x2, cmd, 1, 1, 0, 0);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
printf(KERN_INFO "ERR_N 2\n");
|
||||
printf("%sERR_N 2\n",KERN_INFO );
|
||||
err2 = msg_up (state, MDL_ERROR_IND, ERR_N);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
|
@ -1448,7 +1448,7 @@ x75_recv (x75 state, char cmd, mblk_t * mb)
|
|||
err2 = send_FRMR (state, pf, x1, x2, cmd, 1, 1, 0, 0);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
printf(KERN_INFO "ERR_N 3\n");
|
||||
printf("%sERR_N 3\n",KERN_INFO );
|
||||
err2 = msg_up (state, MDL_ERROR_IND, ERR_N);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
|
@ -1494,12 +1494,12 @@ x75_recv (x75 state, char cmd, mblk_t * mb)
|
|||
case S_up:
|
||||
case S_recover:
|
||||
if (pf) {
|
||||
printf(KERN_INFO "ERR_B 1\n");
|
||||
printf("%sERR_B 1\n",KERN_INFO );
|
||||
err2 = msg_up (state, MDL_ERROR_IND, ERR_B);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
} else {
|
||||
printf(KERN_INFO "ERR_E 1\n");
|
||||
printf("%sERR_E 1\n",KERN_INFO );
|
||||
err2 = msg_up (state, MDL_ERROR_IND, ERR_E);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
|
@ -1517,7 +1517,7 @@ x75_recv (x75 state, char cmd, mblk_t * mb)
|
|||
err2 = send_FRMR (state, pf, x1, x2, cmd, 1, 1, 0, 0);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
printf(KERN_INFO "ERR_N\n");
|
||||
printf("%sERR_N\n",KERN_INFO );
|
||||
err2 = msg_up (state, MDL_ERROR_IND, ERR_N);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
|
@ -1527,7 +1527,7 @@ x75_recv (x75 state, char cmd, mblk_t * mb)
|
|||
case S_up:
|
||||
case S_down:
|
||||
case S_recover:
|
||||
printf(KERN_INFO "ERR_CD 1\n");
|
||||
printf("%sERR_CD 1\n",KERN_INFO );
|
||||
err2 = msg_up (state, MDL_ERROR_IND, ERR_C | ERR_D);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
|
@ -1557,7 +1557,7 @@ x75_recv (x75 state, char cmd, mblk_t * mb)
|
|||
if(state->backenable)
|
||||
(*state->backenable) (state->ref);
|
||||
} else {
|
||||
printf(KERN_INFO "ERR_D 1\n");
|
||||
printf("%sERR_D 1\n",KERN_INFO );
|
||||
err2 = msg_up (state, MDL_ERROR_IND, ERR_D);
|
||||
}
|
||||
if (err == 0)
|
||||
|
@ -1573,7 +1573,7 @@ x75_recv (x75 state, char cmd, mblk_t * mb)
|
|||
err = err2;
|
||||
x75_setstate(state, S_down);
|
||||
} else {
|
||||
printf(KERN_INFO "ERR_D 2\n");
|
||||
printf("%sERR_D 2\n",KERN_INFO );
|
||||
err2 = msg_up (state, MDL_ERROR_IND, ERR_D);
|
||||
}
|
||||
if (err == 0)
|
||||
|
@ -1604,7 +1604,7 @@ x75_recv (x75 state, char cmd, mblk_t * mb)
|
|||
case L2_FRMR:
|
||||
case L2_FRMR | L2__CMD: /* technically an invalid frame, but replying with
|
||||
FRMR here is _bad_ */
|
||||
printf(KERN_INFO "ERR_D 3\n");
|
||||
printf("%sERR_D 3\n",KERN_INFO );
|
||||
err2 = msg_up (state, MDL_ERROR_IND, ERR_D);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
|
@ -1618,7 +1618,7 @@ x75_recv (x75 state, char cmd, mblk_t * mb)
|
|||
err2 = send_FRMR (state, pf, x1, x2, cmd, 1, 0, 0, 0);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
printf(KERN_INFO "ERR_L 2\n");
|
||||
printf("%sERR_L 2\n",KERN_INFO );
|
||||
err2 = msg_up (state, MDL_ERROR_IND, ERR_L);
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
|
@ -1660,6 +1660,8 @@ x75_send (x75 state, char isUI, mblk_t * mb)
|
|||
int
|
||||
x75_cansend (x75 state, char isUI)
|
||||
{
|
||||
if(state->cansend != NULL)
|
||||
(void)(*state->cansend) (state->ref); /* Trigger bringing L1 up */
|
||||
if (isUI)
|
||||
return (state->I.nblocks < 3); /* arbitrary maximum */
|
||||
else /* This allows us to enqueue one additional
|
||||
|
@ -1694,11 +1696,11 @@ x75_changestate (x75 state, uchar_t ind, char isabort)
|
|||
|
||||
#ifdef CONFIG_DEBUG_ISDN
|
||||
if(state->debug & 0x10)
|
||||
printf(KERN_DEBUG "x75.%d: State %d/%s for ind %d %d from %s:%d\n",state->debugnr,state->status,
|
||||
printf("%sx75.%d: State %d/%s for ind %d %d from %s:%d\n",KERN_DEBUG,state->debugnr,state->status,
|
||||
x75_sname[state->status],ind,isabort,deb_file,deb_line);
|
||||
#else
|
||||
if(state->debug & 0x10)
|
||||
printf(KERN_DEBUG "x75.%d: State %d/%s for ind %d %d\n",state->debugnr,state->status,
|
||||
printf("%sx75.%d: State %d/%s for ind %d %d\n",KERN_DEBUG,state->debugnr,state->status,
|
||||
x75_sname[state->status],ind,isabort);
|
||||
#endif
|
||||
if (isabort)
|
||||
|
@ -1719,7 +1721,7 @@ x75_changestate (x75 state, uchar_t ind, char isabort)
|
|||
if (state->status == S_up || state->status == S_recover)
|
||||
break; /* Already established. */
|
||||
if (state->debug & 0x10)
|
||||
printf (KERN_DEBUG "X75%d: Forced establish.\n", state->debugnr);
|
||||
printf ("%sX75%d: Forced establish.\n",KERN_DEBUG, state->debugnr);
|
||||
/* flush_I (state); */
|
||||
state->errors = 0;
|
||||
if (state->status != S_down && state->status != S_free)
|
||||
|
@ -1740,7 +1742,7 @@ x75_changestate (x75 state, uchar_t ind, char isabort)
|
|||
case S_down:
|
||||
case S_await_down:
|
||||
if(ind == DL_ESTABLISH_IND /* && state->UI.first == NULL && state->UI.first == NULL */ ) {
|
||||
if(0)printf(KERN_DEBUG "x75.%d: DL_ESTABLISH_IND, down, nothing done\n",state->debugnr);
|
||||
if(0)printf("%sx75.%d: DL_ESTABLISH_IND, down, nothing done\n",KERN_DEBUG,state->debugnr);
|
||||
break;
|
||||
}
|
||||
err = establish (state);
|
||||
|
@ -1876,7 +1878,7 @@ x75_initconn (x75 state)
|
|||
|| state->recv == NULL
|
||||
|| state->state == NULL)
|
||||
return -EFAULT;
|
||||
if(0)printf(KERN_DEBUG "X75 %d: Init %d %d\n",state->debugnr,state->RUN_T1,state->RUN_T3);
|
||||
if(0)printf("%sX75 %d: Init %d %d\n",KERN_DEBUG,state->debugnr,state->RUN_T1,state->RUN_T3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue