Compare commits
34 Commits
52422021a7
...
5459a62819
Author | SHA1 | Date |
---|---|---|
Matthias Urlichs | 5459a62819 | |
Harald Welte | 1d0ca4d61f | |
Matthias Urlichs | 7ccfe6b7e6 | |
Matthias Urlichs | 75b6ca7f79 | |
Matthias Urlichs | 2127e8657c | |
Matthias Urlichs | be5251ef13 | |
Matthias Urlichs | 1b44c432c9 | |
Matthias Urlichs | f930f37b7d | |
Matthias Urlichs | 75c39d9628 | |
Matthias Urlichs | 2de4cb7a4c | |
Matthias Urlichs | b4dd41d935 | |
Matthias Urlichs | f2119ac17e | |
Matthias Urlichs | 673bb12c8f | |
Matthias Urlichs | b3ebfb62ea | |
Matthias Urlichs | 589009f710 | |
Matthias Urlichs | 001e4b939a | |
Matthias Urlichs | a5d1bc9fa8 | |
Matthias Urlichs | f1c23b539a | |
Matthias Urlichs | 720e2a5bd3 | |
Matthias Urlichs | 2a10cda9fe | |
Matthias Urlichs | 409041354a | |
Matthias Urlichs | 66073f081f | |
Matthias Urlichs | 8fe0bc4dd0 | |
Matthias Urlichs | 346491b223 | |
Matthias Urlichs | 0a9bc8c1b7 | |
Matthias Urlichs | f68fc8e219 | |
Matthias Urlichs | 31dd84ea4c | |
Matthias Urlichs | 0bada575c3 | |
Matthias Urlichs | 894f4b987a | |
Matthias Urlichs | 8e5fce4699 | |
Matthias Urlichs | 3bab9ab140 | |
Matthias Urlichs | 219e6bdd9b | |
Matthias Urlichs | 45de419ff2 | |
Matthias Urlichs | 1097952088 |
|
@ -0,0 +1,24 @@
|
|||
As far as this code is copyright 19??-1995 Matthias Urlichs,
|
||||
as of 2022-02 I hereby relicense it under the GPL v2 or later.
|
||||
|
||||
If you don't know where to find the text of the GPL v2, please delete this
|
||||
archive and do something useful instead.
|
||||
|
||||
You might (or might not) want to take the first three words of this file
|
||||
seriously. There's a "streams" subdirectory in there, and if you know
|
||||
anything about the history of Unix you should notice the problem.
|
||||
|
||||
That being said, the code is too old to be useful with modern compilers
|
||||
and the copyright holder doesn't exist any more anyway (more or less), so
|
||||
I'll leave deciding whether or not that's a possible problem to the reader/user.
|
||||
|
||||
Personally, I wouldn't bother.
|
||||
|
||||
In case anybody knows the "Brad K. Clements" who wrote the code that ended up
|
||||
as isdn/str_if/str_in.c in 1990: please forward his email address to me.
|
||||
I'd like to ask him whether we should still take his "all rights reserved"
|
||||
seriously.
|
||||
|
||||
Matthias Urlichs
|
||||
<matthias@urlichs.de>
|
||||
2022-02-17
|
|
@ -0,0 +1,50 @@
|
|||
.PHONY: dummy
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
## =()<CARDS = @<CARDS>@>()=
|
||||
CARDS = teles bintec
|
||||
## =()<PROTOCOLS = @<PROTOCOLS>@>()=
|
||||
PROTOCOLS = phone tei capi fixed
|
||||
## =()<SUBPROTOCOLS = @<SUBPROTOCOLS>@>()=
|
||||
SUBPROTOCOLS = euro german
|
||||
|
||||
## =()<KERNELSRC := @<KERNELSRC>@>()=
|
||||
KERNELSRC := /usr/src/kernel/linux-pci
|
||||
|
||||
ifeq ($(wildcard $(KERNELSRC)/.config),$(KERNELSRC)/.config)
|
||||
include $(KERNELSRC)/.config
|
||||
endif
|
||||
|
||||
ifdef KERNEL
|
||||
## =()<CC = @<CC>@>()=
|
||||
CC = gcc
|
||||
## =()<CFLAGS = @<CFLAGS>@ >()=
|
||||
CFLAGS = -g -O2 -fomit-frame-pointer -Wall -DKERNEL -D__KERNEL__ -DMODULE
|
||||
|
||||
else
|
||||
|
||||
## =()<CC = @<HOSTCC>@>()=
|
||||
CC = gcc
|
||||
## =()<CFLAGS = @<HOSTCFLAGS>@ >()=
|
||||
CFLAGS = -g -O2 -Wall -D_GNU_SOURCE
|
||||
## =()<LIBS = @<LIBS>@>()=
|
||||
LIBS = -lbsd-compat
|
||||
endif
|
||||
|
||||
|
||||
## =()<DESTDIR = @<DESTDIR>@>()=
|
||||
DESTDIR = /usr/lib/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,255 @@
|
|||
# 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 LDFLAGS
|
||||
unexport SOURCES
|
||||
unexport HEADERS
|
||||
unexport LIB
|
||||
unexport LIBS
|
||||
unexport OBJ
|
||||
unexport OBJS
|
||||
unexport DOCARDS
|
||||
unexport WHAT
|
||||
unexport REALSOURCE
|
||||
unexport DOSRC
|
||||
unexport SUBDIRS
|
||||
unexport EXTRA_CFLAGS
|
||||
unexport EXTRA_LDFLAGS
|
||||
unexport EXTRA_LIBS
|
||||
|
||||
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) -r 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)
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) $(INCLUDES) $(EXTRA_CFLAGS) -DREALNAME=$(basename $@) -D_$(basename $@)_ -c -o $@ $<
|
||||
else
|
||||
%.o: %.c
|
||||
$(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) $(EXTRA_LDFLAGS) $(LDFLAGS) -o $@ $(POBJS) $(EXTRA_LIBS) $(LIBS)
|
||||
else
|
||||
ifneq ($(strip $(PROGRAMS)),)
|
||||
programs:: $(PROGRAMS)
|
||||
|
||||
%: %.o $(filter %.a,$(LIBS) $(EXTRA_LIBS))
|
||||
$(CC) $(EXTRA_LDFLAGS) $(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 $(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)
|
||||
|
||||
ifneq ($(strip $(CONFIG_MODVERSIONS)),)
|
||||
ifneq ($(strip $(SYMTAB)),)
|
||||
$(CC) $(CFLAGS) $(INCLUDES) $(EXTRA_CFLAGS) -E -D__GENKSYMS__ $(SYMTAB) | /sbin/genksyms $(TOPDIR)/include
|
||||
for i in $(SYMTAB:.c=.ver) ; do echo "#include \"$$i\"" ; done >> $(TOPDIR)/include/symtables
|
||||
endif
|
||||
endif
|
||||
|
||||
$(CC) -M $(CFLAGS) $(INCLUDES) $(EXTRA_CFLAGS) $(SOURCES) >> .depend
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(strip $(PSOURCES)),)
|
||||
depend:: Makefile $(PSOURCES) $(HEADERS)
|
||||
$(CC) -M $(CFLAGS) $(INCLUDES) $(EXTRA_CFLAGS) $(PSOURCES) >> .depend
|
||||
endif
|
34
Makefile
34
Makefile
|
@ -1,17 +1,29 @@
|
|||
# config and include are first, then libraries, tools, modules+programs
|
||||
SUBDIRS = config include compat streams support isdn_3 isdn_4 tools \
|
||||
ksupport isdn_2 str_if cards x75 alaw tools van_j strslip \
|
||||
v110 pr_on fakeh fakecept t70 buffer rate timer reconnect ip_mon
|
||||
|
||||
all: isdn
|
||||
.PHONY: depend
|
||||
|
||||
isdn: dummy
|
||||
make -C isdn
|
||||
all:: .diddepend
|
||||
|
||||
depend dep:
|
||||
make -C isdn depend
|
||||
config::
|
||||
$(MAKE) -C config
|
||||
|
||||
load:
|
||||
make -C isdn load
|
||||
dep: depend
|
||||
|
||||
clean:
|
||||
make -C isdn clean
|
||||
-rm .toldem
|
||||
TOPDIR=.
|
||||
include Make.rules
|
||||
|
||||
.diddepend: Makefile config/config.data config/files.list
|
||||
$(MAKE) depend
|
||||
touch .diddepend
|
||||
|
||||
config/config.data: config
|
||||
|
||||
clean::
|
||||
rm -f .toldem .diddepend
|
||||
|
||||
master:
|
||||
set -e; for i in config support isdn_3 isdn_4 ; do $(MAKE) -C $$i all ; done
|
||||
|
||||
dummy:
|
||||
|
|
|
@ -0,0 +1,489 @@
|
|||
U-ISDN
|
||||
======
|
||||
|
||||
Once upon a time, I hacked an ISDN interface into Linux.
|
||||
|
||||
It supported networking, multiple "passive" ISDN cards (i.e. those without
|
||||
a CPU of their own), some active cards, TTYs, private virtual circuits,
|
||||
both German and European signalling standards, and some other bits and
|
||||
pieces.
|
||||
|
||||
We ran an actual ISP business with that code.
|
||||
|
||||
That's the good part.
|
||||
|
||||
The bad part is that this code is an unholy mess. At the time, Linux
|
||||
networking was "mostly" working; see the numerous kernel patches that are
|
||||
in this archive. In fact, for the first versions of this code (now happily
|
||||
resting in the digital nirvana), Linux networking was so abysmally bad that
|
||||
I hacked the BSD networking code into it and used that instead.
|
||||
|
||||
Yes, seriously. No, I don't have that code any more. Or rather, it is on a
|
||||
bunch of slowly-disintegrating Streamer cartridges in my basement, and if
|
||||
you have working hardware that can actually read these things we might come
|
||||
to an agreement. (I don't, as the capstan of the tape drives was made of
|
||||
synthetic rubber … which has disintegrated by now.)
|
||||
|
||||
Also, when I started to cobble all of this together I was a student and
|
||||
didn't actually care all that much about copyright and whatnot. As a
|
||||
result, this archive contains some pieces that strictly speaking should not
|
||||
be redistributed.
|
||||
|
||||
On the other hand, the company (which I'll not name here) that held said
|
||||
copyrights doesn't exist any more, more or less, and even if somebody did
|
||||
care about stone-age C code that doesn't even compile any more (unless your
|
||||
compiler is 20+ years old … and so are your kernel headers …) most likely
|
||||
they'd have a hard time proving that they really do hold the rights to that
|
||||
code.
|
||||
|
||||
Thus, I'll leave the decision of whether to read any of the code contained
|
||||
herein, try to use it, and/or delete it in abject horror, to the esteemed
|
||||
reader.
|
||||
|
||||
Matthias Urlichs
|
||||
<matthias@urlichs.de>
|
||||
2022-02-16
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
[ This is a German version. An English version is in the works. ]
|
||||
|
||||
Die Anleitung und der ganze Kram findet sich in der Datei DOKU, oder
|
||||
README.isdn in den Kernelsourcen.
|
||||
|
||||
|
||||
*** 1996-07-25
|
||||
|
||||
Update 42. Grummel...
|
||||
|
||||
Neue Feature: Wenn eine Verbindung länger als 10 Sekunden im >down-Zustand
|
||||
bleibt, wird der Master umgebracht. (Das ist meistens ein Symptom für ein
|
||||
verknotetes D-Kanal-Handling oder eine verklemmte aktive Karte.)
|
||||
|
||||
Syslog "CONN" loggt die Verbindungszeit in Sekunden. ("COST" loggt die
|
||||
Verbindungskosten, wie vorher.)
|
||||
|
||||
Die Zahl der Verbindungen wird beim Minuten-Timestamp mitgeschrieben;
|
||||
daraus läßt sich sehr schön eine Grafik generieren...
|
||||
|
||||
|
||||
*** 1996-04-??
|
||||
|
||||
Update 39. Support für "altes" /sbin/route ist gestrichen!
|
||||
|
||||
/sbin/route --help _muß_ bei "route del" die Angabe einer Netmask und eines
|
||||
Interfaces zulassen. Test mit "route --help".
|
||||
|
||||
|
||||
*** 1996-04-11
|
||||
|
||||
Update 38. Support für "alte" Kernels (< 1.3.78 oder so) ist gestrichen!
|
||||
|
||||
PPP tut mit Bintec-S0- und S2M-Karten.
|
||||
Update zum Verbindungshandling bei Callback, sollte jetzt besser
|
||||
funktionieren.
|
||||
Freigabe von Devices hatte ich teilweise vergessen...
|
||||
Das reconn-Modul hat manchmal Pakete zu voreilig weggeworfen.
|
||||
str_if loggt mit, wenn Pakete weggeworfen werden mußten.
|
||||
Wiedermal ein htons() vergessen...
|
||||
slipto kann jetzt auch "-r ipadresse/bits", zusätzlich zu
|
||||
"-r ipadresse:netmask".
|
||||
|
||||
|
||||
*** 1996-02-07
|
||||
|
||||
Update 37. ACHTUNG: Nur für Kernel 1.3.71 ff.
|
||||
Für ältere Kernels gibt es einen Patch 37-old, der _anstatt_ isdn-36-37.gz
|
||||
angewendet werden muß.
|
||||
|
||||
Weitere Patches (d.h. 37->38 ff) können Konflikte verursachen. Ich empfehle
|
||||
jedem, 1.3.71 zu installieren; das Teil ist um _einiges_ schneller als
|
||||
1.2.13.
|
||||
|
||||
|
||||
*** 1996-02-08
|
||||
|
||||
Update 35. Problem mit Euro-ISDN-Nebenstellenanlagen behoben.
|
||||
Achtung: +000=00-0. in die DP-Zeile, der Punkt am Ende ist nicht ganz
|
||||
unwichtig.
|
||||
|
||||
|
||||
*** 1996-01-05
|
||||
|
||||
Update 34. Weitere Crashprobleme (hoffentlich) beseitigt.
|
||||
Achtung: Alle zutreffenden Keys in TM-Zeilen werden nun geODERt.
|
||||
|
||||
|
||||
*** 1996-01-03
|
||||
|
||||
Update 33. Timer wieder umgestellt. Testcode für automatische Anpassung des
|
||||
Timeouts, noch nicht ausreichend getestet.
|
||||
|
||||
|
||||
*** 1996-01-02
|
||||
|
||||
Update 32. WICHTIG UNBEDINGT INSTALLIEREN. Verbindungen werden nicht
|
||||
korrekt abgebaut!
|
||||
|
||||
Wenn nicht installiert wird: in der ML-Zeile des Timers die Parameter für
|
||||
:ti und :to UNBEDINGT auf GERINGERE Werte als der Abstand zwischeen zwei
|
||||
Gebühreninfos einstellen!
|
||||
|
||||
Ausserdem: Kompatibilitätspatch für die Niederlande.
|
||||
|
||||
|
||||
*** 1996-01-01
|
||||
|
||||
Update 31. Grr, ich solte diese Datei besser pflegen. :-/
|
||||
|
||||
- Ankommende Anrufe funktionieren wieder. (Das taten sie nicht immer...)
|
||||
- Jemand, der gleich wieder auflegt, bringt den master nicht mehr
|
||||
zum Absturz.
|
||||
- Kernelpatch: die BLOCK-Regel des Firewalls wird nur bei lokalen Paketen
|
||||
angewendet und die FORWARD-Regel nur bei weitergereichten Paketen.
|
||||
Vorher: BLOCK wurde auch bei weitergereichten Paketen angewendet.
|
||||
- Neues Flag -x fuer slipto, laesst die lokale Route in Ruhe.
|
||||
Doofer Fehler beim freopen() korrigiert.
|
||||
|
||||
Funktioniert dip jetzt? Bitte testen.
|
||||
|
||||
|
||||
*** 1995-12-04
|
||||
|
||||
Release 25. Die Umstellungsprobleme sind nun (hoffentlich) endlich
|
||||
beseitigt.
|
||||
|
||||
Die Puffergrößen in den Datenströmen wurden drastisch reduziert. Wenn
|
||||
Datenverluste auftreten (zB beim Weiterleiten von IP-Paketen oder beim
|
||||
Empfang von Audiodaten, wenn das lesende Programm zu langsam ist), sollte
|
||||
ein "buffer"-Modul zwischengeschaltet und geeignet konfiguriert werden,
|
||||
sinnvollerweise hinter dem reconn-Modul (IP) bzw. direkt hinter transalaw
|
||||
(Audio).
|
||||
|
||||
|
||||
*** 1995-11-28
|
||||
|
||||
Release 22. Vernünftigeres Beartbeiten des Verbindungsauf/abbaus eingebaut.
|
||||
Unter Kernel 1.3.44: Experimenteller Code, der sk_buff-Blöcke zur
|
||||
Datenspeicherung verwendet, wird aktiviert. Wenn das Probleme macht ->
|
||||
meckern (abschaltbar in streams/stream.h, ganz oben).
|
||||
|
||||
In obskuren Faellen ist es vorgekommen, dass der Rechner stehenbleibt.
|
||||
Meistens wacht er nach einer Minute oder so wieder auf; ich wuerde ganz
|
||||
gerne wissen wo er stehenbleibt... AltGR-ScrollLock druecken, nach einer
|
||||
Minute oder so sollten drei sehr kryptische Zeilen erscheinen. Die Zahl in
|
||||
[<>] gibt die Stelle im Kernel an, an der die Interrupts wieder freigegeben
|
||||
wurden; nachsehen (in /usr/src/linux/Symbols.map bzw. /lib/modules/VERSION/
|
||||
/symbols), mir mailen.
|
||||
|
||||
Es kann sein, dass "echo at/BLA >/dev/isdn/isdnXX" nicht mehr funktioniert.
|
||||
Timingabhaengigkeit im Kernel, sorry. Abhilfe: cu verwenden.
|
||||
|
||||
Wenn es einen User "isdnmaster" gibt, darf dieser mit dem ISDN-Programm
|
||||
alles, was root auch darf. "isdnmaster" ist konfigurierbar.
|
||||
|
||||
WICHTIG: Im D-Kanal-Handling hat sich was geändert. Wenn Anrufe von manchen
|
||||
Leuten funktionieren, Anrufe mit identischen Dienstkennungen von anderen
|
||||
Leuten mit längerer / kürzerer / ohne Nummer (also analog) jedoch nicht,
|
||||
in cards/dumb/shell.c den #if 0...TELL ME (Zeile 1175) in #if 1 ändern;
|
||||
wenn es nach dieser Änderung (und bitte NUR diese Änderung!) wieder
|
||||
funktioniert, bitte bei mir melden.
|
||||
|
||||
Die CM-Zeilen sind weggefallen; die Treiber erkennen nun "frame" etc direkt.
|
||||
Dies als Vorbereitung auf das Erkennen von "frame x75 t70" und Handling
|
||||
desselben auf der Karte, wenn intelligente Karte.
|
||||
|
||||
Das Handling der Treibermodule hat sich geändert: Module vor "reconn"
|
||||
werden jetzt erst beim Verbindungsaufbau geladen; sinnvoll, wenn eine
|
||||
Gegenstelle mehr als eine Nummer hat und dort unterschiedliche Protokolle
|
||||
fährt. (Soll es ja geben...)
|
||||
|
||||
|
||||
*** 1995-11-15
|
||||
|
||||
Release 21. Ditto Bugfixes. Callback funktioniert wieder in beide
|
||||
Richtungen, und nicht nur mit U-ISDN oder mit einer Karte.
|
||||
|
||||
Das Teil ist bei mir im aktiven Einsatz als IP-Router. Also meckert nicht
|
||||
"es funktioniert überhaupt nix", das ist falsch. ;-)
|
||||
|
||||
Nein, ich werde nicht dafür bezahlt, dieses ISDN-Tier zu bauen. Folglich
|
||||
habe ich auch keine Zeit, dieses und jenes Feature in jedem neuen Release
|
||||
neu zu testen. Sorry, aber das ist so. Insbesondere habe ich hier nur noch
|
||||
einen Rechner unter 1.2.x laufen, und den fasse ich momentan nicht an; der
|
||||
Rest ist 1.3.40. Wenn das System nicht unter 1.2 zu kompilieren ist, dann
|
||||
ist das zwar scheußlich, aber ich erwarte, daß sich jemand aufrafft und mir
|
||||
einen diff schickt, weil ich es _nicht_ selber mache(n kann). Sorry, aber
|
||||
so ist es nunmal.
|
||||
|
||||
|
||||
*** 1995-11-1
|
||||
|
||||
Release 20. Bugfixes et al.
|
||||
|
||||
Standleitungen werden nun automatisch wieder aufgebaut, wenn sie als pf
|
||||
gekennzeichnet sind und das übliche reconn und :dI haben.
|
||||
|
||||
Der Kartentreiber meckert, wenn er die Leitung nicht hochkriegt. Abhilfe:
|
||||
an dieser Leitung (manuell) anrufen. Dieser doofe Chip war schonmal
|
||||
einfacher zu programmieren...
|
||||
|
||||
Kartentreiber weg- und wieder reinlinken ist noch problemaitsch. Das kann
|
||||
aber am GCC liegen, gcc 2.7.0 macht Mist mit -O2 -fomit-frame-pointer
|
||||
-m486. Ich habe alles mit -O -m386 gebaut (funktioniert) und für weitere
|
||||
Experimente im Moment keine Zeit (muß PPP für Binteckarten zum Laufen
|
||||
bekommen. Das ist einfach, die haben PPP bereits im Treiber eingebaut.
|
||||
PPP für passive Karten ist aufwendiger, leider).
|
||||
|
||||
Neues Flag ,X in der P-Zeile: es wird X-mal gewählt, bevor die Verbindung
|
||||
gekippt wird (Retry-Zähler).
|
||||
|
||||
Neues Flag ,X in der D-Zeile macht prioritätsgesteuertes Wählen: alle
|
||||
D-Zeilen mit kleinem X werden durchprobiert (bis der Retryzähler ereicht
|
||||
ist), dann alle mit nächsthöherem X. Fehlendes X wird wie Null behandelt,
|
||||
negative Werte sind verboten.
|
||||
|
||||
Mindestens drei Kartenhersteller bekundeten Interesse an einem Modul für
|
||||
meinen Treiber, und ließen dann nie wieder was von sich hören. You know who
|
||||
you are. Es wäre sinnvoll, wenn ein paar von euch die diversen Hersteller
|
||||
mal nerven würden, sie sollen mir eine Karte nebst Doku zur Verfügung
|
||||
stellen, auf daß es bald einen Treiber gebe. Anders wird das nämlich nix.
|
||||
|
||||
Den Sub-Makefiles wird ein -r verpaßt (ignoriere die eingebauten Regeln),
|
||||
weil es sonst in mindestens einem Fall passiert. daß die expliziten Regeln
|
||||
in make.rules ignoriert werden (weil die eingebaute Regel einen Schritt
|
||||
kürzer ist). Grummel.
|
||||
|
||||
Das Masterprogramm wird nun mit -static gelinkt, damit Libraries nicht
|
||||
rausgeswappt werden können. Grr.
|
||||
|
||||
|
||||
*** 1995-11-06
|
||||
|
||||
Release 19. Kleinere Bugfixes, insbesondere funktioniert das Senden von
|
||||
EAZ unter 1TR6 wieder...
|
||||
|
||||
Der Backoff-Algorithmus, wennn die Gegenstelle nicht antwortet, wurde von
|
||||
"konstant oder linear" auf "exponentiell" umgestellt. Sorry, aber das muß
|
||||
so sein -- sonst meckert die Telekomik.
|
||||
|
||||
Der Master spuckt jetzt seine ganzen Debugmeldungen auf stderr aus und
|
||||
protokolliert Statusmeldungen (Gebühreneinheiten) auf stdout.
|
||||
VORHER WAR DAS UMGEKEHRT, das hat manchen Benutzer durcheinandergebracht.
|
||||
|
||||
|
||||
*** 1995-10-30
|
||||
|
||||
Release 17.
|
||||
|
||||
TM-Zeile. Siehe DOKU. Eine angepasste isdn.conf gibt es demnaechst,
|
||||
wenn sie mir nicht jemand macht. ;-)
|
||||
|
||||
BINTEC-Karten. Getestet mit Einfach-BRI-Version; Vierfach-BRI sollte
|
||||
funktionieren, ist aber ungetestet; S2M demnächst, da muß noch was getan
|
||||
werden.
|
||||
|
||||
Neuer DL-Zeilen-Parameter :de, neuer Befehl AT/W: Loggt den
|
||||
D-Kanal-Datenaustausch als cu-Ausgabe mit.
|
||||
|
||||
|
||||
*** 1995-10-24
|
||||
|
||||
Release 15.
|
||||
|
||||
Support fuer intelligente Karten ist _fast_ da, wo er hinsoll...
|
||||
|
||||
GCC 2.7.0 wird empfohlen. Support fuer intelligente Karten geht nicht ohne
|
||||
(wegen attribute((packed)); ich habe keine Lust, die CAPI-Datenstrukturen
|
||||
von Hand zusammenzuschrauben).
|
||||
|
||||
Ansonsten siehe unten. Feedback bitte!
|
||||
|
||||
|
||||
*** 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.
|
||||
|
||||
Wenn es immer noch Probleme beim ISDN-Login gibt: am Anfang von
|
||||
streams/streams_io das #undef in ein #define ändern, isdn_2.o mit
|
||||
"mod2=0x05" installieren, nochmal testen, mir den Syslog-Output schicken
|
||||
(*.debug, NICHT *.=debug !!!). Vorsicht, Paßwörter etc. stehen in diesem
|
||||
Log mit drin!
|
||||
|
||||
Wegen eines Fehlers im GNU-Make kann es passieren, daß "make" oder "make -w"
|
||||
nicht funktioniert. In diesem Fall "make --warn" verwenden.
|
||||
|
||||
|
||||
Die folgenden neuen Features sind noch mehr oder weniger ungetestet:
|
||||
SIGIO-Support.
|
||||
TTY-Code repariert.
|
||||
Starten beliebiger Programme bei Zustandsänderungen (RP-Zeile in der Konfig).
|
||||
Ethertype-Support (noch nicht vollständig).
|
||||
Callback wenn möglich auf derselben Leitung.
|
||||
Callback auf Leitung B, wenn ein Ruf auf A ankommt, dort aber besetzt ist.
|
||||
|
||||
Einigermaßen getestet:
|
||||
Callback. (War das ein Nerv. Manche ISDN-Vermittlungen sind _doof_.)
|
||||
|
||||
Fehlermeldungen reorganisiert.
|
||||
|
||||
|
||||
*** 1995-07-22
|
||||
|
||||
isdn_4/master.c aufgesplittet, Verzeichnisstruktur leicht umgebaut,
|
||||
deshalb leider keine Diffs.
|
||||
|
||||
|
||||
*** 1995-06-12
|
||||
|
||||
Wieder ein paar Bugs weniger.
|
||||
|
||||
Der "arnet"-Treiber ist fuer die synchronen Karten dieser Firma gedacht und
|
||||
noch nicht 100% ausgetestet.
|
||||
|
||||
Wenn jemand Uebermittlung von Gebuehreninformationen waehrend der
|
||||
Verbindung im Euro-ISDN aktiviert hat -> Mail an mich.
|
||||
|
||||
Support fuer Standleitungen: Restart klemmt manchmal.
|
||||
|
||||
Die Patches basieren auf aelteren Kernelversionen und sind nicht besonders
|
||||
sauber...
|
||||
|
||||
Support fuer Kernel 1.3 ist in Arbeit.
|
||||
|
||||
|
||||
*** 1995-02-04
|
||||
|
||||
Euro-ISDN! Relativ rudimentär, sollte aber erstmal tun.
|
||||
(In der Doku steht was von FINGER WEG. Vorsicht -- ich garantiere nicht,
|
||||
daß sich der Kram nicht total danebenbenimmt. Ich wage es aber zu
|
||||
bezweifeln, daß mein Treiber dazu führt, daß der Anschluß gesperrt wird...)
|
||||
|
||||
Support für 128kBit-Standleitungen.
|
||||
|
||||
rm -rf streams/isdn isdn/cards/leonardo (für Leute, die den Patch
|
||||
verwenden).
|
||||
|
||||
|
||||
*** 1995-01-18
|
||||
|
||||
Na endlich... modularisierte Version, basierend auf 1.1.83.
|
||||
_Ohne_ Spezialkram (OK, ein kleines bißchen ;-) nachdem das Linux-TCP/IP
|
||||
endlich einen brauchbaren Status erreicht zu haben scheint.
|
||||
|
||||
|
||||
*** 1994-10-27
|
||||
|
||||
Interimsrelease, basierend auf 1.1.57.
|
||||
In libc.tar.gz beginden sich die letzten 4.5.26-Libraries und Include-
|
||||
dateien, angepaßt auf meinen Kernel. (Die nächste Version, basierend auf
|
||||
4.6.xx, ist weit weniger schlimm.)
|
||||
|
||||
In kernel.tar.gz sind die Quellen fuer den angepassten Kernel, komplett.
|
||||
|
||||
Konfiguration:
|
||||
CONFIG_SCHEDULER_BSD Y
|
||||
CONFIG_INET_BSD N
|
||||
CONFIG_MALLOC_TRACE Y
|
||||
CONFIG_DEBUG_LATENCY N
|
||||
|
||||
Alles andere (fast) wie gewohnt. Ohne MALLOC-TRACE gibt es Probleme mit
|
||||
der Speicherverwaltung; wenn jemand den Fehler findet, immer nur her mit
|
||||
einem Patch.
|
||||
|
||||
INET_BSD braucht BSD-Utilities für die Konfiguration, die ich momentan
|
||||
nicht im Source habe (Plattenfehler).
|
||||
|
||||
Die Übersetzung des Streams-Teils liefert haufenweise Warnings; ignorieren.
|
||||
|
||||
|
||||
*** 1994-08-07
|
||||
|
||||
Die Datei /usr/include/sys/conf.h muss die folgende Zeile enthalten:
|
||||
|
||||
#include <linux/config.h>
|
||||
|
||||
Sorry; dieser Fehler wird mit dem naechsten Update behoben.
|
||||
|
||||
|
||||
*** 1994-08-03
|
||||
|
||||
Patch 38 passt sauber in den Kern.
|
||||
Festverbindungen tun; Patch (inkl. Update auf -38) folgt demnaechst.
|
||||
|
||||
|
||||
*** 1994-08-01
|
||||
|
||||
CONFIG_MALLOC_TRACE funktioniert nicht korrekt (Speicherverluste). Ich
|
||||
arbeite dran.
|
||||
|
||||
|
||||
*** 1994-07-31
|
||||
|
||||
Festverbindungen werden unterstützt.
|
||||
Diffs auf PL37 generiert.
|
||||
Networking-Code generiert.
|
||||
include- und libc-Diffs generiert.
|
||||
|
||||
|
||||
*** 1994-07-29
|
||||
|
||||
In der Datei streams/isdn/config/config.data muss die Variable STR_IN von
|
||||
"in2" auf "linux" geaendert werden, wenn mit Linux-Networking gearbeitet
|
||||
werden soll.
|
||||
|
||||
|
||||
*** 1994-07-27
|
||||
|
||||
Patch 36 läßt sich problemlos einspielen.
|
||||
|
||||
|
||||
*** 1994-07-26
|
||||
|
||||
Die Datei "kernel-1.1.35.diff.gz" enthält die Diffs zu meinem Kernel.
|
||||
"streams-1.1.35.tar.gz" enthält den Streams-Teil (notwendig!).
|
||||
|
||||
Warnung: Da ich selber leicht modifizierte Includedateien unter
|
||||
/usr/include einsetze, kann es sein, daß die Kompilation nicht
|
||||
durchläuft... in diesem Fall bitte Mail an mich.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
Euro-ISDN
|
||||
Hauptprogramm gewaltig aufraeumen
|
||||
PPP einbauen.
|
||||
Hauptprogramm weiter aufraeumen
|
||||
Protokollstack vom Hauptmodul aus aufbauen
|
||||
Anklinken anderer Treiber (intelligente ISDN-Karten, serielle Schnittstellen)
|
||||
Mehr Features fuer 1TR6
|
||||
|
@ -9,7 +9,6 @@ proto-Treiber um Signalisierung erweitern
|
|||
DOKU verbessern (jaja...)
|
||||
|
||||
Bekannte Fehler:
|
||||
Gelegentlich vergisst das System, eine L3-Connection freizugeben
|
||||
Das Handling von knappen Streams-Datenbloecken ist verbesserungsbeduerftig.
|
||||
|
||||
Moegliche Probleme:
|
Binary file not shown.
|
@ -0,0 +1,7 @@
|
|||
|
||||
KERNEL=1
|
||||
SUBDIRS=tools
|
||||
|
||||
TOPDIR=..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
|
@ -9,16 +9,12 @@
|
|||
|
||||
#include "f_module.h"
|
||||
#include "primitives.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include "kernel.h"
|
||||
#include "f_signal.h"
|
||||
#include "f_malloc.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include "streams.h"
|
||||
#include <sys/stropts.h>
|
||||
#include "stropts.h"
|
||||
/* #include <sys/user.h> */
|
||||
#include <sys/errno.h>
|
||||
#include "streamlib.h"
|
||||
#include "alaw.h"
|
||||
#include "isdn_proto.h"
|
||||
|
@ -27,14 +23,9 @@
|
|||
/*
|
||||
* Standard Streams stuff.
|
||||
*/
|
||||
static struct module_info alaw_minfo_w =
|
||||
static struct module_info alaw_minfo =
|
||||
{
|
||||
0, "alaw", 0, INFPSZ, 4000, 1000
|
||||
};
|
||||
|
||||
static struct module_info alaw_minfo_r =
|
||||
{
|
||||
0, "alaw", 0, INFPSZ, 10000, 2000
|
||||
0, "alaw", 0, INFPSZ, 200,100
|
||||
};
|
||||
|
||||
static qf_open alaw_open;
|
||||
|
@ -44,12 +35,12 @@ static qf_srv alaw_rsrv, alaw_wsrv;
|
|||
|
||||
static struct qinit alaw_rinit =
|
||||
{
|
||||
alaw_rput, alaw_rsrv, alaw_open, alaw_close, NULL, &alaw_minfo_r, NULL
|
||||
alaw_rput, alaw_rsrv, alaw_open, alaw_close, NULL, &alaw_minfo, NULL
|
||||
};
|
||||
|
||||
static struct qinit alaw_winit =
|
||||
{
|
||||
alaw_wput, alaw_wsrv, NULL, NULL, NULL, &alaw_minfo_w, NULL
|
||||
alaw_wput, alaw_wsrv, NULL, NULL, NULL, &alaw_minfo, NULL
|
||||
};
|
||||
|
||||
struct streamtab alawinfo =
|
||||
|
@ -91,9 +82,10 @@ alaw_proto (queue_t * q, mblk_t * mp)
|
|||
struct alaw_ *alaw = (struct alaw_ *) q->q_ptr;
|
||||
streamchar *origmp = mp->b_rptr;
|
||||
ushort_t id;
|
||||
int error = 0;
|
||||
|
||||
/* In case we want to printf("%s") this... */
|
||||
if (mp->b_wptr < mp->b_datap->db_lim)
|
||||
if (mp->b_wptr < DATA_END(mp))
|
||||
*mp->b_wptr = '\0';
|
||||
if (m_getid (mp, &id) != 0) {
|
||||
mp->b_rptr = origmp;
|
||||
|
@ -107,53 +99,50 @@ alaw_proto (queue_t * q, mblk_t * mp)
|
|||
|
||||
while (mp != NULL && m_getsx (mp, &id) == 0)
|
||||
switch (id) {
|
||||
err:
|
||||
printf (" :Err %s\n", mp->b_rptr);
|
||||
mp->b_rptr = origmp;
|
||||
freemsg (mp);
|
||||
mp = NULL;
|
||||
default:
|
||||
goto err;
|
||||
case PROTO_MODULE:
|
||||
break;
|
||||
case ALAW_LAW:
|
||||
printf ("ALAW: Only A-Law supported\n");
|
||||
goto err;
|
||||
case ALAW_RVCO_ON:
|
||||
if (m_geti (mp, &z) != 0)
|
||||
if ((error = m_geti (mp, &z)) != 0)
|
||||
goto err;
|
||||
if (z < 0 || z > 127)
|
||||
goto err;
|
||||
alaw->r.on = z;
|
||||
break;
|
||||
case ALAW_RVCO_OFF:
|
||||
if (m_geti (mp, &z) != 0)
|
||||
if ((error = m_geti (mp, &z)) != 0)
|
||||
goto err;
|
||||
if (z < 0 || z > 127)
|
||||
goto err;
|
||||
alaw->r.off = z;
|
||||
break;
|
||||
case ALAW_RVCO_CNT:
|
||||
if (m_geti (mp, &z) != 0)
|
||||
if ((error = m_geti (mp, &z)) != 0)
|
||||
goto err;
|
||||
if (z < 50 || z > 65535)
|
||||
goto err;
|
||||
alaw->r.count = z;
|
||||
break;
|
||||
case ALAW_XVCO_ON:
|
||||
if (m_geti (mp, &z) != 0)
|
||||
if ((error = m_geti (mp, &z)) != 0)
|
||||
goto err;
|
||||
if (z < 0 || z > 127)
|
||||
goto err;
|
||||
alaw->w.on = z;
|
||||
break;
|
||||
case ALAW_XVCO_OFF:
|
||||
if (m_geti (mp, &z) != 0)
|
||||
if ((error = m_geti (mp, &z)) != 0)
|
||||
goto err;
|
||||
if (z < 0 || z > 127)
|
||||
goto err;
|
||||
alaw->w.off = z;
|
||||
break;
|
||||
case ALAW_XVCO_CNT:
|
||||
if (m_geti (mp, &z) != 0)
|
||||
if ((error = m_geti (mp, &z)) != 0)
|
||||
goto err;
|
||||
if (z < 50 || z > 65535)
|
||||
goto err;
|
||||
|
@ -173,6 +162,10 @@ alaw_proto (queue_t * q, mblk_t * mp)
|
|||
mp->b_rptr = origmp;
|
||||
putnext (q, mp);
|
||||
}
|
||||
return;
|
||||
err:
|
||||
mp->b_rptr = origmp;
|
||||
m_reply (q, mp, error ? error : -EINVAL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -205,7 +198,7 @@ alaw_mute (mblk_t * mb, struct _vco *vco)
|
|||
|
||||
if (mz != NULL) {
|
||||
short sz;
|
||||
mz->b_datap->db_type = mb->b_datap->db_type;
|
||||
DATA_TYPE(mz) = DATA_TYPE(mb);
|
||||
|
||||
bcopy (mb->b_rptr, mz->b_wptr, (sz = blkend - (uchar_t *) mb->b_rptr));
|
||||
mz->b_wptr += sz;
|
||||
|
@ -282,17 +275,13 @@ static char cswap[256] =
|
|||
|
||||
/* Streams code to open the driver. */
|
||||
static int
|
||||
alaw_open (queue_t * q, dev_t dev, int flag, int sflag
|
||||
#ifdef DO_ADDERROR
|
||||
,int *err
|
||||
#endif
|
||||
)
|
||||
alaw_open (queue_t * q, dev_t dev, int flag, int sflag ERR_DECL)
|
||||
{
|
||||
register struct alaw_ *alaw;
|
||||
|
||||
alaw = malloc(sizeof(*alaw));
|
||||
if(alaw == NULL)
|
||||
return OPENFAIL;
|
||||
ERR_RETURN(-ENOMEM);
|
||||
memset(alaw,0,sizeof(*alaw));
|
||||
|
||||
WR (q)->q_ptr = (char *) alaw;
|
||||
|
@ -301,9 +290,6 @@ alaw_open (queue_t * q, dev_t dev, int flag, int sflag
|
|||
alaw->q = q;
|
||||
alaw__init (alaw);
|
||||
|
||||
if (0)
|
||||
printf ("ALAW pseudo-driver %d opened.\n", dev);
|
||||
|
||||
MORE_USE;
|
||||
return 0;
|
||||
}
|
||||
|
@ -318,8 +304,7 @@ alaw_close (queue_t * q, int dummy)
|
|||
|
||||
flushq (q, FLUSHALL);
|
||||
flushq (WR (q), FLUSHALL);
|
||||
if (0)
|
||||
printf ("ALAW driver closed.\n");
|
||||
|
||||
free(alaw);
|
||||
LESS_USE;
|
||||
return;
|
||||
|
@ -330,20 +315,18 @@ alaw_close (queue_t * q, int dummy)
|
|||
static void
|
||||
alaw_wput (queue_t * q, mblk_t * mp)
|
||||
{
|
||||
switch (mp->b_datap->db_type) {
|
||||
switch (DATA_TYPE(mp)) {
|
||||
case MSG_PROTO:
|
||||
CASE_DATA
|
||||
case CASE_DATA:
|
||||
putq (q, mp);
|
||||
break;
|
||||
case M_FLUSH:
|
||||
if (*mp->b_rptr & FLUSHW)
|
||||
flushq (q, FLUSHDATA);
|
||||
/* FALL THRU */
|
||||
default:
|
||||
putnext (q, mp);
|
||||
break;
|
||||
default:{
|
||||
putnext (q, mp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -356,11 +339,12 @@ alaw_wsrv (queue_t * q)
|
|||
mblk_t *mp;
|
||||
|
||||
while ((mp = getq (q)) != NULL) {
|
||||
switch (mp->b_datap->db_type) {
|
||||
switch (DATA_TYPE(mp)) {
|
||||
case MSG_PROTO:
|
||||
alaw_proto (q, mp);
|
||||
break;
|
||||
CASE_DATA {
|
||||
case CASE_DATA:
|
||||
{
|
||||
mblk_t *mr;
|
||||
|
||||
if (!canput (q->q_next)) {
|
||||
|
@ -388,7 +372,7 @@ alaw_wsrv (queue_t * q)
|
|||
flushq (q, FLUSHDATA);
|
||||
/* FALL THRU */
|
||||
default:
|
||||
if (mp->b_datap->db_type > QPCTL || canput (q->q_next)) {
|
||||
if (DATA_TYPE(mp) > QPCTL || canput (q->q_next)) {
|
||||
putnext (q, mp);
|
||||
continue;
|
||||
} else {
|
||||
|
@ -404,7 +388,7 @@ alaw_wsrv (queue_t * q)
|
|||
static void
|
||||
alaw_rput (queue_t * q, mblk_t * mp)
|
||||
{
|
||||
switch (mp->b_datap->db_type) {
|
||||
switch (DATA_TYPE(mp)) {
|
||||
|
||||
case M_FLUSH:
|
||||
if (*mp->b_rptr & FLUSHR) {
|
||||
|
@ -413,7 +397,7 @@ alaw_rput (queue_t * q, mblk_t * mp)
|
|||
putnext (q, mp); /* send it along too */
|
||||
break;
|
||||
case MSG_PROTO:
|
||||
CASE_DATA
|
||||
case CASE_DATA:
|
||||
putq (q, mp); /* queue it for my service routine */
|
||||
break;
|
||||
|
||||
|
@ -433,11 +417,12 @@ alaw_rsrv (queue_t * q)
|
|||
register struct alaw_ *alaw = (struct alaw_ *) q->q_ptr;
|
||||
|
||||
while ((mp = getq (q)) != NULL) {
|
||||
switch (mp->b_datap->db_type) {
|
||||
switch (DATA_TYPE(mp)) {
|
||||
case MSG_PROTO:
|
||||
alaw_proto (q, mp);
|
||||
break;
|
||||
CASE_DATA {
|
||||
case CASE_DATA:
|
||||
{
|
||||
mblk_t *mr;
|
||||
|
||||
if (!canput (q->q_next)) {
|
||||
|
@ -459,12 +444,13 @@ alaw_rsrv (queue_t * q)
|
|||
}
|
||||
if ((mr = alaw_mute (mp, &alaw->r)) != NULL)
|
||||
putnext (q, mr);
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case M_HANGUP:
|
||||
case M_ERROR:
|
||||
/* FALL THRU */
|
||||
default:
|
||||
if (mp->b_datap->db_type > QPCTL || canput (q->q_next)) {
|
||||
if (DATA_TYPE(mp) > QPCTL || canput (q->q_next)) {
|
||||
putnext (q, mp);
|
||||
continue;
|
||||
} else {
|
|
@ -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,
|
||||
}
|
||||
};
|
|
@ -0,0 +1,5 @@
|
|||
PROGRAMS = toalaw tosnd
|
||||
|
||||
TOPDIR=../..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#ifdef linux
|
||||
#include <linux/syscompat.h>
|
||||
#include <compat.h>
|
||||
#endif
|
||||
|
||||
short mx[] = {16,32,64,128,256,512,1024,2048};
|
|
@ -11,7 +11,7 @@
|
|||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#ifdef linux
|
||||
#include <linux/syscompat.h>
|
||||
#include <compat.h>
|
||||
#endif
|
||||
|
||||
short mult[] = {2,2,4,8,16,32,64,128};
|
|
@ -0,0 +1,5 @@
|
|||
KERNEL=1
|
||||
|
||||
TOPDIR=..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
|
@ -0,0 +1,272 @@
|
|||
/**
|
||||
** Streams BUF module
|
||||
**/
|
||||
|
||||
#include "f_module.h"
|
||||
#include "primitives.h"
|
||||
#include "kernel.h"
|
||||
#include "f_signal.h"
|
||||
#include "f_malloc.h"
|
||||
#include "streams.h"
|
||||
#include "stropts.h"
|
||||
#ifdef DONT_ADDERROR
|
||||
#include "f_user.h"
|
||||
#endif
|
||||
#include "streamlib.h"
|
||||
#include "buffer.h"
|
||||
#include "isdn_proto.h"
|
||||
|
||||
|
||||
/*
|
||||
* Standard Streams stuff.
|
||||
*/
|
||||
static struct module_info buf_minfo =
|
||||
{
|
||||
0, "buffer", 0, INFPSZ, 4096, 2048
|
||||
};
|
||||
|
||||
static qf_open buf_open;
|
||||
static qf_close buf_close;
|
||||
static qf_put buf_rput,buf_wput;
|
||||
static qf_srv buf_rsrv,buf_wsrv;
|
||||
|
||||
static struct qinit buf_rinit =
|
||||
{
|
||||
buf_rput, buf_rsrv, buf_open, buf_close, NULL, &buf_minfo, NULL
|
||||
};
|
||||
|
||||
static struct qinit buf_winit =
|
||||
{
|
||||
buf_wput, buf_wsrv, NULL, NULL, NULL, &buf_minfo, NULL
|
||||
};
|
||||
|
||||
struct streamtab bufinfo =
|
||||
{&buf_rinit, &buf_winit, NULL, NULL};
|
||||
|
||||
/* Streams code to open the driver. */
|
||||
static int
|
||||
buf_open (queue_t * q, dev_t dev, int flag, int sflag ERR_DECL)
|
||||
{
|
||||
if (q->q_ptr) {
|
||||
return 0;
|
||||
}
|
||||
/* do nothing... */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Streams code to close the driver. */
|
||||
static void
|
||||
buf_close (queue_t * q, int dummy)
|
||||
{
|
||||
flushq (q, FLUSHALL);
|
||||
flushq (WR (q), FLUSHALL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
buf_proto (queue_t * q, mblk_t * mp, char down)
|
||||
{
|
||||
streamchar *origmp = mp->b_rptr;
|
||||
ushort_t id;
|
||||
int error = 0;
|
||||
|
||||
if (m_getid (mp, &id) != 0) {
|
||||
mp->b_rptr = origmp;
|
||||
putnext (q, mp);
|
||||
return;
|
||||
}
|
||||
switch (id) {
|
||||
default:
|
||||
break;
|
||||
case PROTO_MODULE:
|
||||
if (strnamecmp (q, mp)) { /* Config information for me. */
|
||||
long z;
|
||||
|
||||
while (mp != NULL && m_getsx (mp, &id) == 0) {
|
||||
switch (id) {
|
||||
default:
|
||||
goto err;
|
||||
case PROTO_MODULE:
|
||||
break;
|
||||
case BUF_UP:
|
||||
if ((error = m_geti (mp, &z)) != 0)
|
||||
goto err;
|
||||
if ((z < 10) || (z > 32*1024))
|
||||
goto err;
|
||||
RDQ(q)->q_flag |= QWANTR;
|
||||
RDQ(q)->q_hiwat = z;
|
||||
RDQ(q)->q_lowat = z>>2;
|
||||
qenable(RDQ(q));
|
||||
break;
|
||||
case BUF_DOWN:
|
||||
if ((error = m_geti (mp, &z)) != 0)
|
||||
goto err;
|
||||
if ((z < 10) || (z > 32*1024))
|
||||
goto err;
|
||||
WRQ(q)->q_flag |= QWANTR;
|
||||
WRQ(q)->q_hiwat = z;
|
||||
WRQ(q)->q_lowat = z>>2;
|
||||
qenable(WRQ(q));
|
||||
break;
|
||||
case BUF_BOTH:
|
||||
if ((error = m_geti (mp, &z)) != 0)
|
||||
goto err;
|
||||
if ((z < 10) || (z > 32*1024))
|
||||
goto err;
|
||||
RDQ(q)->q_flag |= QWANTR;
|
||||
WRQ(q)->q_flag |= QWANTR;
|
||||
RDQ(q)->q_hiwat = z;
|
||||
WRQ(q)->q_hiwat = z;
|
||||
RDQ(q)->q_lowat = z>>2;
|
||||
WRQ(q)->q_lowat = z>>2;
|
||||
qenable(RDQ(q));
|
||||
qenable(WRQ(q));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (mp != NULL) {
|
||||
mp->b_rptr = origmp;
|
||||
m_reply(q,mp,0);
|
||||
mp = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(mp != NULL) {
|
||||
if (origmp != NULL)
|
||||
mp->b_rptr = origmp;
|
||||
putnext(q,mp);
|
||||
}
|
||||
return;
|
||||
err:
|
||||
mp->b_rptr = origmp;
|
||||
m_reply (q, mp, error ? error : -EINVAL);
|
||||
}
|
||||
|
||||
|
||||
/* Streams code to write data. */
|
||||
static void
|
||||
buf_wput (queue_t * q, mblk_t * mp)
|
||||
{
|
||||
switch (DATA_TYPE(mp)) {
|
||||
case MSG_PROTO:
|
||||
case CASE_DATA:
|
||||
putq (q, mp);
|
||||
break;
|
||||
case M_FLUSH:
|
||||
if (*mp->b_rptr & FLUSHW)
|
||||
flushq (q, FLUSHDATA);
|
||||
putnext (q, mp);
|
||||
break;
|
||||
default:
|
||||
putnext (q, mp);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* Streams code to scan the write queue. */
|
||||
static void
|
||||
buf_wsrv (queue_t * q)
|
||||
{
|
||||
mblk_t *mp;
|
||||
|
||||
while ((mp = getq (q)) != NULL) {
|
||||
switch (DATA_TYPE(mp)) {
|
||||
case MSG_PROTO:
|
||||
buf_proto (q, mp, 1);
|
||||
break;
|
||||
case CASE_DATA:
|
||||
if (!canput (q->q_next)) {
|
||||
putbq (q, mp);
|
||||
return;
|
||||
}
|
||||
putnext (q, mp);
|
||||
break;
|
||||
case M_FLUSH:
|
||||
if (*mp->b_rptr & FLUSHW)
|
||||
flushq (q, FLUSHDATA);
|
||||
/* FALL THRU */
|
||||
default:
|
||||
if (DATA_TYPE(mp) > QPCTL || canput (q->q_next)) {
|
||||
putnext (q, mp);
|
||||
continue;
|
||||
} else {
|
||||
putbq (q, mp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* Streams code to read data. */
|
||||
static void
|
||||
buf_rput (queue_t * q, mblk_t * mp)
|
||||
{
|
||||
switch (DATA_TYPE(mp)) {
|
||||
|
||||
case M_FLUSH:
|
||||
if (*mp->b_rptr & FLUSHR) {
|
||||
flushq (q, FLUSHDATA);
|
||||
}
|
||||
putnext (q, mp); /* send it along too */
|
||||
break;
|
||||
case MSG_PROTO:
|
||||
case CASE_DATA:
|
||||
putq (q, mp); /* queue it for my service routine */
|
||||
break;
|
||||
|
||||
default:
|
||||
putq (q, mp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* Streams code to scan the read queue. */
|
||||
static void
|
||||
buf_rsrv (queue_t * q)
|
||||
{
|
||||
mblk_t *mp;
|
||||
|
||||
while ((mp = getq (q)) != NULL) {
|
||||
switch (DATA_TYPE(mp)) {
|
||||
case MSG_PROTO:
|
||||
buf_proto (q, mp, 0);
|
||||
break;
|
||||
case CASE_DATA:
|
||||
if (!canput (q->q_next)) {
|
||||
putbq (q, mp);
|
||||
return;
|
||||
}
|
||||
putnext (q, mp);
|
||||
break;
|
||||
case M_HANGUP:
|
||||
case M_ERROR:
|
||||
/* FALL THRU */
|
||||
default:
|
||||
if (DATA_TYPE(mp) > QPCTL || canput (q->q_next)) {
|
||||
putnext (q, mp);
|
||||
continue;
|
||||
} else {
|
||||
putbq (q, mp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
static int do_init_module(void)
|
||||
{
|
||||
return register_strmod(&bufinfo);
|
||||
}
|
||||
|
||||
static int do_exit_module(void)
|
||||
{
|
||||
return unregister_strmod(&bufinfo);
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef _BUF_H
|
||||
#define _BUF_H
|
||||
|
||||
#define NT70 15
|
||||
#define BUF_mtu 256
|
||||
|
||||
#include "primitives.h"
|
||||
|
||||
#define BUF_UP CHAR2('b','r') /* buffer size, upstream */
|
||||
#define BUF_DOWN CHAR2('b','w') /* buffer size, downstream */
|
||||
#define BUF_BOTH CHAR2('b','b') /* buffer size, both directions */
|
||||
|
||||
#endif /* _BUF_H */
|
|
@ -0,0 +1,12 @@
|
|||
TOPDIR=..
|
||||
include $(TOPDIR)/Make.config
|
||||
|
||||
KERNEL=1
|
||||
REALSOURCE=loader.c
|
||||
OBJS=$(addsuffix .o,$(CARDS))
|
||||
EXTRA_CFLAGS= -DCARDTYPE=$(basename $@ .o)
|
||||
|
||||
SUBDIRS=capi dumb arnet
|
||||
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
|
@ -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,7 @@
|
|||
all::
|
||||
|
||||
DOCARDS=1
|
||||
|
||||
TOPDIR=../..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,75 @@
|
|||
#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;
|
||||
mblk_t *in_more;
|
||||
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
|
||||
|
||||
struct _smallq q_unknown;
|
||||
|
||||
char unknown_timer; char registered;
|
||||
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,9 @@
|
|||
all::
|
||||
|
||||
DOCARDS=1
|
||||
REALSOURCE=shell.c
|
||||
SOURCES=avm.c ncp.c teles.c ncp16.c bsc.c teles3.c creatixpnp.c
|
||||
|
||||
TOPDIR=../..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
|
@ -1,71 +1,80 @@
|
|||
inline static Byte InISAC(struct _dumb * dumb, char offset) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
inline static Byte Slot(struct _dumb * dumb, u_char hscx) {
|
||||
inline static Byte
|
||||
Slot(struct _dumb * dumb, u_char hscx) {
|
||||
printf(" Slot %d: ",hscx);
|
||||
return (hscx&1) ? 0x2F : 0x03;
|
||||
}
|
||||
|
||||
static int Init(struct _dumb * dumb) {
|
||||
static int
|
||||
Init(struct _dumb * dumb) {
|
||||
int timout;
|
||||
long flags;
|
||||
Byte foo;
|
||||
unsigned int step = 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);
|
||||
|
@ -73,8 +82,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;
|
||||
|
@ -104,27 +113,28 @@ static int Init(struct _dumb * dumb) {
|
|||
default:
|
||||
def:
|
||||
printf(" AIRQR %02x, step %d ",foo,step);
|
||||
return 0;
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
Exit:
|
||||
|
||||
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);
|
||||
return 1;
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x04);
|
||||
ByteOut(dumb->info.ioaddr+0x1800,0x08);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void InitISAC(struct _dumb * dumb)
|
||||
static void
|
||||
InitISAC(struct _dumb * dumb)
|
||||
{
|
||||
dumb->chan[0].mode = M_OFF;
|
||||
dumb->chan[0].listen = 0;
|
||||
|
@ -140,7 +150,8 @@ static void InitISAC(struct _dumb * dumb)
|
|||
ByteOutISAC(dumb, CIX0, 0x03);
|
||||
}
|
||||
|
||||
static void InitHSCX_(struct _dumb * dumb, u_char hscx)
|
||||
static void
|
||||
InitHSCX_(struct _dumb * dumb, u_char hscx)
|
||||
{
|
||||
ByteOutHSCX(dumb,hscx,TSAX, Slot(dumb,hscx));
|
||||
ByteOutHSCX(dumb,hscx,TSAR, Slot(dumb,hscx));
|
||||
|
@ -161,64 +172,10 @@ static void InitHSCX_(struct _dumb * dumb, u_char hscx)
|
|||
ByteOutHSCX(dumb,hscx,MASK, 0x00);
|
||||
}
|
||||
|
||||
static void ISAC_mode(struct _dumb * dumb, Byte mode, Byte listen)
|
||||
static int
|
||||
HSCX_mode(struct _dumb * dumb, u_char hscx, Byte mode, Byte listen)
|
||||
{
|
||||
unsigned long ms = SetSPL(dumb->ipl);
|
||||
|
||||
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;
|
||||
}
|
||||
if(dumb->chan[0].m_out != NULL) {
|
||||
freemsg(dumb->chan[0].m_out);
|
||||
dumb->chan[0].m_out = dumb->chan[0].m_out_run = NULL;
|
||||
}
|
||||
ByteOutISAC(dumb,CMDR,0x41);
|
||||
|
||||
switch(mode) {
|
||||
case M_OFF:
|
||||
printk(KERN_DEBUG "CIX0 0x3F\n");
|
||||
ByteOutISAC(dumb,CIX0,0x3F);
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,0);
|
||||
dumb->chan[0].mode = mode;
|
||||
break;
|
||||
case M_STANDBY:
|
||||
if(dumb->chan[0].mode != M_STANDBY) {
|
||||
ByteOutISAC(dumb,MODE,0xC9);
|
||||
printk(KERN_DEBUG "CIX0 0x03\n");
|
||||
ByteOutISAC(dumb,CIX0,0x03);
|
||||
}
|
||||
else printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
dumb->chan[0].mode = mode;
|
||||
dumb->chan[0].listen = 1;
|
||||
break;
|
||||
case M_HDLC:
|
||||
ByteOutISAC(dumb,MODE,0xC9);
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
if(dumb->chan[0].mode != M_HDLC) {
|
||||
printk(KERN_DEBUG "CIX0 0x27\n");
|
||||
ByteOutISAC(dumb,CIX0,0x27);
|
||||
} else {
|
||||
printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,1);
|
||||
}
|
||||
#if 0
|
||||
ByteOutISAC(dumb,TIMR,0x11);
|
||||
ByteOutISAC(dumb,CMDR,0x10);
|
||||
#endif
|
||||
dumb->chan[0].mode = mode;
|
||||
dumb->chan[0].listen = 0;
|
||||
break;
|
||||
default:
|
||||
printf("ISAC unknown mode %x\n",mode);
|
||||
}
|
||||
splx(ms);
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -296,22 +253,23 @@ static int HSCX_mode(struct _dumb * dumb, u_char hscx, Byte mode, Byte listen)
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
inline static void PostIRQ(struct _dumb * dumb)
|
||||
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,16 +28,19 @@ static int Init(struct _dumb * dumb) {
|
|||
int timout;
|
||||
long flags;
|
||||
|
||||
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);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
static void InitISAC(struct _dumb * dumb)
|
||||
{
|
||||
|
@ -76,64 +79,10 @@ static void InitHSCX_(struct _dumb * dumb, unsigned char hscx)
|
|||
ByteOutHSCX(dumb,hscx,MASK, 0x00);
|
||||
}
|
||||
|
||||
static void ISAC_mode(struct _dumb * dumb, Byte mode, Byte listen)
|
||||
static int
|
||||
HSCX_mode(struct _dumb * dumb, unsigned char hscx, Byte mode, Byte listen)
|
||||
{
|
||||
unsigned long ms = SetSPL(dumb->ipl);
|
||||
|
||||
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;
|
||||
}
|
||||
if(dumb->chan[0].m_out != NULL) {
|
||||
freemsg(dumb->chan[0].m_out);
|
||||
dumb->chan[0].m_out = dumb->chan[0].m_out_run = NULL;
|
||||
}
|
||||
ByteOutISAC(dumb,CMDR,0x41);
|
||||
|
||||
switch(mode) {
|
||||
case M_OFF:
|
||||
printk(KERN_DEBUG "CIX0 0x3F\n");
|
||||
ByteOutISAC(dumb,CIX0,0x3F);
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,0);
|
||||
dumb->chan[0].mode = mode;
|
||||
break;
|
||||
case M_STANDBY:
|
||||
if(dumb->chan[0].mode != M_STANDBY) {
|
||||
ByteOutISAC(dumb,MODE,0xCA);
|
||||
printk(KERN_DEBUG "CIX0 0x03\n");
|
||||
ByteOutISAC(dumb,CIX0,0x03);
|
||||
}
|
||||
else printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
dumb->chan[0].mode = mode;
|
||||
dumb->chan[0].listen = 1;
|
||||
break;
|
||||
case M_HDLC:
|
||||
ByteOutISAC(dumb,MODE,0xCA);
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
if(dumb->chan[0].mode != M_HDLC) {
|
||||
printk(KERN_DEBUG "CIX0 0x27\n");
|
||||
ByteOutISAC(dumb,CIX0,0x27);
|
||||
} else {
|
||||
printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,1);
|
||||
}
|
||||
#if 0
|
||||
ByteOutISAC(dumb,TIMR,0x11);
|
||||
ByteOutISAC(dumb,CMDR,0x10);
|
||||
#endif
|
||||
dumb->chan[0].mode = mode;
|
||||
dumb->chan[0].listen = 0;
|
||||
break;
|
||||
default:
|
||||
printf("ISAC unknown mode %x\n",mode);
|
||||
}
|
||||
splx(ms);
|
||||
}
|
||||
|
||||
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;
|
|
@ -1,51 +1,61 @@
|
|||
inline static void PostIRQ(struct _dumb * dumb)
|
||||
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);
|
||||
inline static Byte
|
||||
InISAC(struct _dumb * dumb, char offset) {
|
||||
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);
|
||||
inline static void
|
||||
OutISAC(struct _dumb * dumb, char offset, Byte 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);
|
||||
inline static Byte
|
||||
InHSCX(struct _dumb * dumb, unsigned char hscx, char offset) {
|
||||
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);
|
||||
inline static void
|
||||
OutHSCX(struct _dumb * dumb, unsigned char hscx, char offset, Byte 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) {
|
||||
inline static Byte
|
||||
Slot(struct _dumb * dumb, unsigned char hscx) {
|
||||
printf(" Slot %d: ",hscx);
|
||||
return (hscx&1) ? 0x2F : 0x03;
|
||||
}
|
||||
|
||||
static int Init(struct _dumb * dumb) {
|
||||
static int
|
||||
Init(struct _dumb * dumb) {
|
||||
int timout;
|
||||
long flags;
|
||||
char iflag;
|
||||
|
||||
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);
|
||||
return 0;
|
||||
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;
|
||||
|
@ -56,14 +66,15 @@ static int Init(struct _dumb * dumb) {
|
|||
case 15:iflag = 3; break;
|
||||
case 0: iflag = 7; break;
|
||||
default:
|
||||
printf (" impossible irq %d ",dumb->irq);
|
||||
return 0;
|
||||
printf (" impossible irq %d ",dumb->info.irq);
|
||||
return -EINVAL;
|
||||
}
|
||||
ByteOut(dumb->ioaddr,(iflag<<5));
|
||||
return 1;
|
||||
ByteOut(dumb->info.ioaddr,(iflag<<5));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void InitISAC(struct _dumb * dumb)
|
||||
static void
|
||||
InitISAC(struct _dumb * dumb)
|
||||
{
|
||||
dumb->chan[0].mode = M_OFF;
|
||||
dumb->chan[0].listen = 0;
|
||||
|
@ -79,7 +90,8 @@ static void InitISAC(struct _dumb * dumb)
|
|||
ByteOutISAC(dumb, MASK, 0x00);
|
||||
}
|
||||
|
||||
static void InitHSCX_(struct _dumb * dumb, unsigned char hscx)
|
||||
static void
|
||||
InitHSCX_(struct _dumb * dumb, unsigned char hscx)
|
||||
{
|
||||
ByteOutHSCX(dumb,hscx,CCR0, 0x80);
|
||||
ByteOutHSCX(dumb,hscx,CCR1, 0x85);
|
||||
|
@ -103,67 +115,10 @@ static void InitHSCX_(struct _dumb * dumb, unsigned char hscx)
|
|||
ByteOutHSCX(dumb,hscx,IMR1, 0x00);
|
||||
}
|
||||
|
||||
static int ISAC_mode(struct _dumb * dumb, Byte mode, Byte listen)
|
||||
static int
|
||||
HSCX_mode(struct _dumb * dumb, unsigned char hscx, Byte mode, Byte listen)
|
||||
{
|
||||
unsigned long ms = SetSPL(dumb->ipl);
|
||||
|
||||
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;
|
||||
}
|
||||
if(dumb->chan[0].m_out != NULL) {
|
||||
freemsg(dumb->chan[0].m_out);
|
||||
dumb->chan[0].m_out = dumb->chan[0].m_out_run = NULL;
|
||||
}
|
||||
ByteOutISAC(dumb,CMDR,0x41);
|
||||
|
||||
switch(mode) {
|
||||
case M_OFF:
|
||||
printk(KERN_DEBUG "CIX0 0x3F\n");
|
||||
ByteOutISAC(dumb,CIX0,0x3F);
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,0);
|
||||
dumb->chan[0].mode = mode;
|
||||
break;
|
||||
case M_STANDBY:
|
||||
if(dumb->chan[0].mode != M_STANDBY) {
|
||||
ByteOutISAC(dumb,MODE,0xCA);
|
||||
printk(KERN_DEBUG "CIX0 0x03\n");
|
||||
ByteOutISAC(dumb,CIX0,0x03);
|
||||
}
|
||||
else printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
dumb->chan[0].mode = mode;
|
||||
dumb->chan[0].listen = 1;
|
||||
break;
|
||||
case M_HDLC:
|
||||
ByteOutISAC(dumb,MODE,0xCA);
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
if(dumb->chan[0].mode != M_HDLC) {
|
||||
printk(KERN_DEBUG "CIX0 0x27\n");
|
||||
ByteOutISAC(dumb,CIX0,0x27);
|
||||
} else {
|
||||
printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,1);
|
||||
}
|
||||
#if 0
|
||||
ByteOutISAC(dumb,TIMR,0x11);
|
||||
ByteOutISAC(dumb,CMDR,0x10);
|
||||
#endif
|
||||
dumb->chan[0].mode = mode;
|
||||
dumb->chan[0].listen = 0;
|
||||
break;
|
||||
default:
|
||||
printf("ISAC unknown mode %x\n",mode);
|
||||
splx(ms);
|
||||
return -EIO;
|
||||
}
|
||||
splx(ms);
|
||||
return 0;
|
||||
}
|
||||
|
||||
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,45 +1,78 @@
|
|||
inline static void PostIRQ(struct _dumb * dumb)
|
||||
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);
|
||||
inline static Byte
|
||||
InISAC(struct _dumb * dumb, char offset) {
|
||||
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,offset);
|
||||
ByteOut(dumb->ioaddr+1,data);
|
||||
inline static void
|
||||
OutISAC(struct _dumb * dumb, char offset, Byte 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,offset+((hscx&1)?0:0x40));
|
||||
return ByteIn(dumb->ioaddr+2);
|
||||
inline static Byte
|
||||
InHSCX(struct _dumb * dumb, unsigned char hscx, char offset) {
|
||||
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,offset+((hscx&1)?0:0x40));
|
||||
ByteOut(dumb->ioaddr+2,what);
|
||||
inline static void
|
||||
OutHSCX(struct _dumb * dumb, unsigned char hscx, char offset, Byte 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) {
|
||||
inline static Byte
|
||||
Slot(struct _dumb * dumb, unsigned char hscx) {
|
||||
printf(" Slot %d: ",hscx);
|
||||
return (hscx&1) ? 0x2F : 0x03;
|
||||
}
|
||||
|
||||
static int Init(struct _dumb * dumb) {
|
||||
static int
|
||||
Init(struct _dumb * dumb) {
|
||||
int timout;
|
||||
long flags;
|
||||
char iflag;
|
||||
|
||||
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,0xF0);
|
||||
sti();
|
||||
while(jiffies <= timout) ;
|
||||
ByteOut(dumb->ioaddr,0x00);
|
||||
ByteOut(dumb->info.ioaddr,0xE0);
|
||||
timout = jiffies+(HZ/20)+1;
|
||||
while(jiffies <= timout) ;
|
||||
restore_flags(flags);
|
||||
return 1;
|
||||
switch(ByteIn(dumb->info.ioaddr) & 0xE0) {
|
||||
case 0: break;
|
||||
default:
|
||||
printf (" unknown card code %d ",ByteIn(dumb->info.ioaddr) >> 5);
|
||||
return -EIO;
|
||||
}
|
||||
switch(dumb->info.irq) {
|
||||
case 3: iflag = 0; break;
|
||||
case 5: iflag = 4; break;
|
||||
case 7: iflag = 2; break;
|
||||
case 2: iflag = 6; break;
|
||||
case 9: iflag = 6; break;
|
||||
case 4: iflag = 1; break;
|
||||
case 6: iflag = 5; break;
|
||||
case 0: iflag = 7; break;
|
||||
default:
|
||||
printf (" impossible irq %d ",dumb->info.irq);
|
||||
return -EINVAL;
|
||||
}
|
||||
ByteOut(dumb->info.ioaddr,(iflag<<5));
|
||||
return 0;
|
||||
}
|
||||
static void InitISAC(struct _dumb * dumb)
|
||||
|
||||
static void
|
||||
InitISAC(struct _dumb * dumb)
|
||||
{
|
||||
dumb->chan[0].mode = M_OFF;
|
||||
dumb->chan[0].listen = 0;
|
||||
|
@ -55,7 +88,8 @@ static void InitISAC(struct _dumb * dumb)
|
|||
ByteOutISAC(dumb, MASK, 0x00);
|
||||
}
|
||||
|
||||
static void InitHSCX_(struct _dumb * dumb, unsigned char hscx)
|
||||
static void
|
||||
InitHSCX_(struct _dumb * dumb, unsigned char hscx)
|
||||
{
|
||||
ByteOutHSCX(dumb,hscx,TSAX, Slot(dumb,hscx));
|
||||
ByteOutHSCX(dumb,hscx,TSAR, Slot(dumb,hscx));
|
||||
|
@ -76,64 +110,10 @@ static void InitHSCX_(struct _dumb * dumb, unsigned char hscx)
|
|||
ByteOutHSCX(dumb,hscx,MASK, 0x00);
|
||||
}
|
||||
|
||||
static void ISAC_mode(struct _dumb * dumb, Byte mode, Byte listen)
|
||||
static int
|
||||
HSCX_mode(struct _dumb * dumb, unsigned char hscx, Byte mode, Byte listen)
|
||||
{
|
||||
unsigned long ms = SetSPL(dumb->ipl);
|
||||
|
||||
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;
|
||||
}
|
||||
if(dumb->chan[0].m_out != NULL) {
|
||||
freemsg(dumb->chan[0].m_out);
|
||||
dumb->chan[0].m_out = dumb->chan[0].m_out_run = NULL;
|
||||
}
|
||||
ByteOutISAC(dumb,CMDR,0x41);
|
||||
|
||||
switch(mode) {
|
||||
case M_OFF:
|
||||
printk(KERN_DEBUG "CIX0 0x3F\n");
|
||||
ByteOutISAC(dumb,CIX0,0x3F);
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,0);
|
||||
dumb->chan[0].mode = mode;
|
||||
break;
|
||||
case M_STANDBY:
|
||||
if(dumb->chan[0].mode != M_STANDBY) {
|
||||
ByteOutISAC(dumb,MODE,0xCA);
|
||||
printk(KERN_DEBUG "CIX0 0x03\n");
|
||||
ByteOutISAC(dumb,CIX0,0x03);
|
||||
}
|
||||
else printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
dumb->chan[0].mode = mode;
|
||||
dumb->chan[0].listen = 1;
|
||||
break;
|
||||
case M_HDLC:
|
||||
ByteOutISAC(dumb,MODE,0xCA);
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
if(dumb->chan[0].mode != M_HDLC) {
|
||||
printk(KERN_DEBUG "CIX0 0x27\n");
|
||||
ByteOutISAC(dumb,CIX0,0x27);
|
||||
} else {
|
||||
printk(KERN_DEBUG "NoCIX0 %d\n",dumb->chan[0].mode);
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,1);
|
||||
}
|
||||
#if 0
|
||||
ByteOutISAC(dumb,TIMR,0x11);
|
||||
ByteOutISAC(dumb,CMDR,0x10);
|
||||
#endif
|
||||
dumb->chan[0].mode = mode;
|
||||
dumb->chan[0].listen = 0;
|
||||
break;
|
||||
default:
|
||||
printf("ISAC unknown mode %x\n",mode);
|
||||
}
|
||||
splx(ms);
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -193,7 +173,10 @@ static void HSCX_mode(struct _dumb * dumb, unsigned char hscx, Byte mode, Byte l
|
|||
break;
|
||||
default:
|
||||
printf("HSCX unknown mode %x\n",mode);
|
||||
splx(ms);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
splx(ms);
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,62 @@
|
|||
#ifndef CONF_H
|
||||
#define CONF_H
|
||||
#include "isdn_limits.h"
|
||||
#include "isdn_12.h"
|
||||
#include "smallq.h"
|
||||
#include <stream.h>
|
||||
#include "loader.h"
|
||||
|
||||
extern int dumb_num;
|
||||
|
||||
#define DEBUG(_x) if((DEBUG_##_x) & dumb->info.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,offset;
|
||||
} *hdlc_buf;
|
||||
|
||||
typedef struct _dumb {
|
||||
struct _isdn1_card card; /* must be first */
|
||||
struct cardinfo info, *infoptr;
|
||||
|
||||
struct _hdlc_buf chan[MAX_B+1];
|
||||
#ifdef NEW_TIMEOUT
|
||||
long timer;
|
||||
long uptimer;
|
||||
#endif
|
||||
struct _dumb *next;
|
||||
int numHSCX;
|
||||
long countme;
|
||||
volatile signed char polled;
|
||||
unsigned int do_uptimer:1;
|
||||
} *__dumb;
|
||||
|
||||
extern struct _dumb dumbdata[];
|
||||
|
||||
#define M_TRANSPARENT 12 /* no idle */
|
||||
#define M_TRANS_ALAW 13 /* a-law idle */
|
||||
#define M_TRANS_V110 14 /* V.110 idle */
|
||||
#define M_TRANS_HDLC 15 /* HDLC flags */
|
||||
#define M_HDLC 20
|
||||
#define M_HDLC_7L 21 /* skip bit 8 */
|
||||
#define M_HDLC_7H 22 /* skip bit 0 */
|
||||
#define M_HDLC_N0 23 /* insert one after seven zeroes */
|
||||
#define M_HDLC_16 24 /* insert one after seven zeroes */
|
||||
|
||||
#endif
|
|
@ -0,0 +1,197 @@
|
|||
#include <linux/delay.h>
|
||||
|
||||
inline static void
|
||||
PostIRQ(struct _dumb * dumb)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Die Offsets sind alle +20 wegen der FIFO, deshalb wird überall 0x20
|
||||
* "zuviel" abgezogen.
|
||||
*/
|
||||
|
||||
|
||||
inline static Byte
|
||||
InISAC(struct _dumb * dumb, char offset) {
|
||||
return ByteIn(dumb->info.ioaddr-0x420+offset);
|
||||
}
|
||||
inline static void
|
||||
OutISAC(struct _dumb * dumb, char offset, Byte data) {
|
||||
ByteOut(dumb->info.ioaddr-0x420+offset,data);
|
||||
}
|
||||
inline static Byte
|
||||
InHSCX(struct _dumb * dumb, unsigned char hscx, char offset) {
|
||||
return ByteIn(dumb->info.ioaddr+offset-((hscx&1)?0xC20:0x820));
|
||||
}
|
||||
inline static void
|
||||
OutHSCX(struct _dumb * dumb, unsigned char hscx, char offset, Byte what) {
|
||||
ByteOut(dumb->info.ioaddr+offset-((hscx&1)?0xC20:0x820),what);
|
||||
}
|
||||
inline static Byte
|
||||
Slot(struct _dumb * dumb, unsigned char hscx) {
|
||||
return (hscx&1) ? 0x2f : 0x03;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
Init(struct _dumb * dumb) {
|
||||
Byte cfval;
|
||||
long flags;
|
||||
long timout;
|
||||
if(dumb->info.ioaddr == 0) return -EINVAL;
|
||||
dumb->numHSCX = 2;
|
||||
switch(dumb->info.irq) {
|
||||
default: printk("irq %d not possible: ",dumb->info.irq); return -EINVAL;
|
||||
case 9:
|
||||
case 2: cfval = 0x00; break;
|
||||
case 5: cfval = 0x06; break;
|
||||
case 10: cfval = 0x08; break;
|
||||
case 12: cfval = 0x0C; break;
|
||||
case 15: cfval = 0x0E; break;
|
||||
}
|
||||
if(ByteIn(dumb->info.ioaddr+0) != 0x51) { return -EINVAL; }
|
||||
if(ByteIn(dumb->info.ioaddr+1) != 0x93) { return -EINVAL; }
|
||||
if((ByteIn(dumb->info.ioaddr+2) & 0xFC) != 0x1C) { return -EINVAL; }
|
||||
save_flags(flags);
|
||||
sti();
|
||||
ByteOut(dumb->info.ioaddr+4,cfval);
|
||||
timout=jiffies+(HZ/10+1);
|
||||
while(jiffies<timout);
|
||||
ByteOut(dumb->info.ioaddr+4,cfval|1);
|
||||
timout=jiffies+(HZ/10+1);
|
||||
printf("%steles3:HSCX0:%d HSCX1:%d ISAC:%d\n",KERN_INFO,
|
||||
ByteInHSCX(dumb,0,VSTR) &0xf,ByteInHSCX(dumb,1,VSTR) &0xf,ByteInISAC(dumb,RBCH));
|
||||
restore_flags(flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
InitISAC(struct _dumb * dumb)
|
||||
{
|
||||
dumb->chan[0].mode = M_OFF;
|
||||
dumb->chan[0].listen = 0;
|
||||
ByteOutISAC(dumb, MASK, 0xFF);
|
||||
ByteOutISAC(dumb, ADF2, 0x80);
|
||||
ByteOutISAC(dumb, SQXR, 0x2F);
|
||||
ByteOutISAC(dumb, SPCR, 0x00);
|
||||
ByteOutISAC(dumb, ADF1, 0x02);
|
||||
ByteOutISAC(dumb, STCR, 0x70);
|
||||
ByteOutISAC(dumb, MODE, 0xC9);
|
||||
ByteOutISAC(dumb, TIMR, 0x00);
|
||||
ByteOutISAC(dumb, ADF1, 0x00);
|
||||
ByteOutISAC(dumb, CMDR, 0x41);
|
||||
ByteOutISAC(dumb, CIX0, 0x07);
|
||||
ByteOutISAC(dumb, MASK, 0xFF);
|
||||
ByteOutISAC(dumb, MASK, 0x00);
|
||||
}
|
||||
|
||||
static void
|
||||
InitHSCX_(struct _dumb * dumb, unsigned char hscx)
|
||||
{
|
||||
ByteOutHSCX(dumb,hscx,CCR1, 0x85);
|
||||
ByteOutHSCX(dumb,hscx,XAD1, 0xFF);
|
||||
ByteOutHSCX(dumb,hscx,XAD2, 0xFF);
|
||||
ByteOutHSCX(dumb,hscx,RAH2, 0xFF);
|
||||
ByteOutHSCX(dumb,hscx,XBCH, 0);
|
||||
ByteOutHSCX(dumb,hscx,RLCR, 0);
|
||||
ByteOutHSCX(dumb,hscx,CCR2, 0x30);
|
||||
ByteOutHSCX(dumb,hscx,TSAX, 0xFF);
|
||||
ByteOutHSCX(dumb,hscx,TSAR, 0xFF);
|
||||
ByteOutHSCX(dumb,hscx,XCCR, 7);
|
||||
ByteOutHSCX(dumb,hscx,RCCR, 7);
|
||||
ByteOutHSCX(dumb,hscx,MODE, 0x84);
|
||||
ByteOutHSCX(dumb,hscx,MASK, 0x00);
|
||||
}
|
||||
|
||||
static int
|
||||
HSCX_mode(struct _dumb * dumb, unsigned char hscx, Byte mode, Byte listen)
|
||||
{
|
||||
unsigned long ms = SetSPL(1);
|
||||
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;
|
||||
}
|
||||
if(dumb->chan[hscx].m_out != NULL) {
|
||||
freemsg(dumb->chan[hscx].m_out);
|
||||
dumb->chan[hscx].m_out = dumb->chan[hscx].m_out_run = NULL;
|
||||
}
|
||||
|
||||
ByteOutHSCX(dumb,hscx,CCR1, 0x85);
|
||||
ByteOutHSCX(dumb,hscx,XAD1, 0xFF);
|
||||
ByteOutHSCX(dumb,hscx,XAD2, 0xFF);
|
||||
ByteOutHSCX(dumb,hscx,RAH2, 0xFF);
|
||||
ByteOutHSCX(dumb,hscx,XBCH, 0);
|
||||
ByteOutHSCX(dumb,hscx,RLCR, 0);
|
||||
|
||||
switch(mode) {
|
||||
case M_OFF:
|
||||
case M_STANDBY:
|
||||
ByteOutHSCX(dumb,hscx,CCR2, 0x30);
|
||||
ByteOutHSCX(dumb,hscx,TSAX, 0xFF);
|
||||
ByteOutHSCX(dumb,hscx,TSAR, 0xFF);
|
||||
ByteOutHSCX(dumb,hscx,XCCR, 0x07);
|
||||
ByteOutHSCX(dumb,hscx,RCCR, 0x07);
|
||||
ByteOutHSCX(dumb,hscx,MODE, 0x84);
|
||||
dumb->chan[hscx].mode = mode;
|
||||
dumb->chan[hscx].locked = 0;
|
||||
dumb->chan[hscx].listen = listen;
|
||||
break;
|
||||
case M_TRANS_HDLC:
|
||||
case M_TRANS_ALAW:
|
||||
case M_TRANS_V110:
|
||||
case M_TRANSPARENT:
|
||||
ByteOutHSCX(dumb,hscx,CCR2, 0x30);
|
||||
ByteOutHSCX(dumb,hscx,TSAX, Slot(dumb,hscx));
|
||||
ByteOutHSCX(dumb,hscx,TSAR, Slot(dumb,hscx));
|
||||
ByteOutHSCX(dumb,hscx,XCCR, 0x07);
|
||||
ByteOutHSCX(dumb,hscx,RCCR, 0x07);
|
||||
ByteOutHSCX(dumb,hscx,MODE, 0xE4);
|
||||
ByteOutHSCX(dumb,hscx,CMDR, 0x41);
|
||||
ByteOutHSCX(dumb,hscx,MASK, 0x00);
|
||||
dumb->chan[hscx].mode = mode;
|
||||
dumb->chan[hscx].locked = 0;
|
||||
dumb->chan[hscx].listen = listen;
|
||||
break;
|
||||
case M_HDLC_7H:
|
||||
ByteOutHSCX(dumb,hscx,CCR2, 0x02);
|
||||
ByteOutHSCX(dumb,hscx,TSAX, Slot(dumb,hscx)+1);
|
||||
ByteOutHSCX(dumb,hscx,TSAR, Slot(dumb,hscx)+1);
|
||||
ByteOutHSCX(dumb,hscx,XCCR, 6);
|
||||
ByteOutHSCX(dumb,hscx,RCCR, 6);
|
||||
ByteOutHSCX(dumb,hscx,MODE, 0x8C);
|
||||
ByteOutHSCX(dumb,hscx,CMDR, 0x41);
|
||||
ByteOutHSCX(dumb,hscx,MASK, 0x00);
|
||||
break;
|
||||
case M_HDLC_7L:
|
||||
ByteOutHSCX(dumb,hscx,CCR2, 0x02);
|
||||
ByteOutHSCX(dumb,hscx,TSAX, Slot(dumb,hscx));
|
||||
ByteOutHSCX(dumb,hscx,TSAR, Slot(dumb,hscx));
|
||||
ByteOutHSCX(dumb,hscx,XCCR, 6);
|
||||
ByteOutHSCX(dumb,hscx,RCCR, 6);
|
||||
ByteOutHSCX(dumb,hscx,MODE, 0x8C);
|
||||
ByteOutHSCX(dumb,hscx,CMDR, 0x41);
|
||||
ByteOutHSCX(dumb,hscx,MASK, 0x00);
|
||||
break;
|
||||
case M_HDLC:
|
||||
ByteOutHSCX(dumb,hscx,CCR2, 0x30);
|
||||
ByteOutHSCX(dumb,hscx,TSAX, Slot(dumb,hscx));
|
||||
ByteOutHSCX(dumb,hscx,TSAR, Slot(dumb,hscx));
|
||||
ByteOutHSCX(dumb,hscx,XCCR, 0x07);
|
||||
ByteOutHSCX(dumb,hscx,RCCR, 0x07);
|
||||
ByteOutHSCX(dumb,hscx,MODE, 0x8C);
|
||||
ByteOutHSCX(dumb,hscx,CMDR, 0x41);
|
||||
ByteOutHSCX(dumb,hscx,MASK, 0x00);
|
||||
dumb->chan[hscx].mode = mode;
|
||||
dumb->chan[hscx].locked = 0;
|
||||
dumb->chan[hscx].listen = listen;
|
||||
break;
|
||||
default:
|
||||
printf("HSCX unknown mode %x\n",mode);
|
||||
splx(ms);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
splx(ms);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -3,41 +3,45 @@ 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 */
|
||||
}
|
||||
|
||||
static int Init(struct _dumb * dumb) {
|
||||
static int
|
||||
Init(struct _dumb * dumb) {
|
||||
int timout;
|
||||
long flags;
|
||||
|
||||
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 -EINVAL;
|
||||
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 0;
|
||||
case 2: cfval = 0x00; break;
|
||||
switch(dumb->info.irq) {
|
||||
default: printk("irq %d not possible: ",dumb->info.irq); return -EINVAL;
|
||||
case 2:
|
||||
case 9: cfval = 0x00; break;
|
||||
case 3: cfval = 0x02; break;
|
||||
case 4: cfval = 0x04; break;
|
||||
case 5: cfval = 0x06; break;
|
||||
|
@ -46,12 +50,12 @@ static int 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(ByteIn(ioaddr+0) != 0x51) { return 0; }
|
||||
if(ByteIn(ioaddr+1) != 0x93) { return 0; }
|
||||
if(ByteIn(ioaddr+2) != 0x1E) { return 0; }
|
||||
if(dumb->info.memaddr & ~0xDE000) { printk("info.memaddr %lx not possible: ",dumb->info.memaddr); return -EINVAL; }
|
||||
if(~dumb->info.memaddr & 0xC0000) { printk("info.memaddr %lx not possible: ",dumb->info.memaddr); return -EINVAL; }
|
||||
cfval |= ((dumb->info.memaddr >> 9) & 0xF0);
|
||||
if(ByteIn(ioaddr+0) != 0x51) { return -EINVAL; }
|
||||
if(ByteIn(ioaddr+1) != 0x93) { return -EINVAL; }
|
||||
if((ByteIn(ioaddr+2) & 0xFC) != 0x1C) { return -EINVAL; }
|
||||
|
||||
timout = jiffies+(HZ/10)+1;
|
||||
ByteOut(ioaddr+4,cfval);
|
||||
|
@ -63,76 +67,20 @@ static int 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);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ISAC_mode(struct _dumb * dumb, Byte mode, Byte listen)
|
||||
static int
|
||||
HSCX_mode(struct _dumb * dumb, u_char hscx, Byte mode, Byte listen)
|
||||
{
|
||||
unsigned long ms = SetSPL(dumb->ipl);
|
||||
static Byte xmode = 0xFF;
|
||||
|
||||
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;
|
||||
}
|
||||
if(dumb->chan[0].m_out != NULL) {
|
||||
freemsg(dumb->chan[0].m_out);
|
||||
dumb->chan[0].m_out = dumb->chan[0].m_out_run = NULL;
|
||||
}
|
||||
ByteOutISAC(dumb,CMDR,0x41);
|
||||
|
||||
switch(mode) {
|
||||
case M_OFF:
|
||||
DEBUG(info) printk(KERN_DEBUG "ISDN CIX0 0x3Fn\n");
|
||||
if(xmode != mode)
|
||||
ByteOutISAC(dumb,CIX0,0x3F &3);
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,0);
|
||||
dumb->chan[0].mode = mode;
|
||||
break;
|
||||
case M_STANDBY:
|
||||
if(dumb->chan[0].mode != M_STANDBY) {
|
||||
ByteOutISAC(dumb,MODE,0xC9);
|
||||
DEBUG(info) printk(KERN_DEBUG "ISDN CIX0 0x03\n");
|
||||
ByteOutISAC(dumb,CIX0,0x03);
|
||||
}
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
dumb->chan[0].mode = mode;
|
||||
dumb->chan[0].listen = 1;
|
||||
break;
|
||||
case M_HDLC:
|
||||
ByteOutISAC(dumb,MODE,0xC9);
|
||||
ByteOutISAC(dumb,MASK,0x00);
|
||||
if(dumb->chan[0].mode != M_HDLC) {
|
||||
DEBUG(info) printk(KERN_DEBUG "ISDN CIX0 0x27\n");
|
||||
ByteOutISAC(dumb,CIX0,0x27);
|
||||
} else {
|
||||
if(dumb->polled>0) isdn2_new_state(&dumb->card,1);
|
||||
DEBUG(info) printk(KERN_DEBUG "ISDN noCIX0 0x27\n");
|
||||
}
|
||||
#if 0
|
||||
ByteOutISAC(dumb,TIMR,0x11);
|
||||
ByteOutISAC(dumb,CMDR,0x10);
|
||||
#endif
|
||||
dumb->chan[0].mode = mode;
|
||||
dumb->chan[0].listen = 0;
|
||||
break;
|
||||
default:
|
||||
printf("ISAC unknown mode %x\n",mode);
|
||||
}
|
||||
splx(ms);
|
||||
xmode = 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;
|
||||
|
@ -204,13 +152,14 @@ static int 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);
|
||||
return 0;
|
||||
}
|
||||
static void InitISAC(struct _dumb * dumb)
|
||||
static void
|
||||
InitISAC(struct _dumb * dumb)
|
||||
{
|
||||
dumb->chan[0].mode = M_OFF;
|
||||
dumb->chan[0].listen = 0;
|
||||
|
@ -223,9 +172,11 @@ static void InitISAC(struct _dumb * dumb)
|
|||
ByteOutISAC(dumb, ADF1, 0x02);
|
||||
ByteOutISAC(dumb, STCR, 0x70);
|
||||
ByteOutISAC(dumb, MASK, 0x00);
|
||||
ByteOutISAC(dumb, CIX0, 0x07);
|
||||
}
|
||||
|
||||
static void InitHSCX_(struct _dumb * dumb, u_char hscx)
|
||||
static void
|
||||
InitHSCX_(struct _dumb * dumb, u_char hscx)
|
||||
{
|
||||
ByteOutHSCX(dumb,hscx,CCR2, 0x30); /* 0x38 */
|
||||
ByteOutHSCX(dumb,hscx,TSAX, Slot(dumb,hscx));
|
|
@ -0,0 +1,50 @@
|
|||
#include "f_module.h"
|
||||
#include "isdn_limits.h"
|
||||
#include <stddef.h>
|
||||
#include <linux/sched.h>
|
||||
#include "loader.h"
|
||||
|
||||
#ifndef CARDTYPE
|
||||
#error "You have to define CARDTYPE for this to work."
|
||||
#endif
|
||||
|
||||
extern int NAME(CARDTYPE,init)(struct cardinfo *inf);
|
||||
extern void NAME(CARDTYPE,exit)(struct cardinfo *inf);
|
||||
|
||||
struct cardinfo inf = {0,};
|
||||
|
||||
int irq = 0;
|
||||
int mem = 0;
|
||||
int io = 0;
|
||||
int ipl = 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;
|
||||
}
|
||||
if(irq == 2)
|
||||
irq = 9;
|
||||
inf.irq = irq;
|
||||
inf.ipl = ipl;
|
||||
inf.ioaddr = io;
|
||||
inf.memaddr = mem;
|
||||
inf.ID = name;
|
||||
inf.debug = debug;
|
||||
inf.use_count = &mod_use_count_;
|
||||
return NAME(CARDTYPE,init)(&inf);
|
||||
}
|
||||
|
||||
static int do_exit_module(void)
|
||||
{
|
||||
NAME(CARDTYPE,exit)(&inf);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#error "This can only be used as a module!"
|
||||
#endif
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
KERNEL=1
|
||||
SYMTAB=compat.c
|
||||
|
||||
TOPDIR=..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
|
@ -0,0 +1,472 @@
|
|||
#define COMPAT_C
|
||||
|
||||
/*
|
||||
* Compatibility stuff for Streams-ish drivers and other stuff.
|
||||
*
|
||||
* Copyright 1994: Matthias Urlichs <urlichs@smurf.noris.de>
|
||||
*/
|
||||
#include "f_module.h"
|
||||
#include "kernel.h"
|
||||
#include <linux/delay.h>
|
||||
#include <asm/delay.h>
|
||||
|
||||
/*
|
||||
* compat.c
|
||||
*
|
||||
* provides some compatibility code for stuff written for non-Linux kernels
|
||||
*
|
||||
* Version 0.3 by Matthias Urlichs <urlichs@smurf.noris.de>
|
||||
*/
|
||||
#include <linux/config.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/malloc.h>
|
||||
#include <asm/system.h>
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
unsigned long block_mask = 0;
|
||||
|
||||
/*
|
||||
* Standard Unix-kernel timeout code. Two versions -- the new version
|
||||
* returns a pointer to its internal data, the old version doesn't, which
|
||||
* means we have to scan for the thing in an internal list when
|
||||
* deallocating the timer.
|
||||
*/
|
||||
struct timing {
|
||||
struct timer_list tim;
|
||||
void (*proc)(void *);
|
||||
void *arg;
|
||||
};
|
||||
|
||||
struct timing_old {
|
||||
struct timing tim;
|
||||
struct timing_old *prev;
|
||||
struct timing_old *next;
|
||||
};
|
||||
static struct timing_old *start = NULL;
|
||||
|
||||
static void
|
||||
dotimer(void *arg)
|
||||
{
|
||||
struct timing *tim = (struct timing *)arg;
|
||||
|
||||
(*tim->proc)(tim->arg);
|
||||
|
||||
sti();
|
||||
#ifdef CONFIG_MALLOC_NAMES
|
||||
deb_kfree(tim,__FILE__,__LINE__);
|
||||
#else
|
||||
kfree(tim);
|
||||
#endif
|
||||
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
droptimer_old(void (*func)(void *), void *arg, char del)
|
||||
{
|
||||
struct timing_old *tim;
|
||||
unsigned long flags;
|
||||
save_flags(flags);
|
||||
cli();
|
||||
for(tim = start; tim != NULL; tim = tim->next) {
|
||||
if(tim->tim.proc == func && tim->tim.arg == arg) {
|
||||
if(tim->next != NULL)
|
||||
tim->next->prev = tim->prev;
|
||||
if(tim->prev != NULL)
|
||||
tim->prev->next = tim->next;
|
||||
else
|
||||
start = tim->next;
|
||||
restore_flags(flags);
|
||||
if(del) {
|
||||
del_timer(&tim->tim.tim);
|
||||
#ifdef CONFIG_MALLOC_NAMES
|
||||
deb_kfree(tim,__FILE__,__LINE__);
|
||||
#else
|
||||
kfree(tim);
|
||||
#endif
|
||||
}
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
restore_flags(flags);
|
||||
printk("Timer %p:%p not found\n", func,arg);
|
||||
}
|
||||
|
||||
static void
|
||||
dotimer_old(void *arg)
|
||||
{
|
||||
struct timing_old *tim = (struct timing_old *)arg;
|
||||
|
||||
droptimer_old(tim->tim.proc,tim->tim.arg,0);
|
||||
(*tim->tim.proc)(tim->tim.arg);
|
||||
|
||||
sti();
|
||||
#ifdef CONFIG_MALLOC_NAMES
|
||||
deb_kfree(tim,__FILE__,__LINE__);
|
||||
#else
|
||||
kfree(tim);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
#ifdef CONFIG_MALLOC_NAMES
|
||||
deb_timeout(const char *deb_file, unsigned int deb_line, void (*func)(void *), void *arg, int expire)
|
||||
#else
|
||||
timeout(void (*func)(void *), void *arg, int expire)
|
||||
#endif
|
||||
{
|
||||
typedef void (*fct)(unsigned long);
|
||||
struct timing *timer;
|
||||
|
||||
#ifdef CONFIG_MALLOC_NAMES
|
||||
timer = (struct timing *)deb_kmalloc(sizeof(struct timing), GFP_ATOMIC,deb_file,deb_line);
|
||||
#else
|
||||
timer = (struct timing *)kmalloc(sizeof(struct timing), GFP_ATOMIC);
|
||||
#endif
|
||||
if(timer == NULL) {
|
||||
printf(" *!* No Timeout!\n");
|
||||
return (int)NULL;
|
||||
}
|
||||
init_timer(&timer->tim);
|
||||
timer->tim.function = (fct)dotimer;
|
||||
timer->proc = func;
|
||||
timer->arg = arg;
|
||||
timer->tim.data = (unsigned long)timer;
|
||||
timer->tim.expires = expire + jiffies;
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
add_timer(&timer->tim);
|
||||
|
||||
return (int)timer;
|
||||
}
|
||||
|
||||
void
|
||||
#ifdef CONFIG_MALLOC_NAMES
|
||||
deb_timeout_old(const char *deb_file, unsigned int deb_line, void (*func)(void *), void *arg, int expire)
|
||||
#else
|
||||
timeout_old(void (*func)(void *), void *arg, int expire)
|
||||
#endif
|
||||
{
|
||||
typedef void (*fct)(unsigned long);
|
||||
struct timing_old *timer;
|
||||
int s;
|
||||
|
||||
#ifdef CONFIG_MALLOC_NAMES
|
||||
timer = (struct timing_old *)deb_kmalloc(sizeof(struct timing_old), GFP_ATOMIC,deb_file,deb_line);
|
||||
#else
|
||||
timer = (struct timing_old *)kmalloc(sizeof(struct timing_old), GFP_ATOMIC);
|
||||
#endif
|
||||
if(timer == NULL) {
|
||||
printf(" *!* No Timeout!\n");
|
||||
return;
|
||||
}
|
||||
init_timer(&timer->tim.tim);
|
||||
timer->tim.proc = func;
|
||||
timer->tim.arg = arg;
|
||||
timer->tim.tim.function = (fct)dotimer_old;
|
||||
timer->tim.tim.data = (unsigned long)timer;
|
||||
timer->tim.tim.expires = expire + jiffies;
|
||||
save_flags(s); cli();
|
||||
if(start != NULL)
|
||||
start->prev = timer;
|
||||
timer->next = start;
|
||||
timer->prev = NULL;
|
||||
start = timer;
|
||||
restore_flags(s);
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
add_timer(&timer->tim.tim);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
#ifdef CONFIG_MALLOC_NAMES
|
||||
deb_untimeout(const char *deb_file, unsigned int deb_line, int timer)
|
||||
#else
|
||||
untimeout(int timer)
|
||||
#endif
|
||||
{
|
||||
if(!del_timer(&((struct timing *)timer)->tim)) {
|
||||
#ifdef CONFIG_MALLOC_NAMES
|
||||
printf("del_timer called freed from %s:%d\n",deb_file,deb_line);
|
||||
#endif
|
||||
}
|
||||
#ifdef CONFIG_MALLOC_NAMES
|
||||
deb_kfree((void *)timer,deb_file,deb_line);
|
||||
#else
|
||||
kfree((void *)timer);
|
||||
#endif
|
||||
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
#ifdef CONFIG_MALLOC_NAMES
|
||||
deb_untimeout_old(const char *deb_file, unsigned int deb_line, void (*func)(void *), void *arg)
|
||||
#else
|
||||
untimeout_old(void (*func)(void *), void *arg)
|
||||
#endif
|
||||
{
|
||||
droptimer_old(func,arg,1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int crash_time = 300; /* Five minutes until reboot */
|
||||
|
||||
#define get_seg_long(seg,addr) ({ \
|
||||
register unsigned long __res; \
|
||||
__asm__("push %%fs;mov %%ax,%%fs;movl %%fs:%2,%%eax;pop %%fs" \
|
||||
:"=a" (__res):"0" (seg),"m" (*(addr))); \
|
||||
__res;})
|
||||
|
||||
|
||||
void sysdump(const char *msg, struct pt_regs *regs, unsigned long err)
|
||||
{
|
||||
int i,nlim=9;
|
||||
unsigned long flags;
|
||||
unsigned long esp;
|
||||
unsigned short ss;
|
||||
unsigned int dodump=100;
|
||||
|
||||
#if 1
|
||||
static unsigned long lticks = 0;
|
||||
|
||||
if(jiffies-lticks < HZ) {
|
||||
printk("."); return;
|
||||
}
|
||||
#endif
|
||||
save_flags(flags); cli();
|
||||
if(err != 0xf00fdead) {
|
||||
|
||||
if(regs == NULL)
|
||||
esp = (unsigned long) &msg;
|
||||
else
|
||||
esp = (unsigned long) ®s->esp;
|
||||
ss = KERNEL_DS;
|
||||
|
||||
printk("%s\n",KERN_DEBUG);
|
||||
if(msg != NULL)
|
||||
printk("%s%s: %08lx\n", KERN_DEBUG, msg, err);
|
||||
else
|
||||
nlim += 4;
|
||||
if(regs != NULL) {
|
||||
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("%sesi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n",KERN_EMERG,
|
||||
regs->esi, regs->edi, regs->ebp, esp);
|
||||
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("%sCorrupted stack page\n",KERN_EMERG);
|
||||
else
|
||||
nlim += 1;
|
||||
|
||||
} else
|
||||
nlim += 5;
|
||||
store_TR(i);
|
||||
if(current != NULL) {
|
||||
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("%sNo current process\n",KERN_EMERG);
|
||||
}
|
||||
{
|
||||
int nlines = 0, linepos = 0;
|
||||
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("%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
|
||||
}
|
||||
printk("\n");
|
||||
}
|
||||
}
|
||||
dodump=0;
|
||||
if(err == 0xDEADBEEF)
|
||||
dodump=0;
|
||||
else if(err == 0xF00DDEAD || err == 0xf00fdead)
|
||||
dodump=(crash_time ? crash_time : 60);
|
||||
else if(jiffies < 60*HZ)
|
||||
dodump=9999999;
|
||||
else
|
||||
dodump=crash_time;
|
||||
if(dodump>0) {
|
||||
if(dodump < 10000) {
|
||||
int j;
|
||||
|
||||
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);
|
||||
for(i=0;i<9990;i++) udelay(100);
|
||||
}
|
||||
panic("now.");
|
||||
} else {
|
||||
printk("%sKernel halted.",KERN_EMERG);
|
||||
for(;;);
|
||||
}
|
||||
}
|
||||
restore_flags(flags);
|
||||
}
|
||||
|
||||
|
||||
|
||||
char *loghdr(char level)
|
||||
{
|
||||
static char sbuf[30];
|
||||
static int tdiff = 0;
|
||||
sprintf(sbuf,"<%d>%ld:",level,jiffies-tdiff);
|
||||
tdiff = jiffies;
|
||||
return sbuf;
|
||||
}
|
||||
|
||||
|
||||
void do_i_sleep_on(struct wait_queue **p)
|
||||
{
|
||||
long s = spl(1);
|
||||
interruptible_sleep_on(p);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
void do_sleep_on(struct wait_queue **p)
|
||||
{
|
||||
long s = spl(1);
|
||||
sleep_on(p);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
#ifdef DO_DEBUGGING
|
||||
|
||||
struct d_hdr {
|
||||
long magic;
|
||||
const char *file;
|
||||
unsigned int line;
|
||||
ssize_t size;
|
||||
};
|
||||
#define MAGIC_HEAD 0x12348725
|
||||
#define MAGIC_TAIL 0x37867489
|
||||
|
||||
void *deb_kmalloc(size_t sz, int prio, const char *deb_file, unsigned int deb_line)
|
||||
{
|
||||
static unsigned int mack = 0;
|
||||
|
||||
struct d_hdr *foo = kmalloc(sz+sizeof(long)+sizeof(struct d_hdr), prio);
|
||||
if(foo == NULL) {
|
||||
printk("%sNoMem alloc %d from %s:%d\n",KERN_WARNING,sz,deb_file,deb_line);
|
||||
return NULL;
|
||||
}
|
||||
if(++mack == 10000)
|
||||
mack = 0;
|
||||
foo->magic = MAGIC_HEAD;
|
||||
foo->file = deb_file;
|
||||
foo->line = deb_line;
|
||||
foo->size = mack ? sz : -sz;
|
||||
foo++;
|
||||
if(!mack) printk("%s[M:A %d %p %s:%d]\n",KERN_DEBUG,sz,foo,deb_file,deb_line);
|
||||
*(long *)(sz + (char *)(foo)) = MAGIC_TAIL;
|
||||
|
||||
return foo;
|
||||
}
|
||||
|
||||
int deb_kcheck(void *fo, const char *deb_file, unsigned int deb_line)
|
||||
{
|
||||
struct d_hdr *foo = fo;
|
||||
foo--;
|
||||
if(foo->magic != MAGIC_HEAD) {
|
||||
printk("\n%sBad magic at free in %s:%d\n",KERN_EMERG,deb_file,deb_line);
|
||||
return 1;
|
||||
}
|
||||
if(*(long *)(((foo->size > 0) ? foo->size : -foo->size) + (char *)(fo)) != MAGIC_TAIL) {
|
||||
printk("%sMem Overwrite between %s:%d and %s:%d\n",KERN_EMERG,foo->file,foo->line, deb_file,deb_line);
|
||||
return 1;
|
||||
}
|
||||
foo->file = deb_file; foo->line = deb_line;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void deb_kfree(void *fo, const char *deb_file, unsigned int deb_line)
|
||||
{
|
||||
struct d_hdr *foo = fo;
|
||||
foo--;
|
||||
if(foo->magic != MAGIC_HEAD) {
|
||||
printk("%sBad magic at free in %s:%d\n",KERN_EMERG,deb_file,deb_line);
|
||||
return;
|
||||
}
|
||||
if(*(long *)(((foo->size > 0) ? foo->size : -foo->size) + (char *)(fo)) != MAGIC_TAIL) {
|
||||
printk("%sMem Overwrite between %s:%d and %s:%d\n",KERN_EMERG,foo->file,foo->line, deb_file,deb_line);
|
||||
return;
|
||||
}
|
||||
if(foo->size < 0)
|
||||
printk("%s[M:F %d %p %s:%d]\n",KERN_DEBUG,-foo->size,fo,foo->file,foo->line);
|
||||
|
||||
foo->magic = 0x77776666;
|
||||
kfree(foo);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
static struct symbol_table compat_symbol_table = {
|
||||
#include <linux/symtab_begin.h>
|
||||
#ifdef CONFIG_MALLOC_NAMES
|
||||
X(deb_timeout),
|
||||
X(deb_untimeout),
|
||||
X(deb_timeout_old),
|
||||
X(deb_untimeout_old),
|
||||
#else
|
||||
X(timeout),
|
||||
X(untimeout),
|
||||
X(timeout_old),
|
||||
X(untimeout_old),
|
||||
#endif
|
||||
X(loghdr),
|
||||
X(sysdump),
|
||||
#ifdef DO_DEBUGGING
|
||||
X(deb_kmalloc),
|
||||
X(deb_kcheck),
|
||||
X(deb_kfree),
|
||||
#endif
|
||||
Xalias(do_i_sleep_on,interruptible_sleep_on),
|
||||
Xalias(do_sleep_on,sleep_on),
|
||||
#include <linux/symtab_end.h>
|
||||
};
|
||||
|
||||
|
||||
static int do_init_module(void)
|
||||
{
|
||||
/* Oh well, no more rename_module_symbol... */
|
||||
register_symtab(&compat_symbol_table);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int do_exit_module(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,192 @@
|
|||
#ifndef _LINUX_SYSCOMPAT_H_
|
||||
#define _LINUX_SYSCOMPAT_H_
|
||||
|
||||
#include "config.h"
|
||||
#include "kernel.h"
|
||||
|
||||
#ifdef DO_DEBUGGING
|
||||
#define CONFIG_DEBUG_STREAMS
|
||||
#define CONFIG_DEBUG_ISDN
|
||||
#define CONFIG_MALLOC_NAMES
|
||||
#endif
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/fs.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <asm/segment.h>
|
||||
|
||||
#ifdef DO_DEBUGGING
|
||||
#include <linux/malloc.h>
|
||||
|
||||
#ifndef COMPAT_C
|
||||
|
||||
#ifdef kfree
|
||||
#undef kfree
|
||||
#endif
|
||||
#define kfree(a) deb_kfree((a),__FILE__,__LINE__)
|
||||
#ifdef kmalloc
|
||||
#undef kmalloc
|
||||
#endif
|
||||
#define kmalloc(a,b) deb_kmalloc((a),(b),__FILE__,__LINE__)
|
||||
#ifdef kfree_s
|
||||
#undef kfree_s
|
||||
#endif
|
||||
#define kfree_s(a,b) deb_kfree((a),__FILE__,__LINE__)
|
||||
|
||||
#endif /* COMPAT_C */
|
||||
|
||||
void deb_kfree(void *fo, const char *deb_file, unsigned int deb_line);
|
||||
void *deb_kmalloc(size_t sz, int prio, const char *deb_file, unsigned int deb_line);
|
||||
int deb_kcheck(void *fo, const char *deb_file, unsigned int deb_line);
|
||||
#define deb_kfree_s(a,b,c,d) deb_kfree((a),(c),(d))
|
||||
#define deb_kcheck_s(a,b,c,d) deb_kcheck((a),(c),(d))
|
||||
#ifdef kcheck
|
||||
#undef kcheck
|
||||
#endif
|
||||
#define kcheck(a) deb_kcheck((a),__FILE__,__LINE__)
|
||||
|
||||
#else /* DO_DEBUGGING */
|
||||
|
||||
#ifdef kcheck
|
||||
#undef kcheck
|
||||
#endif
|
||||
#define kcheck(x) do { } while(0)
|
||||
#ifdef deb_kcheck
|
||||
#undef deb_kcheck
|
||||
#endif
|
||||
#define deb_kcheck(x,y,z) do { } while(0)
|
||||
|
||||
#endif /* DO_DEBUGGING */
|
||||
|
||||
|
||||
#include <linux/wait.h>
|
||||
#include <linux/limits.h>
|
||||
#include <linux/timer.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH PATH_MAX
|
||||
#endif
|
||||
|
||||
#else /* __KERNEL__ */
|
||||
#include <string.h>
|
||||
#endif /* KERNEL */
|
||||
|
||||
#if 1
|
||||
typedef unsigned char uchar_t;
|
||||
typedef unsigned short ushort_t;
|
||||
typedef unsigned int uint_t;
|
||||
typedef unsigned long ulong_t;
|
||||
#endif
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#define spl(x) ({ long flags; save_flags(flags); cli(); flags;})
|
||||
#define splx(i) restore_flags(i)
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* sleep and wakeup.
|
||||
Untested; it's much better to use sleep_on and wake_up instead. */
|
||||
|
||||
#if 0
|
||||
int sleep(caddr_t event, int prio);
|
||||
void wakeup(caddr_t event);
|
||||
#endif
|
||||
|
||||
/* SysV timeout code. At least they could have returned a void*. */
|
||||
#ifdef CONFIG_MALLOC_NAMES
|
||||
int deb_timeout(const char *deb_file, unsigned int deb_line, void (*)(void *), void *, int);
|
||||
void deb_untimeout(const char *deb_file, unsigned int deb_line, int);
|
||||
|
||||
/* BSD timeout code. Walking down the queue ... */
|
||||
void deb_timeout_old(const char *deb_file, unsigned int deb_line, void (*)(void *), void *, int);
|
||||
void deb_untimeout_old(const char *deb_file, unsigned int deb_line, void (*)(void *),void *);
|
||||
|
||||
#define timeout(a,b,c) deb_timeout(__FILE__,__LINE__,(a),(b),(c))
|
||||
#define untimeout(a) deb_untimeout(__FILE__,__LINE__,(a))
|
||||
|
||||
#define timeout_old(a,b,c) deb_timeout_old(__FILE__,__LINE__,(a),(b),(c))
|
||||
#define untimeout_old(a,b) deb_untimeout_old(__FILE__,__LINE__,(a),(b))
|
||||
|
||||
#else
|
||||
int timeout(void (*)(void *), void *, int);
|
||||
void untimeout(int);
|
||||
|
||||
/* BSD timeout code. Walking down the queue ... */
|
||||
void timeout_old(void (*)(void *), void *, int);
|
||||
void untimeout_old(void (*)(void *),void *);
|
||||
#endif
|
||||
|
||||
#if defined(BSD) || defined(OLD_TIMEOUT)
|
||||
#ifdef CONFIG_MALLOC_NAMES
|
||||
#define deb_timeout(a,b,c,d,e) deb_timeout_old((a),(b),(c),(d),(e))
|
||||
#define deb_untimeout(a,b,c,d) deb_untimeout_old((a),(b),(c),(d))
|
||||
#else
|
||||
#define timeout(a,b,c) timeout_old(a,b,c)
|
||||
#define untimeout(a,b) untimeout_old(a,b)
|
||||
#endif
|
||||
|
||||
#ifndef OLD_TIMEOUT
|
||||
#define OLD_TIMEOUT
|
||||
#endif
|
||||
#undef NEW_TIMEOUT
|
||||
|
||||
#else /* new timeout code */
|
||||
|
||||
#ifndef NEW_TIMEOUT
|
||||
#define NEW_TIMEOUT
|
||||
#endif
|
||||
#undef OLD_TIMEOUT
|
||||
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
||||
/* Should be memmove() or something... */
|
||||
static inline void bcopy(void *a, void *b, int c) { memcpy(b,a,c); }
|
||||
static inline void bzero(void *a, int b) { memset(a,0,b); }
|
||||
static inline int bcmp(void *a, void *b, int c) { return memcmp(a,b,c); }
|
||||
|
||||
extern inline int imin(int a, int b)
|
||||
{ return (a < b ? a : b); }
|
||||
|
||||
extern inline int imax(int a, int b)
|
||||
{ return (a > b ? a : b); }
|
||||
|
||||
extern inline unsigned int min(unsigned int a, unsigned int b)
|
||||
{ return (a < b ? a : b); }
|
||||
|
||||
extern inline unsigned int max(unsigned int a, unsigned int b)
|
||||
{ return (a > b ? a : b); }
|
||||
|
||||
extern inline long lmin(long a, long b)
|
||||
{ return (a < b ? a : b); }
|
||||
|
||||
extern inline long lmax(long a, long b)
|
||||
{ return (a > b ? a : b); }
|
||||
|
||||
extern inline unsigned long ulmin(unsigned long a, unsigned long b)
|
||||
{ return (a < b ? a : b); }
|
||||
|
||||
extern inline unsigned long ulmax(unsigned long a, unsigned long b)
|
||||
{ return (a > b ? a : b); }
|
||||
|
||||
#define printf printk
|
||||
|
||||
|
||||
extern inline void psignal(int sig, struct task_struct *p) {
|
||||
send_sig(sig,p,1); }
|
||||
extern inline void gsignal(int sig, int pg) {
|
||||
kill_pg(pg, sig, 1); }
|
||||
|
||||
|
||||
void sysdump(const char *msg, struct pt_regs *regs, unsigned long err);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _LINUX_SYSCOMPAT_H_ */
|
|
@ -0,0 +1,59 @@
|
|||
SHELL = /bin/sh
|
||||
MAKE = make
|
||||
|
||||
FILE = files.list
|
||||
LIST = `grep -v '^;' <$(FILE)`
|
||||
|
||||
## If you use the script version of subst, and your version of sed chokes
|
||||
## then get FSF sed and edit the next line as appropriate.
|
||||
#SED = -e /usr/gnu/bin/sed
|
||||
|
||||
|
||||
all prog lib install update depend:: substitutions
|
||||
|
||||
indent load:
|
||||
|
||||
quiet:
|
||||
@$(MAKE) 'FILE=$(FILE)' substitutions | grep -v unchanged
|
||||
|
||||
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
|
||||
-@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
|
||||
-chmod +w $(LIST)
|
||||
./subst $(SED) -f subst.tmp $(LIST)
|
||||
@rm subst.tmp
|
||||
-date > substitutions
|
||||
|
||||
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
|
||||
mv config.new config.data
|
||||
|
||||
subst: subst.c subst.sh
|
||||
-make c || make sh || rm -f subst
|
||||
@if test ! -f subst; then echo Cannot make subst ; exit 1; fi
|
||||
c:
|
||||
@rm -f subst
|
||||
$(CC) -o subst subst.c
|
||||
sh:
|
||||
@rm -f subst
|
||||
cp subst.sh subst
|
||||
chmod +x subst
|
||||
|
||||
.PRECIOUS: config.data files.list
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#! /bin/sh
|
||||
## $Revision: 1.1 $
|
||||
## $Revision: 1.1.1.1 $
|
||||
##
|
||||
## Check the config.data file to make sure there is a tab on every
|
||||
## non-comment line.
|
|
@ -0,0 +1,207 @@
|
|||
##
|
||||
## ISDN master configuration file for Linux.
|
||||
## Note that if you leave a field blank, you must have the trailing tab!
|
||||
|
||||
##
|
||||
##
|
||||
## The user who may do (almost) everything.
|
||||
#### =()<ROOT @<ROOT>@>()=
|
||||
ROOT isdnmaster
|
||||
##
|
||||
##
|
||||
## System type.
|
||||
##
|
||||
#### =()<SYS @<SYS>@>()=
|
||||
SYS linux
|
||||
##
|
||||
##
|
||||
## 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 bintec teles3 creatixpnp.
|
||||
##
|
||||
#### =()<CARDS @<CARDS>@>()=
|
||||
CARDS teles
|
||||
##
|
||||
##
|
||||
## Protocols to make. fixed phone tei capi.
|
||||
##
|
||||
#### =()<PROTOCOLS @<PROTOCOLS>@>()=
|
||||
PROTOCOLS phone tei
|
||||
##
|
||||
##
|
||||
## Subprotocols for "phone". euro german.
|
||||
##
|
||||
#### =()<SUBPROTOCOLS @<SUBPROTOCOLS>@>()=
|
||||
SUBPROTOCOLS euro german
|
||||
##
|
||||
##
|
||||
## Debugging? DO or DONT
|
||||
##
|
||||
#### =()<DEBUGGING @<DEBUGGING>@>()=
|
||||
DEBUGGING DO
|
||||
##
|
||||
##
|
||||
##
|
||||
## Stuff to define
|
||||
##
|
||||
## Where's the Linux source?
|
||||
##
|
||||
#### =()<KERNELSRC @<KERNELSRC>@>()=
|
||||
KERNELSRC /usr/src/linux
|
||||
##
|
||||
##
|
||||
## C compiler for the kernel
|
||||
##
|
||||
#### =()<CC @<CC>@>()=
|
||||
CC gcc
|
||||
##
|
||||
##
|
||||
## C compiler for the utilities
|
||||
##
|
||||
#### =()<HOSTCC @<HOSTCC>@>()=
|
||||
HOSTCC gcc
|
||||
##
|
||||
##
|
||||
## C flags for kernel modules. Needs -DMODULE -DKERNEL -D__KERNEL__.
|
||||
##
|
||||
#### =()<CFLAGS @<CFLAGS>@>()=
|
||||
CFLAGS -g -O2 -Wall -fomit-frame-pointer -DKERNEL -D__KERNEL__ -DMODULE
|
||||
##
|
||||
##
|
||||
## C flags for programs
|
||||
##
|
||||
#### =()<HOSTCFLAGS @<HOSTCFLAGS>@>()=
|
||||
HOSTCFLAGS -g -O2 -Wall -D_GNU_SOURCE
|
||||
#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
|
||||
##
|
||||
##
|
||||
##
|
||||
## 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 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 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_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
|
||||
##
|
||||
|
||||
|
||||
### 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. 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
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
;; List of isdn files that are fed to subst.
|
||||
;; Lines beginning with a semi-colon are comment lines.
|
||||
../include/config.h
|
||||
../include/f_strings.h
|
||||
../include/f_termio.h
|
||||
../include/msgtype.h
|
||||
../tools/rc.isdn
|
||||
../tools/rc.isdnmon
|
||||
../Make.config
|
|
@ -1,4 +1,6 @@
|
|||
/* $Revision: 1.10 $
|
||||
/* This is from INN. */
|
||||
|
||||
/* $Revision: 1.2 $
|
||||
**
|
||||
** A C version of Henry Spencer's "subst" script.
|
||||
*/
|
||||
|
@ -49,8 +51,6 @@ extern char *strcpy();
|
|||
static char *
|
||||
xstrerror()
|
||||
{
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
extern int errno;
|
||||
static char buff[30];
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
KERNEL=1
|
||||
|
||||
TOPDIR=..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
|
@ -0,0 +1,393 @@
|
|||
/**
|
||||
** Streams fakecept module
|
||||
**/
|
||||
|
||||
#include "f_module.h"
|
||||
#include "primitives.h"
|
||||
#include "kernel.h"
|
||||
#include "f_signal.h"
|
||||
#include "f_malloc.h"
|
||||
#include "streams.h"
|
||||
#include "stropts.h"
|
||||
#ifdef DONT_ADDERROR
|
||||
#include "f_user.h"
|
||||
#endif
|
||||
#include "streamlib.h"
|
||||
#include "fakecept.h"
|
||||
#include "isdn_proto.h"
|
||||
|
||||
|
||||
/*
|
||||
* Standard Streams stuff.
|
||||
*/
|
||||
static struct module_info fakecept_minfo =
|
||||
{
|
||||
0, "fakecept", 0, INFPSZ, 200,100
|
||||
};
|
||||
|
||||
static qf_open fakecept_open;
|
||||
static qf_close fakecept_close;
|
||||
static qf_put fakecept_rput,fakecept_wput;
|
||||
static qf_srv fakecept_rsrv,fakecept_wsrv;
|
||||
|
||||
static struct qinit fakecept_rinit =
|
||||
{
|
||||
fakecept_rput, fakecept_rsrv, fakecept_open, fakecept_close, NULL, &fakecept_minfo, NULL
|
||||
};
|
||||
|
||||
static struct qinit fakecept_winit =
|
||||
{
|
||||
fakecept_wput, fakecept_wsrv, NULL, NULL, NULL, &fakecept_minfo, NULL
|
||||
};
|
||||
|
||||
struct streamtab fakeceptinfo =
|
||||
{&fakecept_rinit, &fakecept_winit, NULL, NULL};
|
||||
|
||||
struct fakecept_ {
|
||||
mblk_t *msg;
|
||||
ushort_t mtu;
|
||||
ushort_t offset;
|
||||
};
|
||||
|
||||
/* Streams code to open the driver. */
|
||||
static int
|
||||
fakecept_open (queue_t * q, dev_t dev, int flag, int sflag ERR_DECL)
|
||||
{
|
||||
register struct fakecept_ *fakecept;
|
||||
|
||||
if (q->q_ptr) {
|
||||
return 0;
|
||||
}
|
||||
fakecept = malloc(sizeof(*fakecept));
|
||||
if(fakecept == NULL)
|
||||
ERR_RETURN(-ENOMEM);
|
||||
memset(fakecept,0,sizeof(*fakecept));
|
||||
WR (q)->q_ptr = (char *) fakecept;
|
||||
q->q_ptr = (char *) fakecept;
|
||||
|
||||
fakecept->mtu = FAKECEPT_MTU-2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Streams code to close the driver. */
|
||||
static void
|
||||
fakecept_close (queue_t * q, int dummy)
|
||||
{
|
||||
register struct fakecept_ *fakecept;
|
||||
|
||||
fakecept = (struct fakecept_ *) q->q_ptr;
|
||||
|
||||
if (fakecept->msg != NULL) {
|
||||
freemsg (fakecept->msg);
|
||||
fakecept->msg = NULL;
|
||||
}
|
||||
flushq (q, FLUSHALL);
|
||||
flushq (WR (q), FLUSHALL);
|
||||
free(fakecept);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
fakecept_proto (queue_t * q, mblk_t * mp, char down)
|
||||
{
|
||||
register struct fakecept_ *fakecept = (struct fakecept_ *) q->q_ptr;
|
||||
streamchar *origmp = mp->b_rptr;
|
||||
ushort_t id;
|
||||
int error = 0;
|
||||
|
||||
if (m_getid (mp, &id) != 0) {
|
||||
mp->b_rptr = origmp;
|
||||
putnext (q, mp);
|
||||
return;
|
||||
}
|
||||
switch (id) {
|
||||
default:
|
||||
break;
|
||||
case PROTO_OFFSET: {
|
||||
long z;
|
||||
if ((error = m_geti (mp, &z)) != 0)
|
||||
goto err;
|
||||
if (z < 0 || z >= 1024)
|
||||
goto err;
|
||||
if(!down) {
|
||||
fakecept->offset = z;
|
||||
z += 4;
|
||||
freemsg(mp);
|
||||
if((mp = allocb(10,BPRI_MED)) != NULL) {
|
||||
m_putid(mp,PROTO_OFFSET);
|
||||
m_puti(mp,z);
|
||||
DATA_TYPE(mp) = MSG_PROTO;
|
||||
origmp = NULL;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case PROTO_CONNECTED:
|
||||
if (fakecept->msg != NULL) {
|
||||
freemsg (fakecept->msg);
|
||||
fakecept->msg = NULL;
|
||||
}
|
||||
break;
|
||||
case PROTO_MODULE:
|
||||
if (strnamecmp (q, mp)) { /* Config information for me. */
|
||||
long z;
|
||||
|
||||
while (mp != NULL && m_getsx (mp, &id) == 0) {
|
||||
switch (id) {
|
||||
default:
|
||||
goto err;
|
||||
case PROTO_MODULE:
|
||||
break;
|
||||
case FAKECEPT_MTU_ID:
|
||||
if ((error = m_geti (mp, &z)) != 0)
|
||||
goto err;
|
||||
if (z < 4 || z >= 4090)
|
||||
goto err;
|
||||
fakecept->mtu = z - 2; /* Two less because of the two additional header bytes */
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (mp != NULL) {
|
||||
mp->b_rptr = origmp;
|
||||
m_reply(q,mp,0);
|
||||
mp = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(mp != NULL) {
|
||||
if (origmp != NULL)
|
||||
mp->b_rptr = origmp;
|
||||
putnext(q,mp);
|
||||
}
|
||||
return;
|
||||
err:
|
||||
mp->b_rptr = origmp;
|
||||
m_reply (q, mp, error ? error : -EINVAL);
|
||||
}
|
||||
|
||||
|
||||
/* Streams code to write data. */
|
||||
static void
|
||||
fakecept_wput (queue_t * q, mblk_t * mp)
|
||||
{
|
||||
switch (DATA_TYPE(mp)) {
|
||||
case MSG_PROTO:
|
||||
case CASE_DATA:
|
||||
putq (q, mp);
|
||||
break;
|
||||
case M_FLUSH:
|
||||
if (*mp->b_rptr & FLUSHW)
|
||||
flushq (q, FLUSHDATA);
|
||||
putnext (q, mp);
|
||||
break;
|
||||
default:
|
||||
putnext (q, mp);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* Streams code to scan the write queue. */
|
||||
static void
|
||||
fakecept_wsrv (queue_t * q)
|
||||
{
|
||||
register struct fakecept_ *fakecept = (struct fakecept_ *) q->q_ptr;
|
||||
mblk_t *mp;
|
||||
|
||||
while ((mp = getq (q)) != NULL) {
|
||||
switch (DATA_TYPE(mp)) {
|
||||
case MSG_PROTO:
|
||||
fakecept_proto (q, mp, 1);
|
||||
break;
|
||||
case CASE_DATA:
|
||||
{
|
||||
mblk_t *mh;
|
||||
int cont = 0;
|
||||
|
||||
if (!canput (q->q_next)) {
|
||||
putbq (q, mp);
|
||||
return;
|
||||
}
|
||||
mh = allocb(4+fakecept->offset,BPRI_LO);
|
||||
if(mh == NULL) {
|
||||
putbqf(q,mp);
|
||||
return;
|
||||
}
|
||||
DATA_TYPE(mh) = DATA_TYPE(mp);
|
||||
if (dsize (mp) > fakecept->mtu) {
|
||||
int ml = fakecept->mtu;
|
||||
mblk_t *mr = dupmsg (mp);
|
||||
mblk_t *mz = mp;
|
||||
|
||||
cont = 1;
|
||||
|
||||
if (mr == NULL) {
|
||||
freeb(mh);
|
||||
putbqf (q, mp);
|
||||
return;
|
||||
}
|
||||
while ((ml -= mr->b_wptr - mr->b_rptr) > 0) {
|
||||
mz = mz->b_cont;
|
||||
{
|
||||
mblk_t *mr2 = mr;
|
||||
|
||||
mr = unlinkb (mr2);
|
||||
freeb (mr2);
|
||||
}
|
||||
}
|
||||
if (ml == 0) {
|
||||
mblk_t *mr2 = mr;
|
||||
|
||||
mr = unlinkb (mr2);
|
||||
freeb (mr2);
|
||||
} else {
|
||||
mz->b_wptr += ml;
|
||||
mr->b_rptr = mr->b_wptr + ml;
|
||||
}
|
||||
if (mz->b_cont != NULL) {
|
||||
freemsg (mz->b_cont);
|
||||
mz->b_cont = NULL;
|
||||
}
|
||||
putbq (q, mr);
|
||||
}
|
||||
if (/* XXX */ 0 || DATA_REFS(mp) > 1 ||
|
||||
DATA_START(mp) > mp->b_rptr - 4) {
|
||||
mh->b_rptr += fakecept->offset+4;
|
||||
mh->b_wptr += fakecept->offset+4;
|
||||
linkb (mh, mp);
|
||||
mp = mh;
|
||||
} else
|
||||
freeb (mh);
|
||||
*--mp->b_rptr = 0x00;
|
||||
*--mp->b_rptr = 0x01;
|
||||
/* *--mp->b_rptr = cont ? 0x80 : 0x00;*/
|
||||
*--mp->b_rptr = 0x00;
|
||||
*--mp->b_rptr = 0x01;
|
||||
|
||||
putnext (q, mp);
|
||||
}
|
||||
break;
|
||||
case M_FLUSH:
|
||||
if (*mp->b_rptr & FLUSHW)
|
||||
flushq (q, FLUSHDATA);
|
||||
/* FALL THRU */
|
||||
default:
|
||||
if (DATA_TYPE(mp) > QPCTL || canput (q->q_next)) {
|
||||
putnext (q, mp);
|
||||
continue;
|
||||
} else {
|
||||
putbq (q, mp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* Streams code to read data. */
|
||||
static void
|
||||
fakecept_rput (queue_t * q, mblk_t * mp)
|
||||
{
|
||||
switch (DATA_TYPE(mp)) {
|
||||
|
||||
case M_FLUSH:
|
||||
if (*mp->b_rptr & FLUSHR) {
|
||||
flushq (q, FLUSHDATA);
|
||||
}
|
||||
putnext (q, mp); /* send it along too */
|
||||
break;
|
||||
case MSG_PROTO:
|
||||
case CASE_DATA:
|
||||
putq (q, mp); /* queue it for my service routine */
|
||||
break;
|
||||
|
||||
default:
|
||||
putq (q, mp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* Streams code to scan the read queue. */
|
||||
static void
|
||||
fakecept_rsrv (queue_t * q)
|
||||
{
|
||||
mblk_t *mp;
|
||||
register struct fakecept_ *fakecept = (struct fakecept_ *) q->q_ptr;
|
||||
|
||||
while ((mp = getq (q)) != NULL) {
|
||||
switch (DATA_TYPE(mp)) {
|
||||
case MSG_PROTO:
|
||||
fakecept_proto (q, mp, 0);
|
||||
break;
|
||||
case CASE_DATA:
|
||||
{
|
||||
short tlen = dsize (mp);
|
||||
int cont;
|
||||
|
||||
if (!canput (q->q_next)) {
|
||||
putbq (q, mp);
|
||||
return;
|
||||
}
|
||||
if (tlen < 1 || (unsigned)tlen <= *(uchar_t *) mp->b_rptr || *mp->b_rptr == 0) {
|
||||
freemsg (mp);
|
||||
continue;
|
||||
}
|
||||
tlen = 3 + (uchar_t) * mp->b_rptr;
|
||||
if(tlen > 1)
|
||||
cont = (*(mp->b_rptr + 1) & 0x80);
|
||||
else
|
||||
cont = 0;
|
||||
|
||||
while (tlen >= mp->b_wptr - mp->b_rptr) {
|
||||
mblk_t *mp2 = mp;
|
||||
tlen -= mp->b_wptr - mp->b_rptr;
|
||||
mp = unlinkb (mp);
|
||||
freeb(mp2);
|
||||
}
|
||||
if(mp == NULL)
|
||||
continue;
|
||||
mp->b_rptr += tlen;
|
||||
if (fakecept->msg == NULL)
|
||||
fakecept->msg = mp;
|
||||
else
|
||||
linkb (fakecept->msg, mp);
|
||||
if (!cont) {
|
||||
putnext (q, fakecept->msg);
|
||||
fakecept->msg = NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case M_HANGUP:
|
||||
case M_ERROR:
|
||||
if (fakecept->msg != NULL) {
|
||||
freemsg (fakecept->msg);
|
||||
fakecept->msg = NULL;
|
||||
}
|
||||
/* FALL THRU */
|
||||
default:
|
||||
if (DATA_TYPE(mp) > QPCTL || canput (q->q_next)) {
|
||||
putnext (q, mp);
|
||||
continue;
|
||||
} else {
|
||||
putbq (q, mp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
static int do_init_module(void)
|
||||
{
|
||||
return register_strmod(&fakeceptinfo);
|
||||
}
|
||||
|
||||
static int do_exit_module(void)
|
||||
{
|
||||
return unregister_strmod(&fakeceptinfo);
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef _FAKECEPT_H
|
||||
#define _FAKECEPT_H
|
||||
|
||||
#define NFAKECEPT 15
|
||||
#define FAKECEPT_MTU 128
|
||||
|
||||
#include "primitives.h"
|
||||
|
||||
#define FAKECEPT_MTU_ID CHAR2('m','t') /* Max data block size */
|
||||
|
||||
#endif /* _FAKECEPT_H */
|
|
@ -0,0 +1,5 @@
|
|||
KERNEL=1
|
||||
|
||||
TOPDIR=..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
|
@ -1,22 +1,20 @@
|
|||
/**
|
||||
** Streams FAKEH module
|
||||
** Streams FAKEH module, used to pretend we're a Cisco box.
|
||||
** Do turn off keepalives at the other end!
|
||||
**/
|
||||
#undef DO_KEEPALIVES /* not yet..! */
|
||||
|
||||
#include "f_module.h"
|
||||
#include "primitives.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include "kernel.h"
|
||||
#include "f_signal.h"
|
||||
#include "f_malloc.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include "streams.h"
|
||||
#include <sys/stropts.h>
|
||||
#include "stropts.h"
|
||||
#ifdef DONT_ADDERROR
|
||||
#include "f_user.h"
|
||||
#endif
|
||||
#include "f_ip.h"
|
||||
#include <sys/errno.h>
|
||||
#include "streamlib.h"
|
||||
#include "fakeh.h"
|
||||
#include "isdn_proto.h"
|
||||
|
@ -27,7 +25,7 @@
|
|||
*/
|
||||
static struct module_info fakeh_minfo =
|
||||
{
|
||||
0, "fakeh", 0, INFPSZ, 4096, 2048
|
||||
0, "fakeh", 0, INFPSZ, 200,100
|
||||
};
|
||||
|
||||
static qf_open fakeh_open;
|
||||
|
@ -52,18 +50,22 @@ struct fakeh_ {
|
|||
queue_t *qptr;
|
||||
ushort_t offset;
|
||||
|
||||
unsigned connected:1;
|
||||
unsigned do_ethertype:1;
|
||||
#ifdef DO_KEEPALIVES
|
||||
int timer;
|
||||
#ifdef NEW_TIMEOUT
|
||||
int timeout;
|
||||
#endif
|
||||
unsigned connected:1;
|
||||
unsigned long last_a;
|
||||
unsigned long last_b;
|
||||
unsigned long last_c;
|
||||
unsigned long last_d;
|
||||
unsigned char lastmap[4];
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef DO_KEEPALIVES
|
||||
static void
|
||||
fake_h_timer (struct fakeh_ *fakeh)
|
||||
{
|
||||
|
@ -111,27 +113,25 @@ fake_h_timer (struct fakeh_ *fakeh)
|
|||
timeout ((void *)fake_h_timer, fakeh, fakeh->timer * HZ);
|
||||
splx(s);
|
||||
}
|
||||
#endif /* DO_KEEPALIVES */
|
||||
|
||||
|
||||
/* Streams code to open the driver. */
|
||||
static int
|
||||
fakeh_open (queue_t * q, dev_t dev, int flag, int sflag
|
||||
#ifdef DO_ADDERROR
|
||||
,int *err
|
||||
#endif
|
||||
)
|
||||
fakeh_open (queue_t * q, dev_t dev, int flag, int sflag ERR_DECL)
|
||||
{
|
||||
register struct fakeh_ *fakeh;
|
||||
|
||||
fakeh = malloc(sizeof(*fakeh));
|
||||
if(fakeh == NULL)
|
||||
return OPENFAIL;
|
||||
ERR_RETURN(-ENOMEM);
|
||||
memset(fakeh,0,sizeof(*fakeh));
|
||||
WR (q)->q_ptr = (char *) fakeh;
|
||||
q->q_ptr = (char *) fakeh;
|
||||
|
||||
fakeh->qptr = q;
|
||||
fakeh->connected = 0;
|
||||
#ifdef DO_KEEPALIVES
|
||||
fakeh->last_a = 0;
|
||||
fakeh->last_b = 0;
|
||||
fakeh->last_c = 0;
|
||||
|
@ -140,6 +140,7 @@ fakeh_open (queue_t * q, dev_t dev, int flag, int sflag
|
|||
fakeh->lastmap[1] = 2;
|
||||
fakeh->lastmap[2] = 1;
|
||||
fakeh->lastmap[3] = 0;
|
||||
#endif
|
||||
|
||||
MORE_USE;
|
||||
return 0;
|
||||
|
@ -157,6 +158,7 @@ fakeh_close (queue_t * q, int dummy)
|
|||
flushq (WR (q), FLUSHALL);
|
||||
fakeh->qptr = NULL;
|
||||
|
||||
#ifdef DO_KEEPALIVES
|
||||
if (fakeh->connected & (fakeh->timer > 0)) {
|
||||
#ifdef NEW_TIMEOUT
|
||||
untimeout (fakeh->timeout);
|
||||
|
@ -164,6 +166,7 @@ fakeh_close (queue_t * q, int dummy)
|
|||
untimeout (fake_h_timer, ipmon);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
free(fakeh);
|
||||
|
||||
LESS_USE;
|
||||
|
@ -177,6 +180,7 @@ fakeh_proto (queue_t * q, mblk_t * mp, char down)
|
|||
register struct fakeh_ *fakeh = (struct fakeh_ *) q->q_ptr;
|
||||
streamchar *origmp = mp->b_rptr;
|
||||
ushort_t id;
|
||||
int error = 0;
|
||||
|
||||
if (m_getid (mp, &id) != 0) {
|
||||
mp->b_rptr = origmp;
|
||||
|
@ -194,26 +198,32 @@ fakeh_proto (queue_t * q, mblk_t * mp, char down)
|
|||
goto err;
|
||||
if(!down) {
|
||||
fakeh->offset = z;
|
||||
z += 4;
|
||||
if(fakeh->do_ethertype)
|
||||
z += 2;
|
||||
else
|
||||
z += 4;
|
||||
freemsg(mp);
|
||||
if((mp = allocb(10,BPRI_MED)) != NULL) {
|
||||
m_putid(mp,PROTO_OFFSET);
|
||||
m_puti(mp,z);
|
||||
mp->b_datap->db_type = MSG_PROTO;
|
||||
DATA_TYPE(mp) = MSG_PROTO;
|
||||
origmp = NULL;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case PROTO_CONNECTED:
|
||||
fakeh->connected = 1;
|
||||
#ifdef DO_KEEPALIVES
|
||||
if (fakeh->timer > 0) {
|
||||
#ifdef NEW_TIMEOUT
|
||||
fakeh->timeout =
|
||||
#endif
|
||||
timeout ((void *)fake_h_timer, fakeh, fakeh->timer * HZ);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case PROTO_DISCONNECT:
|
||||
#ifdef DO_KEEPALIVES
|
||||
if(fakeh->connected && (fakeh->timer > 0)) {
|
||||
#ifdef NEW_TIMEOUT
|
||||
untimeout (fakeh->timeout);
|
||||
|
@ -221,32 +231,44 @@ fakeh_proto (queue_t * q, mblk_t * mp, char down)
|
|||
untimeout (fake_h_timer, ipmon);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
fakeh->connected = 0;
|
||||
break;
|
||||
case PROTO_MODULE:
|
||||
if (strnamecmp (q, mp)) { /* Config information for me. */
|
||||
#ifdef DO_KEEPALIVES
|
||||
long z;
|
||||
#endif
|
||||
|
||||
while (mp != NULL && m_getsx (mp, &id) == 0) {
|
||||
switch (id) {
|
||||
default:
|
||||
goto err;
|
||||
case PROTO_MODULE:
|
||||
break;
|
||||
case PROTO_TYPE_NONE:
|
||||
fakeh->do_ethertype = 0;
|
||||
break;
|
||||
case PROTO_TYPE_ETHER:
|
||||
fakeh->do_ethertype = 1;
|
||||
break;
|
||||
#ifdef DO_KEEPALIVES
|
||||
case FAKEH_SETMAP:
|
||||
if (m_geti (mp, &z) != 0)
|
||||
if ((error = m_geti (mp, &z)) != 0)
|
||||
goto err;
|
||||
fakeh->lastmap[0] = z;
|
||||
if (m_geti (mp, &z) != 0)
|
||||
if ((error = m_geti (mp, &z)) != 0)
|
||||
goto err;
|
||||
fakeh->lastmap[1] = z;
|
||||
if (m_geti (mp, &z) != 0)
|
||||
if ((error = m_geti (mp, &z)) != 0)
|
||||
goto err;
|
||||
fakeh->lastmap[2] = z;
|
||||
if (m_geti (mp, &z) != 0)
|
||||
if ((error = m_geti (mp, &z)) != 0)
|
||||
goto err;
|
||||
fakeh->lastmap[3] = z;
|
||||
break;
|
||||
case FAKEH_TIMEOUT:
|
||||
if (m_geti (mp, &z) != 0)
|
||||
if ((error = m_geti (mp, &z)) != 0)
|
||||
goto err;
|
||||
if ((z < 4 || z >= 4090) && (z != 0))
|
||||
goto err;
|
||||
|
@ -257,6 +279,7 @@ fakeh_proto (queue_t * q, mblk_t * mp, char down)
|
|||
timeout ((void *)fake_h_timer, fakeh, fakeh->timer * HZ);
|
||||
fakeh->timer = z;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (mp != NULL) {
|
||||
|
@ -274,7 +297,7 @@ fakeh_proto (queue_t * q, mblk_t * mp, char down)
|
|||
return;
|
||||
err:
|
||||
mp->b_rptr = origmp;
|
||||
m_reply (q, mp, EINVAL);
|
||||
m_reply (q, mp, error ? error : -EINVAL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -282,9 +305,9 @@ fakeh_proto (queue_t * q, mblk_t * mp, char down)
|
|||
static void
|
||||
fakeh_wput (queue_t * q, mblk_t * mp)
|
||||
{
|
||||
switch (mp->b_datap->db_type) {
|
||||
switch (DATA_TYPE(mp)) {
|
||||
case MSG_PROTO:
|
||||
CASE_DATA
|
||||
case CASE_DATA:
|
||||
putq (q, mp);
|
||||
break;
|
||||
case M_FLUSH:
|
||||
|
@ -307,33 +330,43 @@ fakeh_wsrv (queue_t * q)
|
|||
mblk_t *mp;
|
||||
|
||||
while ((mp = getq (q)) != NULL) {
|
||||
switch (mp->b_datap->db_type) {
|
||||
switch (DATA_TYPE(mp)) {
|
||||
case MSG_PROTO:
|
||||
fakeh_proto (q, mp, 1);
|
||||
break;
|
||||
CASE_DATA
|
||||
case CASE_DATA:
|
||||
{
|
||||
mblk_t *mh;
|
||||
short offlen;
|
||||
|
||||
if (!canput (q->q_next)) {
|
||||
putbq (q, mp);
|
||||
return;
|
||||
}
|
||||
if (/* XXX */ 0 || mp->b_datap->db_ref > 1 ||
|
||||
mp->b_datap->db_base > mp->b_rptr - 4) {
|
||||
mh = allocb(fakeh->offset+4,BPRI_LO);
|
||||
if(fakeh->do_ethertype)
|
||||
offlen = 2;
|
||||
else
|
||||
offlen = 4;
|
||||
if (/* XXX */ 0 || DATA_REFS(mp) > 1 ||
|
||||
DATA_START(mp) > mp->b_rptr - offlen) {
|
||||
mh = allocb(fakeh->offset+offlen,BPRI_LO);
|
||||
if(mh == NULL) {
|
||||
putbqf(q,mp);
|
||||
return;
|
||||
}
|
||||
mh->b_datap->db_type = mp->b_datap->db_type;
|
||||
mh->b_rptr += fakeh->offset+4;
|
||||
mh->b_wptr += fakeh->offset+4;
|
||||
DATA_TYPE(mh) = DATA_TYPE(mp);
|
||||
mh->b_rptr += fakeh->offset+offlen;
|
||||
mh->b_wptr += fakeh->offset+offlen;
|
||||
linkb (mh, mp);
|
||||
mp = mh;
|
||||
}
|
||||
mp->b_rptr -= 4;
|
||||
*(long *)mp->b_rptr = htonl(0x0F000800);
|
||||
if(fakeh->do_ethertype) {
|
||||
mp->b_rptr -= 2;
|
||||
*(short *)mp->b_rptr = htons(0x0F00);
|
||||
} else {
|
||||
mp->b_rptr -= 4;
|
||||
*(long *)mp->b_rptr = htonl(0x0F000800);
|
||||
}
|
||||
putnext (q, mp);
|
||||
}
|
||||
break;
|
||||
|
@ -342,7 +375,7 @@ fakeh_wsrv (queue_t * q)
|
|||
flushq (q, FLUSHDATA);
|
||||
/* FALL THRU */
|
||||
default:
|
||||
if (mp->b_datap->db_type > QPCTL || canput (q->q_next)) {
|
||||
if (DATA_TYPE(mp) > QPCTL || canput (q->q_next)) {
|
||||
putnext (q, mp);
|
||||
continue;
|
||||
} else {
|
||||
|
@ -358,7 +391,7 @@ fakeh_wsrv (queue_t * q)
|
|||
static void
|
||||
fakeh_rput (queue_t * q, mblk_t * mp)
|
||||
{
|
||||
switch (mp->b_datap->db_type) {
|
||||
switch (DATA_TYPE(mp)) {
|
||||
|
||||
case M_FLUSH:
|
||||
if (*mp->b_rptr & FLUSHR) {
|
||||
|
@ -367,7 +400,7 @@ fakeh_rput (queue_t * q, mblk_t * mp)
|
|||
putnext (q, mp); /* send it along too */
|
||||
break;
|
||||
case MSG_PROTO:
|
||||
CASE_DATA
|
||||
case CASE_DATA:
|
||||
putq (q, mp); /* queue it for my service routine */
|
||||
break;
|
||||
|
||||
|
@ -385,11 +418,11 @@ fakeh_rsrv (queue_t * q)
|
|||
register struct fakeh_ *fakeh = (struct fakeh_ *) q->q_ptr;
|
||||
|
||||
while ((mp = getq (q)) != NULL) {
|
||||
switch (mp->b_datap->db_type) {
|
||||
switch (DATA_TYPE(mp)) {
|
||||
case MSG_PROTO:
|
||||
fakeh_proto (q, mp, 0);
|
||||
break;
|
||||
CASE_DATA
|
||||
case CASE_DATA:
|
||||
{
|
||||
unsigned long xhdr;
|
||||
short tlen = dsize (mp);
|
||||
|
@ -405,24 +438,36 @@ fakeh_rsrv (queue_t * q)
|
|||
}
|
||||
mq = pullupm(mp,4);
|
||||
if(mq == NULL) {
|
||||
putbq (q, mp);
|
||||
putbqf (q, mp);
|
||||
return;
|
||||
}
|
||||
mp = mq;
|
||||
xhdr = *(long *)mp->b_rptr & ntohl(0xFF00FFFF);
|
||||
mp->b_rptr += 4;
|
||||
if (xhdr != ntohl(0x0F000800)) {
|
||||
if(fakeh->do_ethertype) {
|
||||
xhdr = *(short *)mp->b_rptr & htons(0xFF00);
|
||||
mp->b_rptr += 2;
|
||||
} else {
|
||||
xhdr = *(long *)mp->b_rptr & htonl(0xFF00FFFF);
|
||||
mp->b_rptr += 4;
|
||||
}
|
||||
if (xhdr != (fakeh->do_ethertype ? htons(0x0F00) : htonl(0x0F000800))) {
|
||||
#ifdef DO_KEEPALIVES
|
||||
if(fakeh->do_ethertype) {
|
||||
mp->b_rptr -= 2;
|
||||
xhdr = *(long *)mp->b_rptr & htonl(0xFF00FFFF);
|
||||
mp->b_rptr += 4;
|
||||
}
|
||||
if(xhdr == ntohl(0x8F008035)) {
|
||||
mq = pullupm(mp,12);
|
||||
if (mq == NULL) {
|
||||
freemsg (mp);
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
mp = mq;
|
||||
fakeh->last_a = *(long *)mp->b_rptr++;
|
||||
fakeh->last_b = *(long *)mp->b_rptr++;
|
||||
fakeh->last_c = *(long *)mp->b_rptr++;
|
||||
}
|
||||
#endif
|
||||
freemsg(mp);
|
||||
continue;
|
||||
}
|
||||
|
@ -433,7 +478,7 @@ fakeh_rsrv (queue_t * q)
|
|||
case M_ERROR:
|
||||
/* FALL THRU */
|
||||
default:
|
||||
if (mp->b_datap->db_type > QPCTL || canput (q->q_next)) {
|
||||
if (DATA_TYPE(mp) > QPCTL || canput (q->q_next)) {
|
||||
putnext (q, mp);
|
||||
continue;
|
||||
} else {
|
|
@ -0,0 +1,26 @@
|
|||
HEADERS = $(wildcard *.h)
|
||||
|
||||
TOPDIR=..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
||||
all:: $(KERNELSRC)/include/linux/autoconf.h $(KERNELSRC)/include/linux/version.h
|
||||
|
||||
depend::
|
||||
rm -f symtables
|
||||
cp /dev/null symtables
|
||||
|
||||
$(KERNELSRC)/include/linux/autoconf.h $(KERNELSRC)/include/linux/version.h:
|
||||
@echo "Die Kernelsourcen sind entweder irgendwo, nur nicht in "
|
||||
@echo "$(KERNELSRC), oder jemand hat dort 'make mrproper' "
|
||||
@echo "aufgerufen. -> Gehe nach $(KERNELSRC),"
|
||||
@echo "make config; make dep; make clean; make; installiere das Teil,"
|
||||
@echo "dann komm wieder und mache hier weiter."
|
||||
@exit 1
|
||||
|
||||
install::
|
||||
-mkdir -p $${MODDIR:-/lib/modules}/$(shell ../tools/getversion)/isdn
|
||||
-mkdir -p $(DESTDIR)/bin-$(shell ../tools/getversion)
|
||||
cp /dev/null ../modules.isdn
|
||||
|
||||
clean::
|
||||
rm -f ../modules.isdn
|
|
@ -13,9 +13,6 @@
|
|||
typedef unsigned char streamchar;
|
||||
#endif
|
||||
|
||||
/* =()<#define UP_DELAY @<UP_DELAY>@>()= */
|
||||
#define UP_DELAY (HZ / 2)
|
||||
|
||||
#ifdef KERNEL
|
||||
/* =()<#define @<NEED_SPL>@_NEED_SPL>()= */
|
||||
#define DONT_NEED_SPL
|
||||
|
@ -28,25 +25,16 @@ typedef unsigned char streamchar;
|
|||
#define NEW_TIMEOUT
|
||||
#endif
|
||||
|
||||
/* =()<#define @<ADDERROR>@_ADDERROR>()= */
|
||||
#define DONT_ADDERROR
|
||||
|
||||
#else
|
||||
#define OLD_TIMEOUT
|
||||
#define DONT_ADDERROR
|
||||
#define DONT_NEED_MEMCPY
|
||||
#define DONT_NEED_SPL
|
||||
#endif
|
||||
|
||||
/* =()<#define @<ADDERROR>@_ADDERROR>()= */
|
||||
#define DONT_ADDERROR
|
||||
/* =()<#define @<DEBUGGING>@_DEBUGGING>()= */
|
||||
#define DO_DEBUGGING
|
||||
|
||||
#ifdef KERNEL
|
||||
/* =()<#define CONF_MOD2 @<CONF_MOD2>@>()= */
|
||||
#define CONF_MOD2 0x00
|
||||
/* =()<#define CONF_DEBUG @<CONF_DEBUG>@>()= */
|
||||
#define CONF_DEBUG 0x5006
|
||||
#else
|
||||
#ifndef KERNEL
|
||||
#ifdef DO_DEBUGGING
|
||||
|
||||
#ifndef CONFIG_DEBUG_STREAMS
|
||||
|
@ -87,18 +75,6 @@ extern char *strdup (const char *xx);
|
|||
extern int writev(int fd, struct iovec *vp, int vpcount);
|
||||
#endif
|
||||
|
||||
/* =()<#define @<ANSWER_IMMEDIATE>@_ANSWER_IMMEDIATE>()= */
|
||||
#define DONT_ANSWER_IMMEDIATE
|
||||
|
||||
/* =()<#define @<TEI_FIXED>@_TEI_FIXED>()= */
|
||||
#define DO_TEI_FIXED
|
||||
|
||||
/* =()<#define @<TEI_IMMEDIATE>@_TEI_IMMEDIATE>()= */
|
||||
#define DONT_TEI_IMMEDIATE
|
||||
|
||||
/* =()<#define @<L2_DOWN>@_L2_DOWN>()= */
|
||||
#define DO_L2_DOWN
|
||||
|
||||
/* =()<#define @<MULTI_TEI>@_MULTI_TEI>()= */
|
||||
#define DONT_MULTI_TEI
|
||||
|
||||
|
@ -106,6 +82,12 @@ extern int writev(int fd, struct iovec *vp, int vpcount);
|
|||
#define ROUTE_PATH "/sbin/route"
|
||||
|
||||
/* =()<#define LOCKNAME "@<LOCKNAME>@">()= */
|
||||
#define LOCKNAME "/var/lock/uucp/LCK..%s"
|
||||
#define LOCKNAME "/var/lock/LCK..%s"
|
||||
|
||||
/* =()<#define ROOTUSER "@<ROOT>@">()= */
|
||||
#define ROOTUSER "smurf"
|
||||
|
||||
/* =()<#define @<GARBAGE>@_COLLECT>()= */
|
||||
#define DONT_COLLECT
|
||||
|
||||
#endif /* _CONFIG_H */
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _DUMP_H_
|
||||
#define _DUMP_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "kernel.h"
|
||||
#include "isdn_23.h"
|
||||
|
||||
#ifdef DEBUG
|
|
@ -9,7 +9,13 @@
|
|||
#define _IOWR(a,b,c) _IOSWR((a),(b),(c))
|
||||
#endif
|
||||
|
||||
#if defined(AUX) || defined(linux)
|
||||
#ifdef linux
|
||||
#ifdef KERNEL
|
||||
#include <linux/ioctl.h>
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
#define INET
|
||||
#include "primitives.h"
|
||||
|
||||
#if defined(linux) && !defined(CONFIG_INET_BSD)
|
||||
#if defined(linux) && (defined(KERNEL) || (__GNU_LIBRARY__-0 < 6))
|
||||
|
||||
/* If somebody could please reboot the person responsible for this.
|
||||
Start over. It avoids a big whole lot of hassle for us all. Thanks. */
|
||||
|
@ -49,12 +49,12 @@
|
|||
#define icmp_code code
|
||||
#define icmp_cksum checksum
|
||||
|
||||
|
||||
#include <linux/in.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/icmp.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/udp.h>
|
||||
#include <linux/if_ether.h>
|
||||
#define ADR(x) x /* in struct ip */
|
||||
#define _F_DONE
|
||||
#endif
|
||||
|
@ -69,13 +69,17 @@
|
|||
#include <sys/protosw.h>
|
||||
#endif
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/in_var.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/tcp.h>
|
||||
#ifndef __linux__
|
||||
#include <netinet/in_var.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/ip_icmp.h>
|
||||
#endif
|
||||
#define THFLAG(a) (a)->th_flags
|
||||
#ifndef linux
|
||||
#define SOCK_HAS_LEN /* socket has sa_len field */
|
||||
#endif
|
||||
#endif /* F_DONE */
|
||||
#endif /* _F_IP */
|
|
@ -4,19 +4,13 @@
|
|||
|
||||
#ifdef linux
|
||||
#define HAVEMALLOC
|
||||
#include "compat.h"
|
||||
#include <linux/config.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/malloc.h>
|
||||
#undef malloc
|
||||
#undef free
|
||||
#ifdef CONFIG_MALLOC_NAMES
|
||||
#define malloc(x) deb_kmalloc(__FILE__,__LINE__,(x),GFP_ATOMIC)
|
||||
#define free(x) deb_kfree_s(__FILE__,__LINE__,(x),0)
|
||||
#else
|
||||
#define malloc(x) kmalloc((x),GFP_ATOMIC)
|
||||
#define free(x) kfree((x))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* other kernels here */
|
||||
|
|
@ -2,13 +2,30 @@
|
|||
#if defined (linux) && defined(__KERNEL__) && defined(MODULE)
|
||||
#define _HAS_MODULE
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/version.h>
|
||||
#ifdef F_NOCODE
|
||||
#define __NO_VERSION__
|
||||
#endif
|
||||
|
||||
#include <linux/config.h>
|
||||
#ifdef __GENKSYMS__
|
||||
#include <linux/module.h>
|
||||
#endif
|
||||
#ifdef CONFIG_MODVERSIONS
|
||||
#define MODVERSIONS
|
||||
#include <linux/modversions.h>
|
||||
|
||||
#ifndef CONFIG_MODVERSIONS /* why does modversions clear this?? */
|
||||
#define CONFIG_MODVERSIONS
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#ifndef __GENKSYMS__
|
||||
#include <linux/module.h>
|
||||
#endif
|
||||
#include "symtables"
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#ifndef F_NOCODE
|
||||
char kernel_version[] = UTS_RELEASE;
|
||||
|
||||
static int do_init_module(void);
|
||||
static int do_exit_module(void);
|
||||
|
@ -19,10 +36,7 @@ int init_module(void)
|
|||
}
|
||||
|
||||
void cleanup_module( void) {
|
||||
if (MOD_IN_USE)
|
||||
printk(KERN_INFO "module is in use, remove delayed\n");
|
||||
else
|
||||
do_exit_module();
|
||||
do_exit_module();
|
||||
}
|
||||
#endif
|
||||
#define MORE_USE MOD_INC_USE_COUNT
|
|
@ -6,6 +6,11 @@
|
|||
#include <linux/signal.h>
|
||||
#else
|
||||
#include <signal.h>
|
||||
|
||||
#if __GNU_LIBRARY__ -0 < 6
|
||||
#define bsd_signal(a,b) signal((a),(b))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef SYSV_SIGTYPE
|
||||
|
@ -33,7 +38,7 @@
|
|||
#else
|
||||
#define SIG_SUSPEND(_var,_sig) do { (_var).__sign = _sig; (_var).__sig = signal(_sig,SIG_IGN); } while(0)
|
||||
#endif
|
||||
#define SIG_RESUME(_var) do { (void) signal((_var).__sign, (_var).__sig); } while(0)
|
||||
#define SIG_RESUME(_var) do { (void) bsd_signal((_var).__sign, (_var).__sig); } while(0)
|
||||
|
||||
#endif
|
||||
|
|
@ -1,2 +1,6 @@
|
|||
#ifdef KERNEL
|
||||
#include <linux/termios.h>
|
||||
#else
|
||||
/* =()<#include <@<TERMIO>@.h>>()= */
|
||||
#include <termios.h>
|
||||
#endif
|
|
@ -4,7 +4,7 @@
|
|||
#ifdef KERNEL
|
||||
|
||||
#ifdef linux
|
||||
#include <linux/syscompat.h>
|
||||
#include "compat.h"
|
||||
#endif
|
||||
|
||||
#ifdef M_UNIX /* SCO et al */
|
|
@ -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.
|
||||
*/
|
|
@ -1,7 +1,11 @@
|
|||
#ifndef _ISDN_12
|
||||
#define _ISDN_12
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/types.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include "streams.h"
|
||||
|
||||
/*
|
||||
|
@ -24,6 +28,10 @@
|
|||
|
||||
struct _isdn1_card;
|
||||
|
||||
/*
|
||||
* Download boot code.
|
||||
*/
|
||||
typedef int (*C_boot)(struct _isdn1_card * card, int step, int offset, mblk_t *data);
|
||||
/*
|
||||
* Initiate mode changes. For the D channel, zero means to turn off L1; one
|
||||
* turns L1 back on. For the B channels, see M_*. "listen" on the B
|
||||
|
@ -39,8 +47,14 @@ typedef int (*C_ch_mode) (struct _isdn1_card * card, short channel, char mode,
|
|||
* driver program.
|
||||
*/
|
||||
typedef int (*C_ch_prot) (struct _isdn1_card * card, short channel, mblk_t * proto, int flags);
|
||||
#define CHP_BACKCHAN 01 /* Back channel from the stack to the card */
|
||||
#define CHP_MODLIST 02 /* includes a module list */
|
||||
#define CHP_FROMSTACK 01 /* travels from the channel to the master */
|
||||
#define CHP_MODLIST 02 /* module list */
|
||||
#define CHP_TOCARD 04 /* internal to isdn_2.c: send to card first, if there's a handler */
|
||||
|
||||
/*
|
||||
* Check if the card has data for us.
|
||||
*/
|
||||
typedef int (*C_poll) (struct _isdn1_card * card, short channel);
|
||||
|
||||
/*
|
||||
* Check if buffer space is available
|
||||
|
@ -58,19 +72,19 @@ typedef int (*C_data) (struct _isdn1_card * card, short channel, mblk_t * data);
|
|||
typedef int (*C_flush) (struct _isdn1_card * card, short channel);
|
||||
|
||||
struct _isdn1_card {
|
||||
ushort nr_chans; /* Basic access has 2, cheap cards have just
|
||||
* one. */
|
||||
void *ctl; /* Pointer for L1 data structures, card
|
||||
uchar_t nr_chans; /* total per card */
|
||||
uchar_t nr_dchans; /* zero == one. */
|
||||
void *ctl; /* Pointer for L2 data structures, card
|
||||
* drivers must not touch this. */
|
||||
struct _isdn_chan *chan; /* Pointer to array. First is the D channel. */
|
||||
ulong_t modes; /* Modes available on this card. */
|
||||
#define CHM_INTELLIGENT 01 /* If this bit is set, the card is clever and modes>>1 has the ID of the high-level driver. */
|
||||
|
||||
C_ch_mode ch_mode;
|
||||
C_ch_prot ch_prot;
|
||||
C_data send;
|
||||
C_flush flush;
|
||||
C_candata cansend;
|
||||
C_poll poll; /* check if the card can send more data */
|
||||
C_boot boot;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -93,7 +107,10 @@ extern int isdn2_unregister (struct _isdn1_card *card);
|
|||
*/
|
||||
extern void isdn2_new_state (struct _isdn1_card *card, char state);
|
||||
|
||||
extern void isdn2_new_proto (struct _isdn1_card *card, short channel, mblk_t * proto);
|
||||
/*
|
||||
* Report errors / changes in card state, for intelligent cards
|
||||
*/
|
||||
extern void isdn2_chstate (struct _isdn1_card *card, uchar_t ind, short add);
|
||||
|
||||
/*
|
||||
* Callback to test availability of queue space. Cards are not required to call
|
||||
|
@ -117,7 +134,7 @@ extern int isdn2_recv (struct _isdn1_card *card, short channel, mblk_t * data);
|
|||
extern int isdn2_backenable (struct _isdn1_card *card, short channel);
|
||||
|
||||
/*
|
||||
* Callback for mode setup.
|
||||
* Callback for protocol setup.
|
||||
*/
|
||||
extern int isdn2_chprot (struct _isdn1_card * card, short channel, mblk_t * proto, int flags);
|
||||
|
|
@ -2,8 +2,13 @@
|
|||
#define _ISDN_2
|
||||
|
||||
#include "config.h"
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/types.h>
|
||||
#include <linux/param.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#include "x75lib.h"
|
||||
#include "smallq.h"
|
||||
#include "isdn_limits.h"
|
||||
|
@ -27,7 +32,7 @@ enum M_state {
|
|||
typedef struct _isdn2_chan {
|
||||
queue_t *qptr; /* read queue (i.e. going up) for Streams */
|
||||
struct _isdn2_card *card; /* NULL if not assigned to a card */
|
||||
struct _isdn_chan *chan; /* B channel: data buffer */
|
||||
ulong_t connref; /* if attached: refnum of attachment */
|
||||
mblk_t *bufx;
|
||||
#ifdef NEW_TIMEOUT
|
||||
int timer_unblock;
|
||||
|
@ -42,6 +47,7 @@ enum C_state {
|
|||
C_down, /* Link is down */
|
||||
C_await_up, /* Link going up */
|
||||
C_await_down, /* Link going down */
|
||||
C_await_back_up, /* Link going down, then back up, grr */
|
||||
C_up, /* Link up */
|
||||
C_lock_up, /* Link up, locked because the wire
|
||||
doesn't want to stay down */
|
||||
|
@ -55,7 +61,7 @@ enum C_state {
|
|||
typedef struct _isdn2_card {
|
||||
struct _isdn1_card *card;
|
||||
struct _isdn2_card *next;
|
||||
struct _isdn2_chan *chan[MAXCHAN]; /* pointer to B/D channels */
|
||||
struct _isdn2_chan *chan[MAXCHAN+1]; /* pointer to B/D channels */
|
||||
#ifdef DO_MULTI_TEI
|
||||
struct _isdn2_state *state[MAX_B];
|
||||
#else
|
||||
|
@ -66,6 +72,7 @@ typedef struct _isdn2_card {
|
|||
int timer_takedown;
|
||||
#endif
|
||||
long id;
|
||||
int flags;
|
||||
enum C_state status; /* physical link state */
|
||||
#ifdef DO_MULTI_TEI
|
||||
uchar_t TEI[MAX_B];
|
||||
|
@ -74,9 +81,9 @@ typedef struct _isdn2_card {
|
|||
uchar_t TEI[1];
|
||||
#endif
|
||||
uchar_t nr;
|
||||
int timedown:1;
|
||||
int timeup:1;
|
||||
int offline:1; /* temporarily off -- no cable */
|
||||
unsigned int timedown:2;
|
||||
unsigned int timeup:1;
|
||||
unsigned int offline:1; /* temporarily off -- no cable */
|
||||
} *isdn2_card;
|
||||
|
||||
#endif /* _ISDN_2 */
|
|
@ -1,7 +1,11 @@
|
|||
#ifndef _ISDN_23
|
||||
#define _ISDN_23
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/types.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include "config.h"
|
||||
|
||||
/**
|
||||
|
@ -18,6 +22,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. */
|
||||
|
@ -62,6 +67,8 @@ typedef struct _isdn23_hdr {
|
|||
* protocols. */
|
||||
ushort_t len;
|
||||
uchar_t card;
|
||||
uchar_t dchan;
|
||||
uchar_t flags; /* 01: outgoing */
|
||||
} _hdr_rawdata;
|
||||
|
||||
struct { /* A device has been opened. */
|
||||
|
@ -79,15 +86,15 @@ typedef struct _isdn23_hdr {
|
|||
|
||||
struct { /* Attach B/D channel */
|
||||
SUBDEV minor; /* Device to attach to */
|
||||
ulong_t connref; /* for syncronization with detach */
|
||||
uchar_t card; /* which card? */
|
||||
uchar_t chan; /* B/D channel to attach. Zero: D chan, else
|
||||
* B. */
|
||||
uchar_t mode; /* Mode to switch card to */
|
||||
uchar_t chan; /* B/D channel to attach. Zero: D chan, else * B. */
|
||||
char listen; /* listen-only mode? (Bit 1) Force channel? (bit 2) */
|
||||
} _hdr_attach; /* Downstream only. */
|
||||
|
||||
struct { /* disconnect B/D channel */
|
||||
SUBDEV minor; /* what to disconnect */
|
||||
ulong_t connref; /* for syncronization with attach */
|
||||
uchar_t error; /* force error? */
|
||||
uchar_t perm; /* also take down protocol stack */
|
||||
} _hdr_detach; /* Usually downstream. Upstream if card
|
||||
|
@ -96,7 +103,10 @@ typedef struct _isdn23_hdr {
|
|||
struct { /* Card present. Request: L1 Up, bchans
|
||||
* compared */
|
||||
uchar_t card; /* Card ID. Counting up from zero. */
|
||||
uchar_t bchans;
|
||||
uchar_t dchans; /* for the card */
|
||||
uchar_t bchans; /* per D channel */
|
||||
uchar_t flags; /* Some stuff */
|
||||
#define HDR_CARD_DEBUG 01 /* send D channel trace up */
|
||||
long id; /* Unique ID of this card, for hardware
|
||||
* config. Usually the first three characters
|
||||
* identify the card and the last is a serial
|
||||
|
@ -146,11 +156,6 @@ typedef struct _isdn23_hdr {
|
|||
/* invalid isdn23_hdr follows */
|
||||
} _hdr_inval; /* Note: There's usually no need to analyze
|
||||
* the errors. */
|
||||
#ifdef DO_BOOT
|
||||
struct { /* Report an error: invalid command */
|
||||
int doboot;
|
||||
} _hdr_boot;
|
||||
#endif
|
||||
struct { /* Get/Set the TEI for a card */
|
||||
uchar_t card;
|
||||
uchar_t TEI; /* TEI_BROADCAST means the TEI is unassigned */
|
||||
|
@ -161,13 +166,23 @@ typedef struct _isdn23_hdr {
|
|||
* feature. However, the implementation gets
|
||||
* somewhat cleaner if the TEI negotiation
|
||||
* handler is just another L3 protocol */
|
||||
struct {
|
||||
ushort_t len;
|
||||
uchar_t card;
|
||||
int seqnum;
|
||||
int foffset;
|
||||
} _hdr_load; /* download some code to the card */
|
||||
/*
|
||||
* Setting the TEI to TEI_BROADCAST does the Right Thing WRT to
|
||||
* protocol handlers.
|
||||
*/
|
||||
|
||||
} sel;
|
||||
} *isdn23_hdr;
|
||||
}
|
||||
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
|
||||
__attribute__((packed))
|
||||
#endif
|
||||
*isdn23_hdr;
|
||||
|
||||
/* Aliases for writing actual programs. *//* Keys for debugging L2. */
|
||||
#define hdr_atcmd sel._hdr_atcmd /* A */
|
||||
|
@ -187,9 +202,7 @@ typedef struct _isdn23_hdr {
|
|||
#define hdr_notify sel._hdr_notify /* I */
|
||||
#define hdr_inval sel._hdr_inval /* Z */
|
||||
#define hdr_tei sel._hdr_tei /* K */
|
||||
#ifdef DO_BOOT
|
||||
#define hdr_boot sel._hdr_boot /* B */
|
||||
#endif
|
||||
#define hdr_load sel._hdr_load /* L */
|
||||
|
||||
/* Magic numbers. */
|
||||
|
||||
|
@ -210,9 +223,7 @@ typedef struct _isdn23_hdr {
|
|||
#define HDR_INVAL 15
|
||||
#define HDR_TEI 16
|
||||
#define HDR_PROTOCMD 17
|
||||
#ifdef DO_BOOT
|
||||
#define HDR_BOOT 18
|
||||
#endif
|
||||
#define HDR_LOAD 18
|
||||
|
||||
#define HDR_FLAGS 0x80
|
||||
#define HDR_NOERROR 0x80
|
|
@ -1,8 +1,13 @@
|
|||
#ifndef _ISDN_3
|
||||
#define _ISDN_3
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/types.h>
|
||||
#include <linux/param.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#include "streams.h"
|
||||
#include "isdn_limits.h"
|
||||
#include "config.h"
|
||||
|
@ -30,7 +35,9 @@ typedef struct _isdn3_card { /* One per card */
|
|||
ulong_t modes; /* Mask of permitted modes on this card. */
|
||||
uchar_t nr; /* Card number, for L2. */
|
||||
uchar_t TEI; /* For reference */
|
||||
uchar_t bchans; /* Number of B channels. */
|
||||
uchar_t dchans; /* Number of D channels per card. */
|
||||
uchar_t bchans; /* Number of B channels per D channel. */
|
||||
unsigned is_up:2;
|
||||
} *isdn3_card;
|
||||
|
||||
/**
|
||||
|
@ -51,12 +58,6 @@ typedef void (*P_hndl_init) (void);
|
|||
*/
|
||||
typedef void (*P_hndl_newcard) (struct _isdn3_card * card);
|
||||
|
||||
/*
|
||||
* Find out which mode flags would work for this. The protocol values depend on
|
||||
* the handler.
|
||||
*/
|
||||
typedef ulong_t (*P_hndl_modeflags) (long protocol);
|
||||
|
||||
/*
|
||||
* Incoming data. isUI != zero if this was an UI frame. Bit 1 of isUI is set if
|
||||
* this is a broadcast packet.
|
||||
|
@ -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;
|
||||
|
@ -109,7 +115,6 @@ typedef struct _isdn3_hndl {
|
|||
|
||||
P_hndl_init init;
|
||||
P_hndl_newcard newcard; /* New card shows up */
|
||||
P_hndl_modeflags modeflags; /* Correct mode? */
|
||||
P_hndl_chstate chstate; /* L2 goes up or down */
|
||||
P_hndl_report report; /* Report settings */
|
||||
P_hndl_recv recv; /* Data from L2 */
|
||||
|
@ -119,6 +124,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 +133,9 @@ typedef struct _isdn3_hndl {
|
|||
** Calls managed by this connection are chained off the struct.
|
||||
**/
|
||||
|
||||
#define NITALK 11
|
||||
#define NSTALK 5
|
||||
|
||||
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 +143,17 @@ 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 STACK_LEN 30
|
||||
#define NICONN 25
|
||||
#define NSCONN 3
|
||||
#define NBCONN 2
|
||||
|
||||
typedef struct _isdn3_conn {
|
||||
struct _isdn3_card *card; /* Card this call is running on */
|
||||
|
@ -154,10 +165,12 @@ typedef struct _isdn3_conn {
|
|||
* card/protocol/subprotocol. */
|
||||
long subprotocol; /* Protocol dependent. Phone: Q931 vs Post
|
||||
* vs... */
|
||||
char stack[STACK_LEN]; /* Protocol stack to set up on this
|
||||
* connection */
|
||||
int *v[NCONNVEC]; /* additional and possibly-long parameters */
|
||||
char stack[STACK_LEN]; /* Protocol stack to set up on this connection */
|
||||
char site[STACK_LEN]; /* System to talk to */
|
||||
int delay; /* don't get at it right away */
|
||||
long conni[NICONN]; /* additional variables, handler dependent */
|
||||
void *conns[NSCONN];
|
||||
mblk_t *connb[NBCONN];
|
||||
#ifdef NEW_TIMEOUT /* Grumble */
|
||||
int start_timer;
|
||||
int delay_timer;
|
||||
|
@ -167,7 +180,6 @@ typedef struct _isdn3_conn {
|
|||
uchar_t state; /* Protocol dependent. Zero means
|
||||
* free&unassigned. */
|
||||
uchar_t lockit; /* Lock against inadvertent free */
|
||||
uchar_t mode; /* mode of attached B channel */
|
||||
uchar_t bchan; /* number of B channel. Zero if none or
|
||||
* through D. */
|
||||
SUBDEV minor; /* minor number for data. Zero if none yet. */
|
||||
|
@ -183,45 +195,45 @@ typedef struct _isdn3_conn {
|
|||
|
||||
/** Minorstate flags */
|
||||
/* State */
|
||||
#define MS_PROTO 01 /* mirrors MINOR_PROTO flag */
|
||||
#define MS_INCOMING 02 /* This is an incoming connection */
|
||||
#define MS_OUTGOING 04 /* This is an outgoing connection */
|
||||
#define MS_INCOMING 02 /* This is an incoming connection */
|
||||
#define MS_OUTGOING 04 /* This is an outgoing connection */
|
||||
|
||||
#define MS_CONN_NONE 00
|
||||
#define MS_CONN_LISTEN 010 /* B channel connected, but connection not
|
||||
* established */
|
||||
#define MS_CONN 020 /* B channel connected */
|
||||
#define MS_CONN_INTERRUPT 030 /* B channel temporarily disconnected */
|
||||
#define MS_CONN_MASK 030
|
||||
#define MS_CONN_NONE 000
|
||||
#define MS_CONN_SETUP 010 /* B channel associated, but no data transfer yet */
|
||||
#define MS_CONN_LISTEN 020 /* B channel connected, but connection not fully established */
|
||||
#define MS_CONN 030 /* B channel connected */
|
||||
#define MS_CONN_MASK 030
|
||||
|
||||
#define MS_CONN_TIMER 040 /* Supervisory timer running. The connection
|
||||
#define MS_CONN_TIMER 040 /* Supervisory timer running. The connection
|
||||
* is forcibly terminated if it is not
|
||||
* completed within two minutes. */
|
||||
#define MS_BCHAN 0100 /* The B channel is known and set up. (if
|
||||
#define MS_BCHAN 0100 /* The B channel is known and set up. (if
|
||||
* zero, it's connected through the D channel */
|
||||
#define MS_WANTCONN 0200 /* Set on CMD_DIAL/ANSWER, clear on CMD_OFF. */
|
||||
#define MS_DETACHED 0400 /* The call is (temporarily?) not connected. */
|
||||
#define MS_WANTCONN 0200 /* Set on CMD_DIAL/ANSWER, clear on CMD_OFF. */
|
||||
#define MS_DETACHED 0400 /* temporarily not connected */
|
||||
/* Actions */
|
||||
#define MS_DIR_SENT 01000 /* The directional info is sent to the
|
||||
#define MS_DIR_SENT 01000 /* The directional info is sent to the
|
||||
* device. */
|
||||
#define MS_SETUP_SENT 02000 /* The connection is attached to the B
|
||||
* channel. */
|
||||
#define MS_TERM_SENT 04000 /* L4 has been told that the connection is to
|
||||
* be terminated */
|
||||
#define MS_END_TIMER 010000 /* The delay timer to end the connection
|
||||
* cleanly is running */
|
||||
#define MS_SENTINFO 020000 /* Sent pertinent data up */
|
||||
#define MS_DELAYING 040000 /* Wait a bit */
|
||||
#define MS_INITPROTO 0100000 /* card protocols set */
|
||||
#define MS_INITPROTO_SENT 0200000 /* asked for setup */
|
||||
#define MS_SETUP_MASK 06000 /* what attach has been sent */
|
||||
#define MS_SETUP_NONE 00000
|
||||
#define MS_SETUP_ATTACH 02000
|
||||
#define MS_SETUP_LISTEN 04000
|
||||
#define MS_SETUP_CONN 06000
|
||||
|
||||
#define MS_END_TIMER 010000 /* The delay timer to end the connection
|
||||
* cleanly is running */
|
||||
#define MS_SENTINFO 020000 /* Sent pertinent data up */
|
||||
#define MS_DELAYING 040000 /* Wait a bit */
|
||||
#define MS_INITPROTO 0100000 /* card protocols set */
|
||||
#define MS_INITPROTO_SENT 0200000 /* asked for setup */
|
||||
#define MS_NOMINOR 0400000
|
||||
/*
|
||||
* if set and ms->delay == zero, we got killconn. This is a hack but there are
|
||||
* no more bits free.
|
||||
* if set and ms->delay == zero, we got killconn. This is a hack...
|
||||
*/
|
||||
#define MS_CONNDELAY_TIMER 02000000 /* Delay sending PROTO_CONN because the
|
||||
* back channel may get delayed */
|
||||
#define MS_FORWARDING 04000000 /* Forwarding this call; in progress. */
|
||||
#define MS_FORCING 010000000 /* call is enforced. */
|
||||
#define MS_FORWARDING 04000000 /* Forwarding this call; in progress. */
|
||||
#define MS_FORCING 010000000 /* call is enforced. */
|
||||
|
||||
/*
|
||||
* Register a handler
|
||||
|
@ -331,17 +343,12 @@ int Xisdn3_setup_conn (isdn3_conn conn, char established, const char*,unsigned);
|
|||
#define isdn3_setup_conn(a,b) Xisdn3_setup_conn((a),(b),__FILE__,__LINE__)
|
||||
|
||||
#define EST_DISCONNECT 0 /* The connection is not established. */
|
||||
#define EST_INTERRUPT 1 /* The connection is interrupted. */
|
||||
#define EST_NO_REAL_CHANGE 2 /* Marker value. Do not use */
|
||||
#define EST_WILL_DISCONNECT 3 /* The connection will be disconnected
|
||||
* shortly. */
|
||||
#define EST_WILL_INTERRUPT 4 /* The connection will be interrupted
|
||||
* shortly. */
|
||||
#define EST_NO_CHANGE 5 /* Something else happened (minorstate!)
|
||||
* which may trigger action */
|
||||
#define EST_LISTEN 6 /* eg when dialling out, dial tone is
|
||||
* attached */
|
||||
#define EST_CONNECT 7 /* End-to-end connection is established */
|
||||
#define EST_WILL_DISCONNECT 4 /* The connection will be disconnected shortly. */
|
||||
#define EST_NO_CHANGE 6 /* Something else happened (minorstate!) */
|
||||
#define EST_SETUP 8 /* Associate with card channel */
|
||||
#define EST_LISTEN 9 /* half-way communications, backwards */
|
||||
#define EST_CONNECT 10 /* End-to-end connection is established */
|
||||
|
||||
/*
|
||||
* Get a free call reference number.
|
||||
|
@ -374,6 +381,27 @@ void isdn3_repeat (isdn3_conn conn, ushort_t id, mblk_t * data);
|
|||
*/
|
||||
void conn_info (isdn3_conn conn, mblk_t * mb);
|
||||
|
||||
/*
|
||||
* Extract flags from conn info.
|
||||
*/
|
||||
long isdn3_flags(mblk_t *info, uchar_t protocol, uchar_t subprot);
|
||||
#define FL_UPDELAY 017
|
||||
#define FL_UPDELAY_SHIFT 3
|
||||
|
||||
#define FL_L2KEEP 020 /* default is to close L2 */
|
||||
#define FL_TEI_IMMED 040 /* default is to do that later */
|
||||
|
||||
#define FL_POINTOPOINT 0100 /* point-to-point */
|
||||
#define FL_MULTIPOINT1 0200 /* variable ID */
|
||||
#define FL_MULTIPOINT2 0000 /* fixed ID; special -> default */
|
||||
#define FL_MULTIPOINT3 0300 /* fixed TEI */
|
||||
#define FL_POINTMASK 0300
|
||||
|
||||
#define FL_ANS_IMMED 0400 /* default is to delay */
|
||||
#define FL_BUG1 01000
|
||||
#define FL_BUG2 02000
|
||||
#define FL_BUG3 04000
|
||||
|
||||
/**
|
||||
* Convenience macros for handling connection timeouts.
|
||||
*
|
||||
|
@ -391,10 +419,13 @@ void conn_info (isdn3_conn conn, mblk_t * mb);
|
|||
#define UNTIMER(T,c,w,f) do { if((c)->timerflags & f) { untimeout(w,(c)); (c)->timerflags &=~ f; } } while(0)
|
||||
#define untimer(T,c) UNTIMER(T,c,T,RUN_##T)
|
||||
#define TIMER(T,c,w,v,f) do { if(!((c)->timerflags & f)) { if((c)->talk->state & IS_UP) timeout(w,(c),v); (c)->timerflags |= f; } } while(0)
|
||||
#define timer(T,c) TIMER(T,c,T,VAL_##T,RUN_##T)
|
||||
#define timer(T,c) TIMER(T,(c),T,VAL_##T,RUN_##T)
|
||||
#define ntimer(T,c,n) TIMER(T,(c),T,(n),RUN_##T)
|
||||
#define FTIMER(T,c,w,v,f) do { if(!((c)->timerflags & f)) { timeout(w,(c),v); (c)->timerflags |= f; } } while(0)
|
||||
#define ftimer(T,c) FTIMER(T,c,T,VAL_##T,RUN_##T)
|
||||
#define RTIMER(T,c,w,v,f) do { if((c)->timerflags & f) { timeout(w,(c),v); } } while(0)
|
||||
#define rtimer(T,c) RTIMER(T,c,T,VAL_##T,RUN_##T)
|
||||
#define ftimer(T,c) FTIMER(T,(c),T,VAL_##T,RUN_##T)
|
||||
#define fntimer(T,c) FTIMER(T,(c),T,(n),RUN_##T)
|
||||
#define RTIMER(T,c,w,v,f) do { if((c)->timerflags & f) { untimeout(w,(c)); timeout(w,(c),v); } } while(0)
|
||||
#define rtimer(T,c) RTIMER(T,(c),T,VAL_##T,RUN_##T)
|
||||
#define rntimer(T,c,n) RTIMER(T,(c),T,(n),RUN_##T)
|
||||
|
||||
#endif /* _ISDN_3 */
|
|
@ -1,10 +1,17 @@
|
|||
#ifndef _ISDN_34
|
||||
#define _ISDN_34
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/types.h>
|
||||
#include <linux/ioctl.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
#include "config.h"
|
||||
|
||||
extern int log_34;
|
||||
|
||||
/**
|
||||
** Interface between Level 3 and the Level 4 handler
|
||||
**
|
||||
|
@ -24,6 +31,8 @@
|
|||
|
||||
#define PREF_NOERR '=' /* Prefix to disable error replies */
|
||||
|
||||
#define CMD_LOADFILE CHAR2('l','F') /* download part of a file */
|
||||
|
||||
#define CMD_FAKEOPEN CHAR2('f','o') /* Indicate that a /dev/isdn device has
|
||||
* been opened. This is used to avoid a
|
||||
* possible race condition */
|
||||
|
@ -42,7 +51,7 @@
|
|||
* :ARG_CHANNEL channel ::string" */
|
||||
#define CMD_NOPROT CHAR2 ('n','p')/* Protocol info was insufficient -- try
|
||||
* again */
|
||||
#define CMD_OFF CHAR2 ('d','i')/* Take a connection down. "CMD_OFF
|
||||
#define CMD_OFF CHAR2 ('O','F')/* Take a connection down. "CMD_OFF
|
||||
* :ARG_MINOR minor" */
|
||||
#define CMD_INFO CHAR2 ('-','-')/* Send a response text to the device.
|
||||
* "CMD_INFO :ARG_FMINOR minor ::text" */
|
||||
|
@ -53,6 +62,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. */
|
||||
|
@ -61,15 +71,14 @@
|
|||
#define CMD_FORWARD CHAR2('f','w')/* Forward this call */
|
||||
|
||||
/* Replies. */
|
||||
#define IND_PROTO CHAR2 ('i','p')/* Set up a protocol stack. */
|
||||
#define IND_PROTO_AGAIN CHAR2 ('i','a')/* Set up a protocol stack. */
|
||||
#define IND_CARDPROTO CHAR2 ('i','c')/* Set up a protocol stack. */
|
||||
#define IND_ERR CHAR2 ('e','r')/* Command error. */
|
||||
#define IND_NOERR CHAR2 ('o','k')/* Command error. */
|
||||
#define IND_INCOMING CHAR2 ('i','n') /* Incoming call. */
|
||||
#define IND_CONN CHAR2 ('c','o')/* Connected. */
|
||||
#define IND_CONN_ACK CHAR2('C','A')
|
||||
#define IND_DISC CHAR2 ('D','i')/* Disconnected. */
|
||||
#define IND_DISCONNECTING CHAR2 ('D','j')/* Disconnect in progress. */
|
||||
#define IND_DISCONNECT CHAR2 ('D','i')/* Disconnected. */
|
||||
#if 0
|
||||
#define IND_PACKET CHAR2 ('p','a')/* Unanalysed packet data from below. */
|
||||
#endif
|
||||
|
@ -86,22 +95,24 @@
|
|||
#define IND_OPEN CHAR2 ('o','p') /* Port opened. */
|
||||
#define IND_INFO CHAR2 ('-','-') /* Informational message */
|
||||
#define CMD_DOCARD CHAR2 ('!','C') /* Set up this card */
|
||||
#define IND_CARD CHAR2 ('C','d') /* Card coming online. IND_CARD
|
||||
* arg_card arg_bchan arg_modemask. */
|
||||
#define IND_NOCARD CHAR2 ('C','n') /* Card going offline. IND_NOCARD
|
||||
* arg_card. */
|
||||
#define IND_CARD CHAR2 ('C','d') /* Card added. */
|
||||
#define IND_RECARD CHAR2 ('C','e') /* Card coming back online. */
|
||||
#define IND_OFFCARD CHAR2 ('C','f') /* Card seems offline. */
|
||||
#define IND_NOCARD CHAR2 ('C','n') /* Card deleted. */
|
||||
#define IND_TRACE CHAR2('t','r')
|
||||
|
||||
#ifdef DO_BOOT
|
||||
#define IND_BOOT CHAR2('B','T')
|
||||
#endif
|
||||
/*
|
||||
* Arguments. short,long,uchar are encoded decimally, ushort and ulong as
|
||||
* unsigned hex, ident as four letters, strings as-is.
|
||||
*/
|
||||
#define ARG_PREFOUT CHAR2('x','i') /* drop an incoming call */
|
||||
#define ARG_FORCEOUT CHAR2('y','i') /* not implemented yet */
|
||||
#define ARG_PREFOUT CHAR2('x','i') /* drop an incoming call if we're also calling out */
|
||||
#define ARG_FORCEOUT CHAR2('y','i') /* always call back instead of accepting */
|
||||
#define ARG_FORCEIN CHAR2('z','i') /* always expect a callback */
|
||||
#define ARG_BACKCALL CHAR2('b','i') /* call back if incoming call rejected because busy */
|
||||
#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 */
|
||||
|
@ -122,17 +133,28 @@
|
|||
#endif
|
||||
#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_SUBCARD CHAR2 ('c','s') /* D channel on card */
|
||||
#define ARG_CHANNEL CHAR2 ('b','c') /* 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_PBX CHAR2 ('p','b') /* behave like a PBX */
|
||||
#define ARG_EAZ CHAR2 ('e','a') /* map EAZ to local phone nr */
|
||||
#define ARG_LWAIT CHAR2 ('l','w') /* how long to wait for additional digits */
|
||||
#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 */
|
||||
#define ARG_INNUMS CHAR2 ('i','m') /* incoming, for match */
|
||||
#define ARG_BOTHNUMS CHAR2 ('b','m') /* in+out, default */
|
||||
#define ARG_NEEDLOCAL CHAR2('v','l') /* local numer required, incoming */
|
||||
#define ARG_NEEDREMOTE CHAR2('v','r') /* remote numer required, incoming */
|
||||
#define ARG_NEEDNOLOCAL CHAR2('V','l') /* local numer missing; incoming */
|
||||
#define ARG_NEEDNOREMOTE CHAR2('V','r') /* remote numer missing; incoming */
|
||||
#define ARG_SERVICE CHAR2 ('s','v') /* ulong service type. */
|
||||
#define ARG_BEARER CHAR2 ('v','B') /* vector Bearer Capability. */
|
||||
#define ARG_LLC CHAR2 ('v','L') /* vector Lower Level Compat. */
|
||||
|
@ -144,19 +166,50 @@
|
|||
#define ARG_ERRHDR CHAR2 ('e','H') /* reported error type */
|
||||
#define ARG_SPV CHAR2 ('p','v') /* semipermanent */
|
||||
#define ARG_FORCETALK CHAR2 ('F','t') /* force talker */
|
||||
#define ARG_INCOMPLETE CHAR2('i','C') /* Number may be incomplete */
|
||||
#define ARG_SUBPROT CHAR2 ('s','p') /* long Subprotocol to use. For SAPI 0:
|
||||
* "65" for calls according to 1TR6,
|
||||
* "0" for Q.931. */
|
||||
#define ARG_DELAY CHAR2 ('d','l') /* Answer delay */
|
||||
#define ARG_STACK CHAR2 ('s','t') /* uchar Protocol stack to establish,
|
||||
* as defined by L4 config files. */
|
||||
#define ARG_STACK CHAR2 ('s','t') /* uchar Protocol stack */
|
||||
#define ARG_SITE CHAR2 ('s','y') /* uchar site we talk to */
|
||||
#define ARG_FLAGS CHAR2('f','l') /* Flags, with open() */
|
||||
#define ARG_UID CHAR2('u','i') /* uid of whoever opened the device */
|
||||
#define ARG_GID CHAR2('g','i') /* gid of whoever opened the device */
|
||||
#define ARG_CHARGE CHAR2('C','I') /* what's it cost */
|
||||
|
||||
#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 */
|
||||
|
||||
#define ARG_POINTOPOINT CHAR2('p','p') /* point-to-point link */
|
||||
#define ARG_MULTIPOINT1 CHAR2('m','p') /* multipoint link, variable ID */
|
||||
#define ARG_MULTIPOINT2 CHAR2('m','q') /* multipoint link, fixed ID */
|
||||
#define ARG_MULTIPOINT3 CHAR2('m','t') /* multipoint link, fixed TEI */
|
||||
|
||||
#define ARG_ANSWER_IMMED CHAR2('a','i') /* grab the TEI on startup */
|
||||
#define ARG_ANSWER_DELAY CHAR2('a','d') /* grab the TEI when needed */
|
||||
|
||||
#define ARG_TEI_IMMED CHAR2('t','i') /* grab the TEI on startup */
|
||||
#define ARG_TEI_DELAY CHAR2('t','d') /* grab the TEI when needed */
|
||||
|
||||
#define ARG_L2KEEP CHAR2('k','l') /* keep L2 open */
|
||||
#define ARG_L2CLOSE CHAR2('c','l') /* close L2 when no connection is pending */
|
||||
#define ARG_DEBUG CHAR2('d','e')
|
||||
#define ARG_EVENT CHAR2('e','v')
|
||||
#define ARG_SUBEVENT CHAR2('e','s')
|
||||
#define ARG_BUG1 CHAR2('b','1')
|
||||
#define ARG_BUG2 CHAR2('b','2')
|
||||
#define ARG_BUG3 CHAR2('b','3')
|
||||
|
||||
/* Other arguments are protocol dependent. See the appropriate include files. */
|
||||
|
||||
#define LISTARG_CONN CHAR2 ('L','C')
|
||||
#define LISTARG_CARD CHAR2 ('L','K')
|
||||
|
||||
#define ID_NOCARD CHAR2('x','c') /* card doesn't come up */
|
||||
#define ID_NOREPLY CHAR2('n','?') /* network doesn't answer */
|
||||
|
||||
#endif /* _ISDN_34 */
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#define MINOR_MAX 240
|
||||
|
||||
#define MAX_B 2 /* max # of B channels per card */
|
||||
#define MAX_B 31 /* max # of B channels per card */
|
||||
#define MAX_D 3 /* max # D channel data connections, i.e. X25 */
|
||||
#define MAXCHAN (MAX_B+MAX_D)
|
||||
#define NMINOR MINOR_MAX
|
|
@ -6,14 +6,7 @@
|
|||
#include "primitives.h"
|
||||
|
||||
/*
|
||||
* Special codes for protocols. Sent as MSG_PROTO messages to modules,
|
||||
* HDR_PROTOCMD betweel L2/L3, and CMD_PROT / CMD_CARDPROT between L3/L4.
|
||||
*/
|
||||
|
||||
#define PROTO_SYS '*' /* System status */
|
||||
|
||||
/*
|
||||
* System status messages. Example: "*co". Forwarded by all modules. Some of
|
||||
* System status messages. Example: "co". Forwarded by all modules. Some of
|
||||
* these are generated by L2 when attaching / detaching devices.
|
||||
*/
|
||||
|
||||
|
@ -22,10 +15,12 @@
|
|||
#define PROTO_HAS_CONNECTED CHAR2('h','c') /* down */
|
||||
#define PROTO_LISTEN CHAR2('l','i') /* Conn partially established (up) */
|
||||
#define PROTO_HAS_LISTEN CHAR2('h','l') /* down */
|
||||
#define PROTO_SETUP CHAR2('s','e') /* stack establiched (up) */
|
||||
#define PROTO_HAS_SETUP CHAR2('h','s') /* down */
|
||||
|
||||
#define PROTO_INTERRUPT CHAR2('i','s') /* Temporarily gone. (up/down) */
|
||||
#define PROTO_WILL_INTERRUPT CHAR2('w','i') /* Temporarily gone. (up/down) */
|
||||
#define PROTO_INTERRUPT CHAR2('i','i') /* Temporarily gone. (up/down) */
|
||||
#define PROTO_DISCONNECT CHAR2('d','i') /* Gone. (up/down) */
|
||||
#define PROTO_WILL_INTERRUPT CHAR2('w','i')
|
||||
#define PROTO_WILL_DISCONNECT CHAR2('w','d') /* Please shutdown. (up) */
|
||||
#define PROTO_HAS_INTERRUPT CHAR2('h','i')
|
||||
#define PROTO_HAS_DISCONNECT CHAR2('h','d') /* Did shutdown. (down) */
|
||||
|
@ -39,6 +34,10 @@
|
|||
#define PROTO_OUTGOING CHAR2('o','u') /* Outgoing call. */
|
||||
|
||||
#define PROTO_OFFSET CHAR2('o','s') /* do mblk preallocation */
|
||||
#define PROTO_TICK CHAR2('t','k') /* sync the timers */
|
||||
#define PROTO_TELLME CHAR2('t','m') /* send back queue state */
|
||||
#define PROTO_DATA_IN CHAR2('d','I') /* data are flowing in; for external measuerment */
|
||||
#define PROTO_DATA_OUT CHAR2('d','O') /* data are flowing out; for external measuerment */
|
||||
|
||||
#define PROTO_AT CHAR2('a','t') /* Command. "*at ATD9612521". */
|
||||
#define PROTO_MODULE CHAR2('m','s') /* Setup for a protocol */
|
||||
|
@ -84,4 +83,17 @@
|
|||
* taking down the connection.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
** Common per-module arguments.
|
||||
**/
|
||||
|
||||
#define PROTO_TYPE_NONE CHAR2('.','N')
|
||||
#define PROTO_TYPE_ETHER CHAR2('.','E')
|
||||
#define PROTO_TYPE_PPP CHAR2('.','P')
|
||||
/*
|
||||
* Set the encapsulation type. PROTO_TYPE_NONE means either no networking
|
||||
* data, or IP only.
|
||||
*/
|
||||
|
||||
#endif /* _ISDN_PROTO */
|
|
@ -0,0 +1,84 @@
|
|||
#ifndef _INC_KERNEL
|
||||
#define _INC_KERNEL
|
||||
#if defined(linux)
|
||||
#include <linux/config.h>
|
||||
#endif
|
||||
|
||||
#ifndef KERNEL
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/uio.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 */
|
||||
#define KERN_ALERT "1:" /* action must be taken immediately */
|
||||
#define KERN_CRIT "2:" /* critical conditions */
|
||||
#define KERN_ERR "3:" /* error conditions */
|
||||
#define KERN_WARNING "4:" /* warning conditions */
|
||||
#define KERN_NOTICE "5:" /* normal but significant condition */
|
||||
#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))
|
||||
|
||||
#undef HZ
|
||||
#define HZ 10 /* don't need more granularity */
|
||||
|
||||
#else /* KERNEL */
|
||||
#ifndef __KERNEL__
|
||||
#define __KERNEL__
|
||||
#endif
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/param.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/uio.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
|
||||
|
||||
#ifndef minor
|
||||
#define minor(a) ((a)&0xFF)
|
||||
#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,20 @@
|
|||
#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;
|
||||
long *use_count;
|
||||
};
|
||||
|
||||
#define xxappxx(a,b) a##b
|
||||
#define NAME(a,b) xxappxx(a,b) /* isn't C wonderful */
|
||||
#define xxstrxx(a) #a
|
||||
#define STRING(a) xxstrxx(a) /* ditto */
|
||||
|
||||
#endif
|
||||
|
|
@ -20,17 +20,17 @@
|
|||
#if MSG_DATA != MSG_EXDATA
|
||||
|
||||
#if M_DATA != MSG_DATA
|
||||
#define CASE_DATA case M_DATA: case MSG_DATA: case MSG_EXDATA: case M_EXDATA:
|
||||
#define CASE_DATA M_DATA: case MSG_DATA: case MSG_EXDATA: case M_EXDATA
|
||||
#else
|
||||
#define CASE_DATA case MSG_DATA: case MSG_EXDATA: case M_EXDATA:
|
||||
#define CASE_DATA MSG_DATA: case MSG_EXDATA: case M_EXDATA
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#if M_DATA != MSG_DATA
|
||||
#define CASE_DATA case M_DATA: case MSG_DATA: case M_EXDATA:
|
||||
#define CASE_DATA M_DATA: case MSG_DATA: case M_EXDATA
|
||||
#else
|
||||
#define CASE_DATA case M_DATA: case M_EXDATA:
|
||||
#define CASE_DATA M_DATA: case M_EXDATA
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -38,17 +38,17 @@
|
|||
#if MSG_DATA != MSG_EXDATA
|
||||
|
||||
#if M_DATA != MSG_DATA
|
||||
#define CASE_DATA case M_DATA: case MSG_DATA: case MSG_EXDATA:
|
||||
#define CASE_DATA M_DATA: case MSG_DATA: case MSG_EXDATA
|
||||
#else
|
||||
#define CASE_DATA case MSG_DATA: case MSG_EXDATA:
|
||||
#define CASE_DATA MSG_DATA: case MSG_EXDATA
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#if M_DATA != MSG_DATA
|
||||
#define CASE_DATA case M_DATA: case MSG_DATA:
|
||||
#define CASE_DATA M_DATA: case MSG_DATA
|
||||
#else
|
||||
#define CASE_DATA case M_DATA:
|
||||
#define CASE_DATA M_DATA
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef __POSTL3_H
|
||||
#define __POSTL3_H
|
||||
|
||||
#include "compat.h"
|
||||
#include "primitives.h"
|
||||
#include <isdn_34.h>
|
||||
|
||||
/* CallRef */
|
||||
|
@ -128,14 +130,14 @@
|
|||
#define ID_N6_serviceInd CHAR2('s','I')
|
||||
#define PT_N6_chargingInfo 0x02
|
||||
#define ID_N6_chargingInfo CHAR2('C','I')
|
||||
#define PT_N6_Date 0x03
|
||||
#define ID_N6_Date CHAR2('D','a')
|
||||
#define PT_N6_FacSelect 0x05
|
||||
#define ID_N6_FacSelect CHAR2('F','S')
|
||||
#define PT_N6_FacStatus 0x06
|
||||
#define ID_N6_FacStatus CHAR2('F','s')
|
||||
#define PT_N6_StatusCalled 0x07
|
||||
#define ID_N6_StatusCalled CHAR2('S','C')
|
||||
#define PT_N6_date 0x03
|
||||
#define ID_N6_date CHAR2('D','a')
|
||||
#define PT_N6_facSelect 0x05
|
||||
#define ID_N6_facSelect CHAR2('F','S')
|
||||
#define PT_N6_facStatus 0x06
|
||||
#define ID_N6_facStatus CHAR2('F','s')
|
||||
#define PT_N6_statusCalled 0x07
|
||||
#define ID_N6_statusCalled CHAR2('S','C')
|
||||
#define PT_N6_addTransAttr 0x08
|
||||
#define ID_N6_addTransAttr CHAR2('t','A')
|
||||
|
||||
|
@ -249,4 +251,13 @@
|
|||
#define N1_St_Calling 02
|
||||
#define ID_N1_St_Calling CHAR2('r','i')
|
||||
|
||||
|
||||
ushort_t n1_causetoid(uchar_t id);
|
||||
uchar_t n1_idtocause(ushort_t id);
|
||||
|
||||
ushort_t n1_facsubtoid(uchar_t id);
|
||||
ushort_t n1_factoid(uchar_t id);
|
||||
uchar_t n1_idtofacsub(ushort_t id);
|
||||
uchar_t n1_idtofac(ushort_t id);
|
||||
|
||||
#endif /* __POSTL3_H */
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef __ETSI_H
|
||||
#define __ETSI_H
|
||||
|
||||
#include "compat.h"
|
||||
#include "primitives.h"
|
||||
#include <isdn_34.h>
|
||||
|
||||
/* CallRef */
|
||||
|
@ -287,4 +289,7 @@
|
|||
#define ID_N1_St_Calling CHAR2('r','i')
|
||||
#endif
|
||||
|
||||
uchar_t et_idtocause(ushort_t id);
|
||||
ushort_t et_causetoid(uchar_t id);
|
||||
|
||||
#endif /* __ETSI_H */
|
|
@ -1,8 +1,7 @@
|
|||
#ifndef _PORT_M
|
||||
#define _PORT_M
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include "kernel.h"
|
||||
#include "isdn_limits.h"
|
||||
#include "smallq.h"
|
||||
#include "msgtype.h"
|
|
@ -16,7 +16,7 @@
|
|||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: ppp.h,v 1.3 1993/11/10 01:34:27 paulus Exp $
|
||||
* $Id: ppp.h,v 1.1.1.2 1996/07/29 08:45:23 smurf Exp $
|
||||
*/
|
||||
|
||||
#ifndef __PPP_H__
|
||||
|
@ -52,6 +52,7 @@
|
|||
#define DLLHEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short))
|
||||
#define MTU 1500 /* Default MTU */
|
||||
|
||||
|
||||
/*
|
||||
* Important FCS values.
|
||||
*/
|
|
@ -1,24 +1,24 @@
|
|||
#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 "compat.h"
|
||||
#include "config.h"
|
||||
#include "kernel.h"
|
||||
|
||||
#include "msgtype.h"
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/types.h>
|
||||
#include <linux/param.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#ifdef linux
|
||||
#include <linux/major.h>
|
||||
#ifdef KERNEL
|
||||
#include <linux/syscompat.h>
|
||||
#include <linux/kernel.h>
|
||||
#include "compat.h"
|
||||
#else
|
||||
#include "kernel.h"
|
||||
#include <stdio.h> /* printf */
|
||||
#include <unistd.h>
|
||||
#include <stddef.h>
|
||||
|
@ -95,14 +95,19 @@
|
|||
#define M_FREE 0
|
||||
#define M_OFF M_FREE
|
||||
#define M_STANDBY 1
|
||||
#define M_TRANSPARENT 2 /* no idle */
|
||||
#define M_TRANS_ALAW 3 /* a-law idle */
|
||||
#define M_TRANS_V110 4 /* V.110 idle */
|
||||
#define M_TRANS_HDLC 5 /* HDLC flags */
|
||||
#define M_HDLC 10
|
||||
#define M_HDLC_7L 11 /* skip bit 8 */
|
||||
#define M_HDLC_7H 12 /* skip bit 0 */
|
||||
#define M_HDLC_N0 13 /* insert one after seven zeroes */
|
||||
#define M_HDLC_16 14 /* insert one after seven zeroes */
|
||||
#define M_ON 2
|
||||
|
||||
/* These flags share a common space. PROT_* is for the isdn_2 interaction
|
||||
with the module list, PUSH_* is also for picking which modules to kick. */
|
||||
#define PROT_FROMSTACK 01 /* travels from the channel to the master */
|
||||
#define PROT_MODLIST 02 /* module list */
|
||||
#define PROT_TOCARD 04 /* internal to isdn_2.c: send to card first, if there's a handler */
|
||||
#define PUSH_UPDATE 010 /* Do not unload the old stack */
|
||||
#define PUSH_BEFORE 020 /* Only unload the modules before reconn */
|
||||
#define PUSH_AFTER 040 /* only do the modules after reconn */
|
||||
|
||||
/* Card modes */
|
||||
|
||||
#define CHM_INTELLIGENT 01 /* If this bit is set, the card is clever and modes>>1 has the ID of the high-level driver. */
|
||||
|
||||
#endif /* _PRIM_H */
|
|
@ -1,8 +1,7 @@
|
|||
#ifndef _Q_DATA
|
||||
#define _Q_DATA
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include "kernel.h"
|
||||
|
||||
/**
|
||||
** This module handles the data structure of additional information elements,
|
|
@ -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
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __SMALLQ__
|
||||
#define __SMALLQ__
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "kernel.h"
|
||||
#include "streams.h"
|
||||
#include "config.h"
|
||||
|
|
@ -13,12 +13,9 @@
|
|||
* key-parameter-argument list for a nested command.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include "kernel.h"
|
||||
#include "f_signal.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include <sys/stropts.h>
|
||||
#include "stropts.h"
|
||||
|
||||
#include "streams.h"
|
||||
#include "config.h"
|
||||
|
@ -33,6 +30,7 @@ short spl(short);
|
|||
* resource shortage.
|
||||
*/
|
||||
void putbqf (queue_t * q, mblk_t * mp);
|
||||
void putbqff(queue_t * q, mblk_t * mp);
|
||||
|
||||
/*
|
||||
* dsize()
|
||||
|
@ -78,16 +76,18 @@ 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))
|
||||
#define putbqff(q,m) deb_putbqff(__FILE__,__LINE__,(q),(m))
|
||||
void deb_putbqf (const char *deb_file, unsigned int deb_line, queue_t * q, mblk_t *mb);
|
||||
void deb_putbqff(const char *deb_file, unsigned int deb_line, queue_t * q, mblk_t *mb);
|
||||
|
||||
#endif /* CONFIG_DEBUG_STREAMS */
|
||||
|
||||
|
@ -107,23 +107,29 @@ void m_putx (mblk_t * mb, ulong_t id);
|
|||
void m_puthex (mblk_t *mb, uchar_t *data, int len);
|
||||
void m_getskip (mblk_t * mb);
|
||||
int m_getid (mblk_t * mb, ushort_t * id);
|
||||
int m_getip (mblk_t * mb, ulong_t * id);
|
||||
int m_getsx (mblk_t * mb, ushort_t * id);
|
||||
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 */
|
|
@ -1,16 +1,15 @@
|
|||
#ifndef __STREAMS_H
|
||||
#define __STREAMS_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
#include "kernel.h"
|
||||
|
||||
#if !(defined(__sys_stream_h) || defined(_SYS_STREAM_H) || defined(_LINUX_STREAM_H))
|
||||
|
||||
#ifdef KERNEL
|
||||
#include <sys/stream.h>
|
||||
#include "stream.h"
|
||||
#else
|
||||
#ifdef linux
|
||||
#include <sys/stream.h>
|
||||
#include "stream.h"
|
||||
#else
|
||||
#include <sys/aux-stream.h>
|
||||
#endif /* KERNEL */
|
||||
|
@ -90,9 +89,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 */
|
|
@ -4,7 +4,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/syscompat.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/stropts.h>
|
||||
#include "stropts.h"
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#define MAX_STRDEV MAX_CHRDEV /* don't change */
|
|
@ -1,7 +1,9 @@
|
|||
#if !defined(__sys_callout_h)
|
||||
#define __sys_callout_h
|
||||
|
||||
#ifndef __KERNEL__
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
struct callout {
|
||||
int c_time; /* incremental time */
|
|
@ -1,9 +1,7 @@
|
|||
#ifndef __TIMEOUT
|
||||
#define __TIMEOUT
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/callout.h>
|
||||
#include "kernel.h"
|
||||
|
||||
extern struct timeval callout_time;
|
||||
|
|
@ -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,4 +1,4 @@
|
|||
#include <sys/stream.h>
|
||||
#include "stream.h"
|
||||
/*
|
||||
* Compare two feature vectors, mask off certain bits.
|
||||
* Return..:
|
|
@ -22,8 +22,6 @@
|
|||
#define X75_CONCAT CHAR2('c','d')
|
||||
#define X75_CONNMODE CHAR2('c','m')
|
||||
#define X75_DEBUG CHAR2('d','e')
|
||||
#define X75_SENDINTR CHAR2('i','I')
|
||||
#define X75_SENDDISC CHAR2('i','D')
|
||||
|
||||
/* When to establish the connection. Zero means to assume established. */
|
||||
#define X75CONN_OUT 01 /* Establish when dialling out */
|
|
@ -0,0 +1,6 @@
|
|||
KERNEL=1
|
||||
SUBDIRS=tools
|
||||
|
||||
TOPDIR=..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
|
@ -6,26 +6,23 @@
|
|||
#include "f_module.h"
|
||||
#include "primitives.h"
|
||||
#include "f_ip.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include "kernel.h"
|
||||
#include "f_signal.h"
|
||||
#include "f_malloc.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include "streams.h"
|
||||
#include <sys/stropts.h>
|
||||
#include "stropts.h"
|
||||
#ifdef DONT_ADDERROR
|
||||
#include "f_user.h"
|
||||
#endif
|
||||
#include <sys/errno.h>
|
||||
#include "ip_mon.h"
|
||||
#include "streamlib.h"
|
||||
#include "isdn_proto.h"
|
||||
#include "vanj.h"
|
||||
#include "ppp.h"
|
||||
|
||||
static struct module_info ip_mon_minfo =
|
||||
{
|
||||
0, "ip_mon", 0, INFPSZ, 4096,1024
|
||||
0, "ip_mon", 0, INFPSZ, 200,100
|
||||
};
|
||||
|
||||
static qf_open ip_mon_open;
|
||||
|
@ -48,8 +45,7 @@ struct streamtab ip_moninfo =
|
|||
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;
|
||||
|
@ -58,8 +54,13 @@ struct _ip_mon {
|
|||
int timeout;
|
||||
#endif
|
||||
short nr;
|
||||
char hastimer;
|
||||
} ip_mon;
|
||||
unsigned hastimer:1;
|
||||
unsigned encap:2;
|
||||
#define ENCAP_NONE 0
|
||||
#define ENCAP_ETHER 1
|
||||
#define ENCAP_PPP 2
|
||||
unsigned each:2;
|
||||
} ip_mon = {NULL};
|
||||
|
||||
static mblk_t *ip_info[NIP_INFO];
|
||||
|
||||
|
@ -67,7 +68,7 @@ static int last_index = -1;
|
|||
static int nexti = 0;
|
||||
|
||||
static int
|
||||
ip_mon_index (unsigned long local, unsigned long remote, int protocol, int *dosend, ushort_t localp, ushort_t remotep)
|
||||
ip_mon_index (unsigned long local, unsigned long remote, int protocol, int *dosend, ushort_t localp, ushort_t remotep, char dir)
|
||||
{
|
||||
mblk_t *mb;
|
||||
int i;
|
||||
|
@ -75,10 +76,11 @@ ip_mon_index (unsigned long local, unsigned long remote, int protocol, int *dose
|
|||
#define CMP(_m) ( \
|
||||
(_m)->local == local && \
|
||||
(_m)->remote == remote && \
|
||||
(_m)->dir == dir && \
|
||||
(protocol == 0 || _m->p_protocol == 0 || \
|
||||
(_m->p_protocol == protocol && \
|
||||
(_m->p_local == localp || _m->p_local == 0 || localp == 0) && \
|
||||
(_m->p_remote == remotep || _m->p_remote == 0 || remotep == 0)) \
|
||||
((_m)->p_protocol == protocol && \
|
||||
((_m)->p_local == localp || (_m)->p_local == 0 || localp == 0) && \
|
||||
((_m)->p_remote== remotep || (_m)->p_remote== 0 || remotep== 0)) \
|
||||
) \
|
||||
)
|
||||
if (last_index >= 0) {
|
||||
|
@ -109,11 +111,10 @@ ip_mon_index (unsigned long local, unsigned long remote, int protocol, int *dose
|
|||
mon->p_protocol = protocol;
|
||||
mon->p_local = localp;
|
||||
mon->p_remote = remotep;
|
||||
mon->cap_b = ~0;
|
||||
mon->cap_p = ~0;
|
||||
mon->dir = dir;
|
||||
if (ip_info[i = last_index = nexti] != NULL) {
|
||||
struct _monitor *m2 = (struct _monitor *)(ip_info[i]->b_rptr);
|
||||
if ((m2->sofar_b != 0 || m2->sofar_p != 0) && ip_mon.qptr != NULL && canput (ip_mon.qptr->q_next))
|
||||
if ((m2->bytes != 0 || m2->packets != 0) && ip_mon.qptr != NULL && canput (ip_mon.qptr->q_next))
|
||||
putnext (ip_mon.qptr, ip_info[i]);
|
||||
else
|
||||
freemsg (ip_info[i]);
|
||||
|
@ -137,7 +138,7 @@ ip_mon_sendup (int i)
|
|||
if (ip_mon.qptr == NULL || !canput (ip_mon.qptr->q_next) || (mb = ip_info[i]) == NULL)
|
||||
return;
|
||||
m2 = (struct _monitor *)(mb->b_rptr);
|
||||
if (m2->sofar_b == 0 && m2->sofar_p == 0)
|
||||
if (m2->bytes == 0 && m2->packets == 0)
|
||||
return;
|
||||
|
||||
mb2 = copyb (mb);
|
||||
|
@ -145,8 +146,10 @@ ip_mon_sendup (int i)
|
|||
struct _monitor *m = (struct _monitor *) mb->b_rptr;
|
||||
|
||||
putnext (ip_mon.qptr, mb2);
|
||||
m->sofar_b = 0;
|
||||
m->sofar_p = 0;
|
||||
m->bytes = 0;
|
||||
m->packets = 0;
|
||||
m->t_first = 0;
|
||||
m->t_last = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,6 +159,7 @@ ip_mon_proto (queue_t * q, mblk_t * mp, char senddown)
|
|||
register struct _ip_mon *ipmon = (struct _ip_mon *) q->q_ptr;
|
||||
char *origmp = mp->b_rptr;
|
||||
ushort_t id;
|
||||
int error = 0;
|
||||
|
||||
if (m_getid (mp, &id) != 0) {
|
||||
mp->b_rptr = origmp;
|
||||
|
@ -180,22 +184,34 @@ ip_mon_proto (queue_t * q, mblk_t * mp, char senddown)
|
|||
goto err;
|
||||
#endif
|
||||
while (mp != NULL && m_getsx (mp, &id) == 0) {
|
||||
int err = EINVAL;
|
||||
|
||||
switch (id) {
|
||||
err:
|
||||
mp->b_rptr = origmp;
|
||||
m_reply(q,mp,EINVAL);
|
||||
mp = NULL;
|
||||
default:
|
||||
goto err;
|
||||
case PROTO_MODULE:
|
||||
break;
|
||||
case PROTO_TYPE_NONE:
|
||||
ipmon->encap = ENCAP_NONE;
|
||||
break;
|
||||
case PROTO_TYPE_PPP:
|
||||
ipmon->encap = ENCAP_PPP;
|
||||
break;
|
||||
case PROTO_TYPE_ETHER:
|
||||
ipmon->encap = ENCAP_ETHER;
|
||||
break;
|
||||
case IP_MON_EACHPACKET:
|
||||
ipmon->each = 2;
|
||||
break;
|
||||
case IP_MON_FIRSTPACKET:
|
||||
ipmon->each = 1;
|
||||
break;
|
||||
case IP_MON_SUMMARY:
|
||||
ipmon->each = 0;
|
||||
break;
|
||||
case IP_MON_TIMEOUT:
|
||||
if (m_geti (mp, &x) != 0)
|
||||
if ((error = m_geti (mp, &x)) != 0)
|
||||
goto err;
|
||||
if (x < 2 || x > 99999) {
|
||||
err = EINVAL;
|
||||
if (x < 2 || x > 99999)
|
||||
goto err;
|
||||
}
|
||||
ipmon->timer = x;
|
||||
break;
|
||||
}
|
||||
|
@ -212,6 +228,10 @@ ip_mon_proto (queue_t * q, mblk_t * mp, char senddown)
|
|||
mp->b_rptr = origmp;
|
||||
putnext (q, mp);
|
||||
}
|
||||
return;
|
||||
err:
|
||||
mp->b_rptr = origmp;
|
||||
m_reply (q, mp, error ? error : -EINVAL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -220,10 +240,14 @@ ip_mon_timer (struct _ip_mon *ipmon)
|
|||
{
|
||||
long s;
|
||||
|
||||
if (ipmon->timer == 0)
|
||||
if (!ipmon->hastimer)
|
||||
return;
|
||||
if (ip_mon.qptr == NULL) {
|
||||
ipmon->timer = 0;
|
||||
ipmon->hastimer = 0;
|
||||
return;
|
||||
}
|
||||
if (!ipmon->timer) {
|
||||
ipmon->hastimer = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -240,35 +264,24 @@ ip_mon_timer (struct _ip_mon *ipmon)
|
|||
}
|
||||
|
||||
static int
|
||||
ip_mon_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
|
||||
)
|
||||
ip_mon_open (queue_t * q, dev_t dev, int flag, int sflag ERR_DECL)
|
||||
{
|
||||
struct _ip_mon *ipmon;
|
||||
static int nr = 1;
|
||||
int do_timeout = 1;
|
||||
|
||||
dev = minor (dev);
|
||||
if (sflag == MODOPEN) {
|
||||
ipmon = malloc(sizeof(*ipmon));
|
||||
if(ipmon == NULL)
|
||||
return OPENFAIL;
|
||||
ERR_RETURN(-ENOMEM);
|
||||
} else if (ip_mon.qptr != NULL) {
|
||||
printf ("IP_MON: Master already open\n");
|
||||
U_ERROR = EBUSY;
|
||||
return OPENFAIL;
|
||||
ERR_RETURN(-EBUSY);
|
||||
} else if (dev != 0 || sflag == CLONEOPEN) {
|
||||
printf ("IP_MON: Bad minor number: dev %d, sflag %d\n", dev, sflag);
|
||||
U_ERROR = ENXIO;
|
||||
return OPENFAIL;
|
||||
ERR_RETURN(-ENXIO);
|
||||
} else {
|
||||
ipmon = &ip_mon;
|
||||
do_timeout = (ip_mon.qptr == NULL);
|
||||
}
|
||||
memset(ipmon,0,sizeof (*ipmon));
|
||||
if (ipmon != &ip_mon)
|
||||
|
@ -277,8 +290,9 @@ ip_mon_open (queue_t * q, dev_t dev, int flag, int sflag
|
|||
q->q_ptr = (char *) ipmon;
|
||||
ipmon->qptr = q;
|
||||
|
||||
ipmon->timer = 10;
|
||||
if(do_timeout) {
|
||||
ipmon->timer = dev ? 10 : 0;
|
||||
ipmon->each = 1;
|
||||
if(ipmon->timer) {
|
||||
ipmon->hastimer = 1;
|
||||
#ifdef NEW_TIMEOUT
|
||||
ipmon->timeout =
|
||||
|
@ -295,9 +309,9 @@ ip_mon_open (queue_t * q, dev_t dev, int flag, int sflag
|
|||
static void
|
||||
ip_mon_wput (queue_t * q, mblk_t * mp)
|
||||
{
|
||||
switch (mp->b_datap->db_type) {
|
||||
switch (DATA_TYPE(mp)) {
|
||||
case MSG_PROTO:
|
||||
CASE_DATA
|
||||
case CASE_DATA:
|
||||
putq (q, mp);
|
||||
break;
|
||||
case M_FLUSH:
|
||||
|
@ -312,7 +326,7 @@ ip_mon_wput (queue_t * q, mblk_t * mp)
|
|||
return;
|
||||
}
|
||||
|
||||
static mblk_t *count_packet (mblk_t *mp, char doswap)
|
||||
static mblk_t *count_packet (struct _ip_mon *ipmon, mblk_t *mp, char doswap)
|
||||
{
|
||||
mblk_t *mq;
|
||||
struct ip *ipp;
|
||||
|
@ -326,26 +340,38 @@ static mblk_t *count_packet (mblk_t *mp, char doswap)
|
|||
freemsg(mp);
|
||||
return NULL;
|
||||
}
|
||||
mq = pullupm (mp, sizeof (struct ip)); /* IP header */
|
||||
if(ipmon->encap) {
|
||||
short encap;
|
||||
mq = pullupm (mp, 2); /* encap header */
|
||||
|
||||
if (mq == NULL)
|
||||
return mp;
|
||||
encap = *(short *)(mq->b_rptr);
|
||||
if((ipmon->encap == ENCAP_PPP && encap != htons(PPP_IP)) ||
|
||||
(ipmon->encap == ENCAP_ETHER && encap != htons(ETH_P_IP)))
|
||||
return mq;
|
||||
mp = mq;
|
||||
}
|
||||
mq = pullupm (mp, sizeof (struct ip) + 2); /* IP header */
|
||||
|
||||
if (mq == NULL) {
|
||||
return mp; /* oh well -- don't count it */
|
||||
}
|
||||
ms = splstr();
|
||||
ipp = (struct ip *) mq->b_rptr;
|
||||
ipp = (struct ip *) (mq->b_rptr+(ipmon->encap ? 2 : 0));
|
||||
|
||||
switch (ipp->ip_p) {
|
||||
default:
|
||||
localp = remotep = 0;
|
||||
break;
|
||||
case IPPROTO_TCP:
|
||||
mp = pullupm (mq, (ipp->ip_hl << 2) + sizeof (struct tcphdr));
|
||||
mp = pullupm (mq, (ipp->ip_hl << 2) + sizeof (struct tcphdr)+2);
|
||||
|
||||
if (mp != NULL) {
|
||||
struct tcphdr *tcp;
|
||||
|
||||
mq = mp;
|
||||
ipp = (struct ip *) mq->b_rptr;
|
||||
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;
|
||||
|
@ -353,13 +379,13 @@ static mblk_t *count_packet (mblk_t *mp, char doswap)
|
|||
return mq;
|
||||
break;
|
||||
case IPPROTO_UDP:
|
||||
mp = pullupm (mq, (ipp->ip_hl << 2) + sizeof (struct udphdr));
|
||||
mp = pullupm (mq, (ipp->ip_hl << 2) + sizeof (struct udphdr)+2);
|
||||
|
||||
if (mp != NULL) {
|
||||
struct udphdr *udp;
|
||||
|
||||
mq = mp;
|
||||
ipp = (struct ip *) mq->b_rptr;
|
||||
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;
|
||||
|
@ -367,12 +393,12 @@ static mblk_t *count_packet (mblk_t *mp, char doswap)
|
|||
return mq;
|
||||
break;
|
||||
case IPPROTO_ICMP:
|
||||
mp = pullupm (mq, (ipp->ip_hl << 2) + sizeof (struct icmp));
|
||||
mp = pullupm (mq, (ipp->ip_hl << 2) + sizeof (struct icmp) + 2);
|
||||
if(mp != NULL) {
|
||||
struct icmp *icm;
|
||||
|
||||
mq = mp;
|
||||
ipp = (struct ip *) mq->b_rptr;
|
||||
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);
|
||||
|
@ -387,24 +413,21 @@ static mblk_t *count_packet (mblk_t *mp, char doswap)
|
|||
}
|
||||
|
||||
if(doswap)
|
||||
i = ip_mon_index (ADR(ipp->ip_dst), ADR(ipp->ip_src), ipp->ip_p, &send,remotep,localp);
|
||||
i = ip_mon_index (ADR(ipp->ip_dst), ADR(ipp->ip_src), ipp->ip_p, &send,remotep,localp,doswap);
|
||||
else
|
||||
i = ip_mon_index (ADR(ipp->ip_src), ADR(ipp->ip_dst), ipp->ip_p, &send,localp,remotep);
|
||||
i = ip_mon_index (ADR(ipp->ip_src), ADR(ipp->ip_dst), ipp->ip_p, &send,localp,remotep,doswap);
|
||||
if (i < 0) {
|
||||
splx (ms);
|
||||
return mq;
|
||||
}
|
||||
mon = (struct _monitor *) ip_info[i]->b_rptr;
|
||||
mon->sofar_b += dsize (mq);
|
||||
mon->sofar_p++;
|
||||
if (mon->sofar_b > mon->cap_b || mon->sofar_p > mon->cap_p) {
|
||||
splx (ms);
|
||||
printf ("Drop packet %lx %lx\n", ntohl(ADR(ipp->ip_src)), ntohl(ADR(ipp->ip_dst)));
|
||||
freemsg (mq);
|
||||
return NULL;
|
||||
}
|
||||
mon->bytes += dsize (mq);
|
||||
mon->packets++;
|
||||
if(mon->t_first == 0)
|
||||
mon->t_first = jiffies;
|
||||
mon->t_last = jiffies;
|
||||
splx (ms);
|
||||
if (send)
|
||||
if ((send && ipmon->each) || (ipmon->each > 1))
|
||||
ip_mon_sendup (i);
|
||||
return mq;
|
||||
}
|
||||
|
@ -413,49 +436,30 @@ static void
|
|||
ip_mon_wsrv (queue_t * q)
|
||||
{
|
||||
mblk_t *mp;
|
||||
struct _ip_mon *ipmon = (struct _ip_mon *) q->q_ptr;
|
||||
|
||||
if (q == ip_mon.qptr) {
|
||||
while ((mp = getq (q)) != NULL) {
|
||||
struct _monitor *mon;
|
||||
int i;
|
||||
int ms = splstr ();
|
||||
|
||||
if (mp->b_rptr - mp->b_wptr != sizeof (struct _monitor)
|
||||
|| mp->b_cont != NULL) {
|
||||
freemsg (mp);
|
||||
putctlx1 (RD (q), M_ERROR, EIO);
|
||||
flushq (q, FLUSHDATA);
|
||||
splx (ms);
|
||||
return;
|
||||
}
|
||||
mon = (struct _monitor *) mp->b_rptr;
|
||||
i = ip_mon_index (mon->local, mon->remote, mon->p_protocol, NULL,mon->p_local,mon->p_remote);
|
||||
if (i < 0)
|
||||
freemsg (mp);
|
||||
else {
|
||||
if (ip_info[i] != NULL)
|
||||
qreply (q, ip_info[i]);
|
||||
ip_info[i] = mp;
|
||||
}
|
||||
splx (ms);
|
||||
}
|
||||
while ((mp = getq (q)) != NULL)
|
||||
freemsg(mp);
|
||||
} else {
|
||||
while ((mp = getq (q)) != NULL) {
|
||||
switch (mp->b_datap->db_type) {
|
||||
switch (DATA_TYPE(mp)) {
|
||||
case MSG_PROTO:
|
||||
ip_mon_proto (q, mp, 1);
|
||||
break;
|
||||
CASE_DATA {
|
||||
case CASE_DATA:
|
||||
{
|
||||
mblk_t *mq;
|
||||
|
||||
if(!canput(q->q_next)) {
|
||||
putbq(q,mp);
|
||||
return;
|
||||
}
|
||||
mq = count_packet(mp,0);
|
||||
mq = count_packet(ipmon, mp,0);
|
||||
if(mq != NULL)
|
||||
putnext (q, mq);
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case M_FLUSH:
|
||||
if (*mp->b_rptr & FLUSHW)
|
||||
flushq (q, FLUSHDATA);
|
||||
|
@ -479,6 +483,7 @@ ip_mon_close (queue_t * q, int dummy)
|
|||
flushq (WR (q), FLUSHALL);
|
||||
printf ("IP_MON driver %d closed.\n", ipmon->nr);
|
||||
if (ipmon->hastimer) {
|
||||
ipmon->hastimer = 0;
|
||||
#ifdef NEW_TIMEOUT
|
||||
untimeout (ipmon->timeout);
|
||||
#else
|
||||
|
@ -498,7 +503,7 @@ ip_mon_close (queue_t * q, int dummy)
|
|||
static void
|
||||
ip_mon_rput (queue_t * q, mblk_t * mp)
|
||||
{
|
||||
switch (mp->b_datap->db_type) {
|
||||
switch (DATA_TYPE(mp)) {
|
||||
|
||||
case M_FLUSH:
|
||||
if (*mp->b_rptr & FLUSHR) {
|
||||
|
@ -508,7 +513,7 @@ ip_mon_rput (queue_t * q, mblk_t * mp)
|
|||
break;
|
||||
|
||||
case MSG_PROTO:
|
||||
CASE_DATA
|
||||
case CASE_DATA:
|
||||
putq (q, mp); /* queue it for my service routine */
|
||||
break;
|
||||
|
||||
|
@ -526,23 +531,26 @@ static void
|
|||
ip_mon_rsrv (queue_t * q)
|
||||
{
|
||||
mblk_t *mp;
|
||||
struct _ip_mon *ipmon = (struct _ip_mon *) q->q_ptr;
|
||||
|
||||
while ((mp = getq (q)) != NULL) {
|
||||
switch (mp->b_datap->db_type) {
|
||||
switch (DATA_TYPE(mp)) {
|
||||
case MSG_PROTO:
|
||||
ip_mon_proto (q, mp, 0);
|
||||
break;
|
||||
CASE_DATA {
|
||||
mblk_t *mq;
|
||||
case CASE_DATA:
|
||||
{
|
||||
mblk_t *mq;
|
||||
|
||||
if(!canput(q->q_next)) {
|
||||
putbq(q,mp);
|
||||
return;
|
||||
if(!canput(q->q_next)) {
|
||||
putbq(q,mp);
|
||||
return;
|
||||
}
|
||||
mq = count_packet(ipmon, mp,1);
|
||||
if(mq != NULL)
|
||||
putnext (q, mq);
|
||||
}
|
||||
mq = count_packet(mp,1);
|
||||
if(mq != NULL)
|
||||
putnext (q, mq);
|
||||
} break;
|
||||
break;
|
||||
default:
|
||||
putnext (q, mp);
|
||||
continue;
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef __IP_MON
|
||||
#define __IP_MON
|
||||
|
||||
#include "primitives.h"
|
||||
#include "f_ip.h"
|
||||
|
||||
#define IP_MON_TIMEOUT CHAR2('t','o')
|
||||
#define IP_MON_EACHPACKET CHAR2('p','a')
|
||||
#define IP_MON_FIRSTPACKET CHAR2('p','f')
|
||||
#define IP_MON_SUMMARY CHAR2('p','s')
|
||||
|
||||
#define IP_MON_NAME "/dev/ip_mon"
|
||||
|
||||
typedef struct _monitor {
|
||||
unsigned long t_first; /* kernel jiffies -- Timestamp of first packet */
|
||||
unsigned long t_last; /* kernel jiffies -- Timestamp of last packet */
|
||||
unsigned long local; /* Address of "upstream" site */
|
||||
unsigned long remote; /* Address of "downstream" site */
|
||||
ulong_t bytes; /* Byte count */
|
||||
ushort_t packets; /* Packet count */
|
||||
ushort_t p_local; /* local port, or ICMP type */
|
||||
ushort_t p_remote; /* remote port, or ICMP code */
|
||||
uchar_t p_protocol; /* TCP/UDP/ICMP/??? */
|
||||
char dir; /* incoming packet? */
|
||||
} monitor;
|
||||
|
||||
#endif /* __IP_MON */
|
|
@ -0,0 +1,6 @@
|
|||
PROGRAMS = monitor
|
||||
EXTRA_INCLUDES=-I..
|
||||
|
||||
TOPDIR=../..
|
||||
include $(TOPDIR)/Make.rules
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue