1
0
Fork 0

isdn: remove isdn4linux

With all isdn4linux hardware drivers gone, this is only a wrapper around
CAPI to support old user space. However, from looking at the mailing
list, it seems that the last time anyone asked about it was in 2014,
when the upgrade from a linux-2.4 installation failed, and mISDN was
suggested as a replacement.

The largest public ISDN network (Deutsche Telekom) was supposed to be
shut down 2018, which must have drastically reduced the number of legacy
installations.

When we last discussed removing i4l in 2016, Karsten Keil suggested
revisiting this in 2018. I guess this is overdue.

Link: http://listserv.isdn4linux.de/pipermail/isdn4linux/2014-October/006165.html
Link: https://patchwork.kernel.org/patch/8484861/#17900371
Link: https://listserv.isdn4linux.de/pipermail/isdn4linux/2019-April/thread.html
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
alistair/sunxi64-5.4-dsi
Arnd Bergmann 2019-04-18 22:43:36 +02:00
parent 85993b8c97
commit 9c3c0c2048
59 changed files with 2 additions and 26860 deletions

View File

@ -1,759 +0,0 @@
$Id: INTERFACE,v 1.15.8.2 2001/03/13 16:17:07 kai Exp $
Description of the Interface between Linklevel and Hardwarelevel
of isdn4linux:
The Communication between Linklevel (LL) and Hardwarelevel (HL)
is based on the struct isdn_if (defined in isdnif.h).
An HL-driver can register itself at LL by calling the function
register_isdn() with a pointer to that struct. Prior to that, it has
to preset some of the fields of isdn_if. The LL sets the rest of
the fields. All further communication is done via callbacks using
the function-pointers defined in isdn_if.
Changes/Version numbering:
During development of the ISDN subsystem, several changes have been
made to the interface. Before it went into kernel, the package
had a unique version number. The last version, distributed separately
was 0.7.4. When the subsystem went into kernel, every functional unit
got a separate version number. These numbers are shown at initialization,
separated by slashes:
c.c/t.t/n.n/p.p/a.a/v.v
where
c.c is the revision of the common code.
t.t is the revision of the tty related code.
n.n is the revision of the network related code.
p.p is the revision of the ppp related code.
a.a is the revision of the audio related code.
v.v is the revision of the V.110 related code.
Changes in this document are marked with '***CHANGEx' where x representing
the version number. If that number starts with 0, it refers to the old,
separately distributed package. If it starts with one of the letters
above, it refers to the revision of the corresponding module.
***CHANGEIx refers to the revision number of the isdnif.h
1. Description of the fields of isdn_if:
int channels;
This field has to be set by the HL-driver to the number of channels
supported prior to calling register_isdn(). Upon return of the call,
the LL puts an id there, which has to be used by the HL-driver when
invoking the other callbacks.
int maxbufsize;
***CHANGE0.6: New since this version.
Also to be preset by the HL-driver. With this value the HL-driver
tells the LL the maximum size of a data-packet it will accept.
unsigned long features;
To be preset by the HL-driver. Using this field, the HL-driver
announces the features supported. At the moment this is limited to
report the supported layer2 and layer3-protocols. For setting this
field the constants ISDN_FEATURE..., declared in isdnif.h have to be
used.
***CHANGE0.7.1: The line type (1TR6, EDSS1) has to be set.
unsigned short hl_hdrlen;
***CHANGE0.7.4: New field.
To be preset by the HL-driver, if it supports sk_buff's. The driver
should put here the amount of additional space needed in sk_buff's for
its internal purposes. Drivers not supporting sk_buff's should
initialize this field to 0.
void (*rcvcallb_skb)(int, int, struct sk_buff *)
***CHANGE0.7.4: New field.
This field will be set by LL. The HL-driver delivers received data-
packets by calling this function. Upon calling, the HL-driver must
already have its private data pulled off the head of the sk_buff.
Parameter:
int driver-Id
int Channel-number locally to the driver. (starting with 0)
struct sk_buff * Pointer to sk_buff, containing received data.
int (*statcallb)(isdn_ctrl*);
This field will be set by LL. This function has to be called by the
HL-driver for signaling status-changes or other events to the LL.
Parameter:
isdn_ctrl*
The struct isdn_ctrl also defined in isdn_if. The exact meanings of its
fields are described together with the descriptions of the possible
events. Here is only a short description of the fields:
driver = driver Id.
command = event-type. (one of the constants ISDN_STAT_...)
arg = depends on event-type.
num = depends on event-type.
Returnvalue:
0 on success, else -1
int (*command)(isdn_ctrl*);
This field has to be preset by the HL-driver. It points to a function,
to be called by LL to perform functions like dialing, B-channel
setup, etc. The exact meaning of the parameters is described with the
descriptions of the possible commands.
Parameter:
isdn_ctrl*
driver = driver-Id
command = command to perform. (one of the constants ISDN_CMD_...)
arg = depends on command.
num = depends on command.
Returnvalue:
>=0 on success, else error-code (-ENODEV etc.)
int (*writebuf_skb)(int, int, int, struct sk_buff *)
***CHANGE0.7.4: New field.
***CHANGEI.1.21: New field.
This field has to be preset by the HL-driver. The given function will
be called by the LL for delivering data to be send via B-Channel.
Parameter:
int driver-Id ***CHANGE0.7.4: New parameter.
int channel-number locally to the HL-driver. (starts with 0)
int ack ***ChangeI1.21: New parameter
If this is !0, the driver has to signal the delivery
by sending an ISDN_STAT_BSENT. If this is 0, the driver
MUST NOT send an ISDN_STAT_BSENT.
struct sk_buff * Pointer to sk_buff containing data to be send via
B-channel.
Returnvalue:
Length of data accepted on success, else error-code (-EINVAL on
oversized packets etc.)
int (*writecmd)(u_char*, int, int, int, int);
This field has to be preset by the HL-driver. The given function will be
called to perform write-requests on /dev/isdnctrl (i.e. sending commands
to the card) The data-format is hardware-specific. This function is
intended for debugging only. It is not necessary for normal operation
and never will be called by the tty-emulation- or network-code. If
this function is not supported, the driver has to set NULL here.
Parameter:
u_char* pointer to data.
int length of data.
int flag: 0 = call from within kernel-space. (HL-driver must use
memcpy, may NOT use schedule())
1 = call from user-space. (HL-driver must use
memcpy_fromfs, use of schedule() allowed)
int driver-Id.
int channel-number locally to the HL-driver. (starts with 0)
***CHANGEI1.14: The driver-Id and channel-number are new since this revision.
Returnvalue:
Length of data accepted on success, else error-code (-EINVAL etc.)
int (*readstat)(u_char*, int, int, int, int);
This field has to be preset by the HL-driver. The given function will be
called to perform read-requests on /dev/isdnctrl (i.e. reading replies
from the card) The data-format is hardware-specific. This function is
intended for debugging only. It is not necessary for normal operation
and never will be called by the tty-emulation- or network-code. If
this function is not supported, the driver has to set NULL here.
Parameter:
u_char* pointer to data.
int length of data.
int flag: 0 = call from within kernel-space. (HL-driver must use
memcpy, may NOT use schedule())
1 = call from user-space. (HL-driver must use
memcpy_fromfs, use of schedule() allowed)
int driver-Id.
int channel-number locally to the HL-driver. (starts with 0)
***CHANGEI1.14: The driver-Id and channel-number are new since this revision.
Returnvalue:
Length of data on success, else error-code (-EINVAL etc.)
char id[20];
***CHANGE0.7: New since this version.
This string has to be preset by the HL-driver. Its purpose is for
identification of the driver by the user. Eg.: it is shown in the
status-info of /dev/isdninfo. Furthermore it is used as Id for binding
net-interfaces to a specific channel. If a string of length zero is
given, upon return, isdn4linux will replace it by a generic name. (line0,
line1 etc.) It is recommended to make this string configurable during
module-load-time. (copy a global variable to this string.) For doing that,
modules 1.2.8 or newer are necessary.
2. Description of the commands, a HL-driver has to support:
All commands will be performed by calling the function command() described
above from within the LL. The field command of the struct-parameter will
contain the desired command, the field driver is always set to the
appropriate driver-Id.
Until now, the following commands are defined:
***CHANGEI1.34: The parameter "num" has been replaced by a union "parm" containing
the old "num" and a new setup_type struct used for ISDN_CMD_DIAL
and ISDN_STAT_ICALL callback.
ISDN_CMD_IOCTL:
This command is intended for performing ioctl-calls for configuring
hardware or similar purposes (setting port-addresses, loading firmware
etc.) For this purpose, in the LL all ioctl-calls with an argument
>= IIOCDRVCTL (0x100) will be handed transparently to this
function after subtracting 0x100 and placing the result in arg.
Example:
If a userlevel-program calls ioctl(0x101,...) the function gets
called with the field command set to 1.
Parameter:
driver = driver-Id.
command = ISDN_CMD_IOCTL
arg = Original ioctl-cmd - IIOCDRVCTL
parm.num = first bytes filled with (unsigned long)arg
Returnvalue:
Depending on driver.
ISDN_CMD_DIAL:
This command is used to tell the HL-driver it should dial a given
number.
Parameter:
driver = driver-Id.
command = ISDN_CMD_DIAL
arg = channel-number locally to the driver. (starting with 0)
parm.setup.phone = An ASCII-String containing the number to dial.
parm.setup.eazmsn = An ASCII-Sting containing the own EAZ or MSN.
parm.setup.si1 = The Service-Indicator.
parm.setup.si2 = Additional Service-Indicator.
If the Line has been designed as SPV (a special german
feature, meaning semi-leased-line) the phone has to
start with an "S".
***CHANGE0.6: In previous versions the EAZ has been given in the
highbyte of arg.
***CHANGE0.7.1: New since this version: ServiceIndicator and AddInfo.
ISDN_CMD_ACCEPTD:
With this command, the HL-driver is told to accept a D-Channel-setup.
(Response to an incoming call)
Parameter:
driver = driver-Id.
command = ISDN_CMD_ACCEPTD
arg = channel-number locally to the driver. (starting with 0)
parm = unused.
ISDN_CMD_ACCEPTB:
With this command, the HL-driver is told to perform a B-Channel-setup.
(after establishing D-Channel-Connection)
Parameter:
driver = driver-Id.
command = ISDN_CMD_ACCEPTB
arg = channel-number locally to the driver. (starting with 0)
parm = unused.
ISDN_CMD_HANGUP:
With this command, the HL-driver is told to hangup (B-Channel if
established first, then D-Channel). This command is also used for
actively rejecting an incoming call.
Parameter:
driver = driver-Id.
command = ISDN_CMD_HANGUP
arg = channel-number locally to the driver. (starting with 0)
parm = unused.
ISDN_CMD_CLREAZ:
With this command, the HL-driver is told not to signal incoming
calls to the LL.
Parameter:
driver = driver-Id.
command = ISDN_CMD_CLREAZ
arg = channel-number locally to the driver. (starting with 0)
parm = unused.
ISDN_CMD_SETEAZ:
With this command, the HL-driver is told to signal incoming calls for
the given EAZs/MSNs to the LL.
Parameter:
driver = driver-Id.
command = ISDN_CMD_SETEAZ
arg = channel-number locally to the driver. (starting with 0)
parm.num = ASCII-String, containing the desired EAZ's/MSN's
(comma-separated). If an empty String is given, the
HL-driver should respond to ALL incoming calls,
regardless of the destination-address.
***CHANGE0.6: New since this version the "empty-string"-feature.
ISDN_CMD_GETEAZ: (currently unused)
With this command, the HL-driver is told to report the current setting
given with ISDN_CMD_SETEAZ.
Parameter:
driver = driver-Id.
command = ISDN_CMD_GETEAZ
arg = channel-number locally to the driver. (starting with 0)
parm.num = ASCII-String, containing the current EAZ's/MSN's
ISDN_CMD_SETSIL: (currently unused)
With this command, the HL-driver is told to signal only incoming
calls with the given Service-Indicators.
Parameter:
driver = driver-Id.
command = ISDN_CMD_SETSIL
arg = channel-number locally to the driver. (starting with 0)
parm.num = ASCII-String, containing the desired Service-Indicators.
ISDN_CMD_GETSIL: (currently unused)
With this command, the HL-driver is told to return the current
Service-Indicators it will respond to.
Parameter:
driver = driver-Id.
command = ISDN_CMD_SETSIL
arg = channel-number locally to the driver. (starting with 0)
parm.num = ASCII-String, containing the current Service-Indicators.
ISDN_CMD_SETL2:
With this command, the HL-driver is told to select the given Layer-2-
protocol. This command is issued by the LL prior to ISDN_CMD_DIAL or
ISDN_CMD_ACCEPTD.
Parameter:
driver = driver-Id.
command = ISDN_CMD_SETL2
arg = channel-number locally to the driver. (starting with 0)
logical or'ed with (protocol-Id << 8)
protocol-Id is one of the constants ISDN_PROTO_L2...
parm = unused.
ISDN_CMD_GETL2: (currently unused)
With this command, the HL-driver is told to return the current
setting of the Layer-2-protocol.
Parameter:
driver = driver-Id.
command = ISDN_CMD_GETL2
arg = channel-number locally to the driver. (starting with 0)
parm = unused.
Returnvalue:
current protocol-Id (one of the constants ISDN_L2_PROTO)
ISDN_CMD_SETL3:
With this command, the HL-driver is told to select the given Layer-3-
protocol. This command is issued by the LL prior to ISDN_CMD_DIAL or
ISDN_CMD_ACCEPTD.
Parameter:
driver = driver-Id.
command = ISDN_CMD_SETL3
arg = channel-number locally to the driver. (starting with 0)
logical or'ed with (protocol-Id << 8)
protocol-Id is one of the constants ISDN_PROTO_L3...
parm.fax = Pointer to T30_s fax struct. (fax usage only)
ISDN_CMD_GETL2: (currently unused)
With this command, the HL-driver is told to return the current
setting of the Layer-3-protocol.
Parameter:
driver = driver-Id.
command = ISDN_CMD_GETL3
arg = channel-number locally to the driver. (starting with 0)
parm = unused.
Returnvalue:
current protocol-Id (one of the constants ISDN_L3_PROTO)
ISDN_CMD_PROCEED:
With this command, the HL-driver is told to proceed with a incoming call.
Parameter:
driver = driver-Id.
command = ISDN_CMD_PROCEED
arg = channel-number locally to the driver. (starting with 0)
setup.eazmsn= empty string or string send as uus1 in DSS1 with
PROCEED message
ISDN_CMD_ALERT:
With this command, the HL-driver is told to alert a proceeding call.
Parameter:
driver = driver-Id.
command = ISDN_CMD_ALERT
arg = channel-number locally to the driver. (starting with 0)
setup.eazmsn= empty string or string send as uus1 in DSS1 with
ALERT message
ISDN_CMD_REDIR:
With this command, the HL-driver is told to redirect a call in proceeding
or alerting state.
Parameter:
driver = driver-Id.
command = ISDN_CMD_REDIR
arg = channel-number locally to the driver. (starting with 0)
setup.eazmsn= empty string or string send as uus1 in DSS1 protocol
setup.screen= screening indicator
setup.phone = redirected to party number
ISDN_CMD_PROT_IO:
With this call, the LL-driver invokes protocol specific features through
the LL.
The call is not implicitely bound to a connection.
Parameter:
driver = driver-Id
command = ISDN_CMD_PROT_IO
arg = The lower 8 Bits define the addressed protocol as defined
in ISDN_PTYPE..., the upper bits are used to differentiate
the protocol specific CMD.
para = protocol and function specific. See isdnif.h for detail.
ISDN_CMD_FAXCMD:
With this command the HL-driver receives a fax sub-command.
For details refer to INTERFACE.fax
Parameter:
driver = driver-Id.
command = ISDN_CMD_FAXCMD
arg = channel-number locally to the driver. (starting with 0)
parm = unused.
3. Description of the events to be signaled by the HL-driver to the LL.
All status-changes are signaled via calling the previously described
function statcallb(). The field command of the struct isdn_cmd has
to be set by the HL-driver with the appropriate Status-Id (event-number).
The field arg has to be set to the channel-number (locally to the driver,
starting with 0) to which this event applies. (Exception: STAVAIL-event)
Until now, the following Status-Ids are defined:
ISDN_STAT_AVAIL:
With this call, the HL-driver signals the availability of new data
for readstat(). Used only for debugging-purposes, see description
of readstat().
Parameter:
driver = driver-Id
command = ISDN_STAT_STAVAIL
arg = length of available data.
parm = unused.
ISDN_STAT_ICALL:
ISDN_STAT_ICALLW:
With this call, the HL-driver signals an incoming call to the LL.
If ICALLW is signalled the incoming call is a waiting call without
a available B-chan.
Parameter:
driver = driver-Id
command = ISDN_STAT_ICALL
arg = channel-number, locally to the driver. (starting with 0)
para.setup.phone = Callernumber.
para.setup.eazmsn = CalledNumber.
para.setup.si1 = Service Indicator.
para.setup.si2 = Additional Service Indicator.
para.setup.plan = octet 3 from Calling party number Information Element.
para.setup.screen = octet 3a from Calling party number Information Element.
Return:
0 = No device matching this call.
1 = At least one device matching this call (RING on ttyI).
HL-driver may send ALERTING on the D-channel in this case.
2 = Call will be rejected.
3 = Incoming called party number is currently incomplete.
Additional digits are required.
Used for signalling with PtP connections.
4 = Call will be held in a proceeding state
(HL driver sends PROCEEDING)
Used when a user space prog needs time to interpret a call
para.setup.eazmsn may be filled with an uus1 message of
30 octets maximum. Empty string if no uus.
5 = Call will be actively deflected to another party
Only available in DSS1/EURO protocol
para.setup.phone must be set to destination party number
para.setup.eazmsn may be filled with an uus1 message of
30 octets maximum. Empty string if no uus.
-1 = An error happened. (Invalid parameters for example.)
The keypad support now is included in the dial command.
ISDN_STAT_RUN:
With this call, the HL-driver signals availability of the ISDN-card.
(after initializing, loading firmware)
Parameter:
driver = driver-Id
command = ISDN_STAT_RUN
arg = unused.
parm = unused.
ISDN_STAT_STOP:
With this call, the HL-driver signals unavailability of the ISDN-card.
(before unloading, while resetting/reconfiguring the card)
Parameter:
driver = driver-Id
command = ISDN_STAT_STOP
arg = unused.
parm = unused.
ISDN_STAT_DCONN:
With this call, the HL-driver signals the successful establishment of
a D-Channel-connection. (Response to ISDN_CMD_ACCEPTD or ISDN_CMD_DIAL)
Parameter:
driver = driver-Id
command = ISDN_STAT_DCONN
arg = channel-number, locally to the driver. (starting with 0)
parm = unused.
ISDN_STAT_BCONN:
With this call, the HL-driver signals the successful establishment of
a B-Channel-connection. (Response to ISDN_CMD_ACCEPTB or because the
remote-station has initiated establishment)
The HL driver should call this when the logical l2/l3 protocol
connection on top of the physical B-channel is established.
Parameter:
driver = driver-Id
command = ISDN_STAT_BCONN
arg = channel-number, locally to the driver. (starting with 0)
parm.num = ASCII-String, containing type of connection (for analog
modem only). This will be appended to the CONNECT message
e.g. 14400/V.32bis
ISDN_STAT_DHUP:
With this call, the HL-driver signals the shutdown of a
D-Channel-connection. This could be a response to a prior ISDN_CMD_HANGUP,
or caused by a remote-hangup or if the remote-station has actively
rejected a call.
Parameter:
driver = driver-Id
command = ISDN_STAT_DHUP
arg = channel-number, locally to the driver. (starting with 0)
parm = unused.
ISDN_STAT_BHUP:
With this call, the HL-driver signals the shutdown of a
B-Channel-connection. This could be a response to a prior ISDN_CMD_HANGUP,
or caused by a remote-hangup.
The HL driver should call this as soon as the logical l2/l3 protocol
connection on top of the physical B-channel is released.
Parameter:
driver = driver-Id
command = ISDN_STAT_BHUP
arg = channel-number, locally to the driver. (starting with 0)
parm = unused.
ISDN_STAT_CINF:
With this call, the HL-driver delivers charge-unit information to the
LL.
Parameter:
driver = driver-Id
command = ISDN_STAT_CINF
arg = channel-number, locally to the driver. (starting with 0)
parm.num = ASCII string containing charge-units (digits only).
ISDN_STAT_LOAD: (currently unused)
ISDN_STAT_UNLOAD:
With this call, the HL-driver signals that it will be unloaded now. This
tells the LL to release all corresponding data-structures.
Parameter:
driver = driver-Id
command = ISDN_STAT_UNLOAD
arg = unused.
parm = unused.
ISDN_STAT_BSENT:
With this call the HL-driver signals the delivery of a data-packet.
This callback is used by the network-interfaces only, tty-Emulation
does not need this call.
Parameter:
driver = driver-Id
command = ISDN_STAT_BSENT
arg = channel-number, locally to the driver. (starting with 0)
parm.length = ***CHANGEI.1.21: New field.
the driver has to set this to the original length
of the skb at the time of receiving it from the linklevel.
ISDN_STAT_NODCH:
With this call, the driver has to respond to a prior ISDN_CMD_DIAL, if
no D-Channel is available.
Parameter:
driver = driver-Id
command = ISDN_STAT_NODCH
arg = channel-number, locally to the driver. (starting with 0)
parm = unused.
ISDN_STAT_ADDCH:
This call is for HL-drivers, which are unable to check card-type
or numbers of supported channels before they have loaded any firmware
using ioctl. Those HL-driver simply set the channel-parameter to a
minimum channel-number when registering, and later if they know
the real amount, perform this call, allocating additional channels.
Parameter:
driver = driver-Id
command = ISDN_STAT_ADDCH
arg = number of channels to be added.
parm = unused.
ISDN_STAT_CAUSE:
With this call, the HL-driver delivers CAUSE-messages to the LL.
Currently the LL does not use this messages. Their contents is simply
logged via kernel-messages. Therefore, currently the format of the
messages is completely free. However they should be printable.
Parameter:
driver = driver-Id
command = ISDN_STAT_NODCH
arg = channel-number, locally to the driver. (starting with 0)
parm.num = ASCII string containing CAUSE-message.
ISDN_STAT_DISPLAY:
With this call, the HL-driver delivers DISPLAY-messages to the LL.
Currently the LL does not use this messages.
Parameter:
driver = driver-Id
command = ISDN_STAT_DISPLAY
arg = channel-number, locally to the driver. (starting with 0)
para.display= string containing DISPLAY-message.
ISDN_STAT_PROT:
With this call, the HL-driver delivers protocol specific infos to the LL.
The call is not implicitely bound to a connection.
Parameter:
driver = driver-Id
command = ISDN_STAT_PROT
arg = The lower 8 Bits define the addressed protocol as defined
in ISDN_PTYPE..., the upper bits are used to differentiate
the protocol specific STAT.
para = protocol and function specific. See isdnif.h for detail.
ISDN_STAT_DISCH:
With this call, the HL-driver signals the LL to disable or enable the
use of supplied channel and driver.
The call may be used to reduce the available number of B-channels after
loading the driver. The LL has to ignore a disabled channel when searching
for free channels. The HL driver itself never delivers STAT callbacks for
disabled channels.
The LL returns a nonzero code if the operation was not successful or the
selected channel is actually regarded as busy.
Parameter:
driver = driver-Id
command = ISDN_STAT_DISCH
arg = channel-number, locally to the driver. (starting with 0)
parm.num[0] = 0 if channel shall be disabled, else enabled.
ISDN_STAT_L1ERR:
***CHANGEI1.21 new status message.
A signal can be sent to the linklevel if an Layer1-error results in
packet-loss on receive or send. The field errcode of the cmd.parm
union describes the error more precisely.
Parameter:
driver = driver-Id
command = ISDN_STAT_L1ERR
arg = channel-number, locally to the driver. (starting with 0)
parm.errcode= ISDN_STAT_L1ERR_SEND: Packet lost while sending.
ISDN_STAT_L1ERR_RECV: Packet lost while receiving.
ISDN_STAT_FAXIND:
With this call the HL-driver signals a fax sub-command to the LL.
For details refer to INTERFACE.fax
Parameter:
driver = driver-Id.
command = ISDN_STAT_FAXIND
arg = channel-number, locally to the driver. (starting with 0)
parm = unused.

View File

@ -1,163 +0,0 @@
$Id: INTERFACE.fax,v 1.2 2000/08/06 09:22:50 armin Exp $
Description of the fax-subinterface between linklevel and hardwarelevel of
isdn4linux.
The communication between linklevel (LL) and hardwarelevel (HL) for fax
is based on the struct T30_s (defined in isdnif.h).
This struct is allocated in the LL.
In order to use fax, the LL provides the pointer to this struct with the
command ISDN_CMD_SETL3 (parm.fax). This pointer expires in case of hangup
and when a new channel to a new connection is assigned.
Data handling:
In send-mode the HL-driver has to handle the <DLE> codes and the bit-order
conversion by itself.
In receive-mode the LL-driver takes care of the bit-order conversion
(specified by +FBOR)
Structure T30_s description:
This structure stores the values (set by AT-commands), the remote-
capability-values and the command-codes between LL and HL.
If the HL-driver receives ISDN_CMD_FAXCMD, all needed information
is in this struct set by the LL.
To signal information to the LL, the HL-driver has to set the
parameters and use ISDN_STAT_FAXIND.
(Please refer to INTERFACE)
Structure T30_s:
All members are 8-bit unsigned (__u8)
- resolution
- rate
- width
- length
- compression
- ecm
- binary
- scantime
- id[]
Local faxmachine's parameters, set by +FDIS, +FDCS, +FLID, ...
- r_resolution
- r_rate
- r_width
- r_length
- r_compression
- r_ecm
- r_binary
- r_scantime
- r_id[]
Remote faxmachine's parameters. To be set by HL-driver.
- phase
Defines the actual state of fax connection. Set by HL or LL
depending on progress and type of connection.
If the phase changes because of an AT command, the LL driver
changes this value. Otherwise the HL-driver takes care of it, but
only necessary on call establishment (from IDLE to PHASE_A).
(one of the constants ISDN_FAX_PHASE_[IDLE,A,B,C,D,E])
- direction
Defines outgoing/send or incoming/receive connection.
(ISDN_TTY_FAX_CONN_[IN,OUT])
- code
Commands from LL to HL; possible constants :
ISDN_TTY_FAX_DR signals +FDR command to HL
ISDN_TTY_FAX_DT signals +FDT command to HL
ISDN_TTY_FAX_ET signals +FET command to HL
Other than that the "code" is set with the hangup-code value at
the end of connection for the +FHNG message.
- r_code
Commands from HL to LL; possible constants :
ISDN_TTY_FAX_CFR output of +FCFR message.
ISDN_TTY_FAX_RID output of remote ID set in r_id[]
(+FCSI/+FTSI on send/receive)
ISDN_TTY_FAX_DCS output of +FDCS and CONNECT message,
switching to phase C.
ISDN_TTY_FAX_ET signals end of data,
switching to phase D.
ISDN_TTY_FAX_FCON signals the established, outgoing connection,
switching to phase B.
ISDN_TTY_FAX_FCON_I signals the established, incoming connection,
switching to phase B.
ISDN_TTY_FAX_DIS output of +FDIS message and values.
ISDN_TTY_FAX_SENT signals that all data has been sent
and <DLE><ETX> is acknowledged,
OK message will be sent.
ISDN_TTY_FAX_PTS signals a msg-confirmation (page sent successful),
depending on fet value:
0: output OK message (more pages follow)
1: switching to phase B (next document)
ISDN_TTY_FAX_TRAIN_OK output of +FDCS and OK message (for receive mode).
ISDN_TTY_FAX_EOP signals end of data in receive mode,
switching to phase D.
ISDN_TTY_FAX_HNG output of the +FHNG and value set by code and
OK message, switching to phase E.
- badlin
Value of +FBADLIN
- badmul
Value of +FBADMUL
- bor
Value of +FBOR
- fet
Value of +FET command in send-mode.
Set by HL in receive-mode for +FET message.
- pollid[]
ID-string, set by +FCIG
- cq
Value of +FCQ
- cr
Value of +FCR
- ctcrty
Value of +FCTCRTY
- minsp
Value of +FMINSP
- phcto
Value of +FPHCTO
- rel
Value of +FREL
- nbc
Value of +FNBC (0,1)
(+FNBC is not a known class 2 fax command, I added this to change the
automatic "best capabilities" connection in the eicon HL-driver)
Armin
mac@melware.de

View File

@ -1,599 +0,0 @@
README for the ISDN-subsystem
1. Preface
1.1 Introduction
This README describes how to set up and how to use the different parts
of the ISDN-subsystem.
For using the ISDN-subsystem, some additional userlevel programs are
necessary. Those programs and some contributed utilities are available
at
ftp.isdn4linux.de
/pub/isdn4linux/isdn4k-utils-<VersionNumber>.tar.gz
We also have set up a mailing-list:
The isdn4linux-project originates in Germany, and therefore by historical
reasons, the mailing-list's primary language is german. However mails
written in english have been welcome all the time.
to subscribe: write a email to majordomo@listserv.isdn4linux.de,
Subject irrelevant, in the message body:
subscribe isdn4linux <your_email_address>
To write to the mailing-list, write to isdn4linux@listserv.isdn4linux.de
This mailinglist is bidirectionally gated to the newsgroup
de.alt.comm.isdn4linux
There is also a well maintained FAQ in English available at
https://www.mhessler.de/i4lfaq/
It can be viewed online, or downloaded in sgml/text/html format.
The FAQ can also be viewed online at
https://www.isdn4linux.de/faq/i4lfaq.html
or downloaded from
ftp://ftp.isdn4linux.de/pub/isdn4linux/FAQ/
1.1 Technical details
In the following Text, the terms MSN and EAZ are used.
MSN is the abbreviation for (M)ultiple(S)ubscriber(N)umber, and applies
to Euro(EDSS1)-type lines. Usually it is simply the phone number.
EAZ is the abbreviation of (E)ndgeraete(A)uswahl(Z)iffer and
applies to German 1TR6-type lines. This is a one-digit string,
simply appended to the base phone number
The internal handling is nearly identical, so replace the appropriate
term to that one, which applies to your local ISDN-environment.
When the link-level-module isdn.o is loaded, it supports up to 16
low-level-modules with up to 64 channels. (The number 64 is arbitrarily
chosen and can be configured at compile-time --ISDN_MAX in isdn.h).
A low-level-driver can register itself through an interface (which is
defined in isdnif.h) and gets assigned a slot.
The following char-devices are made available for each channel:
A raw-control-device with the following functions:
write: raw D-channel-messages (format: depends on driver).
read: raw D-channel-messages (format: depends on driver).
ioctl: depends on driver, i.e. for the ICN-driver, the base-address of
the ports and the shared memory on the card can be set and read
also the boot-code and the protocol software can be loaded into
the card.
O N L Y !!! for debugging (no locking against other devices):
One raw-data-device with the following functions:
write: data to B-channel.
read: data from B-channel.
In addition the following devices are made available:
128 tty-devices (64 cuix and 64 ttyIx) with integrated modem-emulator:
The functionality is almost the same as that of a serial device
(the line-discs are handled by the kernel), which lets you run
SLIP, CSLIP and asynchronous PPP through the devices. We have tested
Seyon, minicom, CSLIP (uri-dip) PPP, mgetty, XCept and Hylafax.
The modem-emulation supports the following:
1.3.1 Commands:
ATA Answer incoming call.
ATD<No.> Dial, the number may contain:
[0-9] and [,#.*WPT-S]
the latter are ignored until 'S'.
The 'S' must precede the number, if
the line is a SPV (German 1TR6).
ATE0 Echo off.
ATE1 Echo on (default).
ATH Hang-up.
ATH1 Off hook (ignored).
ATH0 Hang-up.
ATI Return "ISDN for Linux...".
ATI0 "
ATI1 "
ATI2 Report of last connection.
ATO On line (data mode).
ATQ0 Enable result codes (default).
ATQ1 Disable result codes (default).
ATSx=y Set register x to y.
ATSx? Show contents of register x.
ATV0 Numeric responses.
ATV1 English responses (default).
ATZ Load registers and EAZ/MSN from Profile.
AT&Bx Set Send-Packet-size to x (max. 4000)
The real packet-size may be limited by the
low-level-driver used. e.g. the HiSax-Module-
limit is 2000. You will get NO Error-Message,
if you set it to higher values, because at the
time of giving this command the corresponding
driver may not be selected (see "Automatic
Assignment") however the size of outgoing packets
will be limited correctly.
AT&D0 Ignore DTR
AT&D2 DTR-low-edge: Hang up and return to
command mode (default).
AT&D3 Same as AT&D2 but also resets all registers.
AT&Ex Set the EAZ/MSN for this channel to x.
AT&F Reset all registers and profile to "factory-defaults"
AT&Lx Set list of phone numbers to listen on. x is a
list of wildcard patterns separated by semicolon.
If this is set, it has precedence over the MSN set
by AT&E.
AT&Rx Select V.110 bitrate adaption.
This command enables V.110 protocol with 9600 baud
(x=9600), 19200 baud (x=19200) or 38400 baud
(x=38400). A value of x=0 disables V.110 switching
back to default X.75. This command sets the following
Registers:
Reg 14 (Layer-2 protocol):
x = 0: 0
x = 9600: 7
x = 19200: 8
x = 38400: 9
Reg 18.2 = 1
Reg 19 (Additional Service Indicator):
x = 0: 0
x = 9600: 197
x = 19200: 199
x = 38400: 198
Note on value in Reg 19:
There is _NO_ common convention for 38400 baud.
The value 198 is chosen arbitrarily. Users
_MUST_ negotiate this value before establishing
a connection.
AT&Sx Set window-size (x = 1..8) (not yet implemented)
AT&V Show all settings.
AT&W0 Write registers and EAZ/MSN to profile. See also
iprofd (5.c in this README).
AT&X0 BTX-mode and T.70-mode off (default)
AT&X1 BTX-mode on. (S13.1=1, S13.5=0 S14=0, S16=7, S18=7, S19=0)
AT&X2 T.70-mode on. (S13.1=1, S13.5=1, S14=0, S16=7, S18=7, S19=0)
AT+Rx Resume a suspended call with CallID x (x = 1,2,3...)
AT+Sx Suspend a call with CallID x (x = 1,2,3...)
For voice-mode commands refer to README.audio
1.3.2 Escape sequence:
During a connection, the emulation reacts just like
a normal modem to the escape sequence <DELAY>+++<DELAY>.
(The escape character - default '+' - can be set in the
register 2).
The DELAY must at least be 1.5 seconds long and delay
between the escape characters must not exceed 0.5 seconds.
1.3.3 Registers:
Nr. Default Description
0 0 Answer on ring number.
(no auto-answer if S0=0).
1 0 Count of rings.
2 43 Escape character.
(a value >= 128 disables the escape sequence).
3 13 Carriage return character (ASCII).
4 10 Line feed character (ASCII).
5 8 Backspace character (ASCII).
6 3 Delay in seconds before dialing.
7 60 Wait for carrier.
8 2 Pause time for comma (ignored)
9 6 Carrier detect time (ignored)
10 7 Carrier loss to disconnect time (ignored).
11 70 Touch tone timing (ignored).
12 69 Bit coded register:
Bit 0: 0 = Suppress response messages.
1 = Show response messages.
Bit 1: 0 = English response messages.
1 = Numeric response messages.
Bit 2: 0 = Echo off.
1 = Echo on.
Bit 3 0 = DCD always on.
1 = DCD follows carrier.
Bit 4 0 = CTS follows RTS
1 = Ignore RTS, CTS always on.
Bit 5 0 = return to command mode on DTR low.
1 = Same as 0 but also resets all
registers.
See also register 13, bit 2
Bit 6 0 = DSR always on.
1 = DSR only on if channel is available.
Bit 7 0 = Cisco-PPP-flag-hack off (default).
1 = Cisco-PPP-flag-hack on.
13 0 Bit coded register:
Bit 0: 0 = Use delayed tty-send-algorithm
1 = Direct tty-send.
Bit 1: 0 = T.70 protocol (Only for BTX!) off
1 = T.70 protocol (Only for BTX!) on
Bit 2: 0 = Don't hangup on DTR low.
1 = Hangup on DTR low.
Bit 3: 0 = Standard response messages
1 = Extended response messages
Bit 4: 0 = CALLER NUMBER before every RING.
1 = CALLER NUMBER after first RING.
Bit 5: 0 = T.70 extended protocol off
1 = T.70 extended protocol on
Bit 6: 0 = Special RUNG Message off
1 = Special RUNG Message on
"RUNG" is delivered on a ttyI, if
an incoming call happened (RING) and
the remote party hung up before any
local ATA was given.
Bit 7: 0 = Don't show display messages from net
1 = Show display messages from net
(S12 Bit 1 must be 0 too)
14 0 Layer-2 protocol:
0 = X75/LAPB with I-frames
1 = X75/LAPB with UI-frames
2 = X75/LAPB with BUI-frames
3 = HDLC
4 = Transparent (audio)
7 = V.110, 9600 baud
8 = V.110, 19200 baud
9 = V.110, 38400 baud
10 = Analog Modem (only if hardware supports this)
11 = Fax G3 (only if hardware supports this)
15 0 Layer-3 protocol:
0 = transparent
1 = transparent with audio features (e.g. DSP)
2 = Fax G3 Class 2 commands (S14 has to be set to 11)
3 = Fax G3 Class 1 commands (S14 has to be set to 11)
16 250 Send-Packet-size/16
17 8 Window-size (not yet implemented)
18 4 Bit coded register, Service-Octet-1 to accept,
or to be used on dialout:
Bit 0: Service 1 (audio) when set.
Bit 1: Service 5 (BTX) when set.
Bit 2: Service 7 (data) when set.
Note: It is possible to set more than one
bit. In this case, on incoming calls
the selected services are accepted,
and if the service is "audio", the
Layer-2-protocol is automatically
changed to 4 regardless of the setting
of register 14. On outgoing calls,
the most significant 1-bit is chosen to
select the outgoing service octet.
19 0 Service-Octet-2
20 0 Bit coded register (readonly)
Service-Octet-1 of last call.
Bit mapping is the same as register 18
21 0 Bit coded register (readonly)
Set on incoming call (during RING) to
octet 3 of calling party number IE (Numbering plan)
See section 4.5.10 of ITU Q.931
22 0 Bit coded register (readonly)
Set on incoming call (during RING) to
octet 3a of calling party number IE (Screening info)
See section 4.5.10 of ITU Q.931
23 0 Bit coded register:
Bit 0: 0 = Add CPN to RING message off
1 = Add CPN to RING message on
Bit 1: 0 = Add CPN to FCON message off
1 = Add CPN to FCON message on
Bit 2: 0 = Add CDN to RING/FCON message off
1 = Add CDN to RING/FCON message on
Last but not least a (at the moment fairly primitive) device to request
the line-status (/dev/isdninfo) is made available.
Automatic assignment of devices to lines:
All inactive physical lines are listening to all EAZs for incoming
calls and are NOT assigned to a specific tty or network interface.
When an incoming call is detected, the driver looks first for a network
interface and then for an opened tty which:
1. is configured for the same EAZ.
2. has the same protocol settings for the B-channel.
3. (only for network interfaces if the security flag is set)
contains the caller number in its access list.
4. Either the channel is not bound exclusively to another Net-interface, or
it is bound AND the other checks apply to exactly this interface.
(For usage of the bind-features, refer to the isdnctrl-man-page)
Only when a matching interface or tty is found is the call accepted
and the "connection" between the low-level-layer and the link-level-layer
is established and kept until the end of the connection.
In all other cases no connection is established. Isdn4linux can be
configured to either do NOTHING in this case (which is useful, if
other, external devices with the same EAZ/MSN are connected to the bus)
or to reject the call actively. (isdnctrl busreject ...)
For an outgoing call, the inactive physical lines are searched.
The call is placed on the first physical line, which supports the
requested protocols for the B-channel. If a net-interface, however
is pre-bound to a channel, this channel is used directly.
This makes it possible to configure several network interfaces and ttys
for one EAZ, if the network interfaces are set to secure operation.
If an incoming call matches one network interface, it gets connected to it.
If another incoming call for the same EAZ arrives, which does not match
a network interface, the first tty gets a "RING" and so on.
2 System prerequisites:
ATTENTION!
Always use the latest module utilities. The current version is
named in Documentation/Changes. Some old versions of insmod
are not capable of setting the driver-Ids correctly.
3. Lowlevel-driver configuration.
Configuration depends on how the drivers are built. See the
README.<yourDriver> for information on driver-specific setup.
4. Device-inodes
The major and minor numbers and their names are described in
Documentation/admin-guide/devices.rst. The major numbers are:
43 for the ISDN-tty's.
44 for the ISDN-callout-tty's.
45 for control/info/debug devices.
5. Application
a) For some card-types, firmware has to be loaded into the cards, before
proceeding with device-independent setup. See README.<yourDriver>
for how to do that.
b) If you only intend to use ttys, you are nearly ready now.
c) If you want to have really permanent "Modem"-settings on disk, you
can start the daemon iprofd. Give it a path to a file at the command-
line. It will store the profile-settings in this file every time
an AT&W0 is performed on any ISDN-tty. If the file already exists,
all profiles are initialized from this file. If you want to unload
any of the modules, kill iprofd first.
d) For networking, continue: Create an interface:
isdnctrl addif isdn0
e) Set the EAZ (or MSN for Euro-ISDN):
isdnctrl eaz isdn0 2
(For 1TR6 a single digit is allowed, for Euro-ISDN the number is your
real MSN e.g.: Phone-Number)
f) Set the number for outgoing calls on the interface:
isdnctrl addphone isdn0 out 1234567
... (this can be executed more than once, all assigned numbers are
tried in order)
and the number(s) for incoming calls:
isdnctrl addphone isdn0 in 1234567
g) Set the timeout for hang-up:
isdnctrl huptimeout isdn0 <timeout_in_seconds>
h) additionally you may activate charge-hang-up (= Hang up before
next charge-info, this only works, if your isdn-provider transmits
the charge-info during and after the connection):
isdnctrl chargehup isdn0 on
i) Set the dial mode of the interface:
isdnctrl dialmode isdn0 auto
"off" means that you (or the system) cannot make any connection
(neither incoming or outgoing connections are possible). Use
this if you want to be sure that no connections will be made.
"auto" means that the interface is in auto-dial mode, and will
attempt to make a connection whenever a network data packet needs
the interface's link. Note that this can cause unexpected dialouts,
and lead to a high phone bill! Some daemons or other pc's that use
this interface can cause this.
Incoming connections are also possible.
"manual" is a dial mode created to prevent the unexpected dialouts.
In this mode, the interface will never make any connections on its
own. You must explicitly initiate a connection with "isdnctrl dial
isdn0". However, after an idle time of no traffic as configured for
the huptimeout value with isdnctrl, the connection _will_ be ended.
If you don't want any automatic hangup, set the huptimeout value to 0.
"manual" is the default.
j) Setup the interface with ifconfig as usual, and set a route to it.
k) (optional) If you run X11 and have Tcl/Tk-wish version 4.0, you can use
the script tools/tcltk/isdnmon. You can add actions for line-status
changes. See the comments at the beginning of the script for how to
do that. There are other tty-based tools in the tools-subdirectory
contributed by Michael Knigge (imon), Volker Götz (imontty) and
Andreas Kool (isdnmon).
l) For initial testing, you can set the verbose-level to 2 (default: 0).
Then all incoming calls are logged, even if they are not addressed
to one of the configured net-interfaces:
isdnctrl verbose 2
Now you are ready! A ping to the set address should now result in an
automatic dial-out (look at syslog kernel-messages).
The phone numbers and EAZs can be assigned at any time with isdnctrl.
You can add as many interfaces as you like with addif following the
directions above. Of course, there may be some limitations. But we have
tested as many as 20 interfaces without any problem. However, if you
don't give an interface name to addif, the kernel will assign a name
which starts with "eth". The number of "eth"-interfaces is limited by
the kernel.
5. Additional options for isdnctrl:
"isdnctrl secure <InterfaceName> on"
Only incoming calls, for which the caller-id is listed in the access
list of the interface are accepted. You can add caller-id's With the
command "isdnctrl addphone <InterfaceName> in <caller-id>"
Euro-ISDN does not transmit the leading '0' of the caller-id for an
incoming call, therefore you should configure it accordingly.
If the real number for the dialout e.g. is "09311234567" the number
to configure here is "9311234567". The pattern-match function
works similar to the shell mechanism.
? one arbitrary digit
* zero or arbitrary many digits
[123] one of the digits in the list
[1-5] one digit between '1' and '5'
a '^' as the first character in a list inverts the list
"isdnctrl secure <InterfaceName> off"
Switch off secure operation (default).
"isdnctrl ihup <InterfaceName> [on|off]"
Switch the hang-up-timer for incoming calls on or off.
"isdnctrl eaz <InterfaceName>"
Returns the EAZ of an interface.
"isdnctrl delphone <InterfaceName> in|out <number>"
Deletes a number from one of the access-lists of the interface.
"isdnctrl delif <InterfaceName>"
Removes the interface (and possible slaves) from the kernel.
(You have to unregister it with "ifconfig <InterfaceName> down" before).
"isdnctrl callback <InterfaceName> [on|off]"
Switches an interface to callback-mode. In this mode, an incoming call
will be rejected and after this the remote-station will be called. If
you test this feature by using ping, some routers will re-dial very
quickly, so that the callback from isdn4linux may not be recognized.
In this case use ping with the option -i <sec> to increase the interval
between echo-packets.
"isdnctrl cbdelay <InterfaceName> [seconds]"
Sets the delay (default 5 sec) between an incoming call and start of
dialing when callback is enabled.
"isdnctrl cbhup <InterfaceName> [on|off]"
This enables (default) or disables an active hangup (reject) when getting an
incoming call for an interface which is configured for callback.
"isdnctrl encap <InterfaceName> <EncapType>"
Selects the type of packet-encapsulation. The encapsulation can be changed
only while an interface is down.
At the moment the following values are supported:
rawip (Default) Selects raw-IP-encapsulation. This means, MAC-headers
are stripped off.
ip IP with type-field. Same as IP but the type-field of the MAC-header
is preserved.
x25iface X.25 interface encapsulation (first byte semantics as defined in
../networking/x25-iface.txt). Use this for running the linux
X.25 network protocol stack (AF_X25 sockets) on top of isdn.
cisco-h A special-mode for communicating with a Cisco, which is configured
to do "hdlc"
ethernet No stripping. Packets are sent with full MAC-header.
The Ethernet-address of the interface is faked, from its
IP-address: fc:fc:i1:i2:i3:i4, where i1-4 are the IP-addr.-values.
syncppp Synchronous PPP
uihdlc HDLC with UI-frame-header (for use with DOS ISPA, option -h1)
NOTE: x25iface encapsulation is currently experimental. Please
read README.x25 for further details
Watching packets, using standard-tcpdump will fail for all encapsulations
except ethernet because tcpdump does not know how to handle packets
without MAC-header. A patch for tcpdump is included in the utility-package
mentioned above.
"isdnctrl l2_prot <InterfaceName> <L2-ProtocolName>"
Selects a layer-2-protocol.
(With the ICN-driver and the HiSax-driver, "x75i" and "hdlc" is available.
With other drivers, "x75ui", "x75bui", "x25dte", "x25dce" may be
possible too. See README.x25 for x25 related l2 protocols.)
isdnctrl l3_prot <InterfaceName> <L3-ProtocolName>
The same for layer-3. (At the moment only "trans" is allowed)
"isdnctrl list <InterfaceName>"
Shows all parameters of an interface and the charge-info.
Try "all" as the interface name.
"isdnctrl hangup <InterfaceName>"
Forces hangup of an interface.
"isdnctrl bind <InterfaceName> <DriverId>,<ChannelNumber> [exclusive]"
If you are using more than one ISDN card, it is sometimes necessary to
dial out using a specific card or even preserve a specific channel for
dialout of a specific net-interface. This can be done with the above
command. Replace <DriverId> by whatever you assigned while loading the
module. The <ChannelNumber> is counted from zero. The upper limit
depends on the card used. At the moment no card supports more than
2 channels, so the upper limit is one.
"isdnctrl unbind <InterfaceName>"
unbinds a previously bound interface.
"isdnctrl busreject <DriverId> on|off"
If switched on, isdn4linux replies a REJECT to incoming calls, it
cannot match to any configured interface.
If switched off, nothing happens in this case.
You normally should NOT enable this feature, if the ISDN adapter is not
the only device connected to the S0-bus. Otherwise it could happen that
isdn4linux rejects an incoming call, which belongs to another device on
the bus.
"isdnctrl addslave <InterfaceName> <SlaveName>
Creates a slave interface for channel-bundling. Slave interfaces are
not seen by the kernel, but their ISDN-part can be configured with
isdnctrl as usual. (Phone numbers, EAZ/MSN, timeouts etc.) If more
than two channels are to be bundled, feel free to create as many as you
want. InterfaceName must be a real interface, NOT a slave. Slave interfaces
start dialing, if the master interface resp. the previous slave interface
has a load of more than 7000 cps. They hangup if the load goes under 7000
cps, according to their "huptimeout"-parameter.
"isdnctrl sdelay <InterfaceName> secs."
This sets the minimum time an Interface has to be fully loaded, until
it sends a dial-request to its slave.
"isdnctrl dial <InterfaceName>"
Forces an interface to start dialing even if no packets are to be
transferred.
"isdnctrl mapping <DriverId> MSN0,MSN1,MSN2,...MSN9"
This installs a mapping table for EAZ<->MSN-mapping for a single line.
Missing MSN's have to be given as "-" or can be omitted, if at the end
of the commandline.
With this command, it's now possible to have an interface listening to
mixed 1TR6- and Euro-Type lines. In this case, the interface has to be
configured to a 1TR6-type EAZ (one digit). The mapping is also valid
for tty-emulation. Seen from the interface/tty-level the mapping
CAN be used, however it's possible to use single tty's/interfaces with
real MSN's (more digits) also, in which case the mapping will be ignored.
Here is an example:
You have a 1TR6-type line with base-nr. 1234567 and a Euro-line with
MSN's 987654, 987655 and 987656. The DriverId for the Euro-line is "EURO".
isdnctrl mapping EURO -,987654,987655,987656,-,987655
...
isdnctrl eaz isdn0 1 # listen on 12345671(1tr6) and 987654(euro)
...
isdnctrl eaz isdn1 4 # listen on 12345674(1tr6) only.
...
isdnctrl eaz isdn2 987654 # listen on 987654(euro) only.
Same scheme is used with AT&E... at the tty's.
6. If you want to write a new low-level-driver, you are welcome.
The interface to the link-level-module is described in the file INTERFACE.
If the interface should be expanded for any reason, don't do it
on your own, send me a mail containing the proposed changes and
some reasoning about them.
If other drivers will not be affected, I will include the changes
in the next release.
For developers only, there is a second mailing-list. Write to me
(fritz@isdn4linux.de), if you want to join that list.
Have fun!
-Fritz

View File

@ -1,26 +0,0 @@
The FAQ for isdn4linux
======================
Please note that there is a big FAQ available in the isdn4k-utils.
You find it in:
isdn4k-utils/FAQ/i4lfaq.sgml
In case you just want to see the FAQ online, or download the newest version,
you can have a look at my website:
https://www.mhessler.de/i4lfaq/ (view + download)
or:
https://www.isdn4linux.de/faq/4lfaq.html (view)
As the extension tells, the FAQ is in SGML format, and you can convert it
into text/html/... format by using the sgml2txt/sgml2html/... tools.
Alternatively, you can also do a 'configure; make all' in the FAQ directory.
Please have a look at the FAQ before posting anything in the Mailinglist,
or the newsgroup!
Matthias Hessler
hessler@isdn4linux.de

View File

@ -1,138 +0,0 @@
$Id: README.audio,v 1.8 1999/07/11 17:17:29 armin Exp $
ISDN subsystem for Linux.
Description of audio mode.
When enabled during kernel configuration, the tty emulator of the ISDN
subsystem is capable of a reduced set of commands to support audio.
This document describes the commands supported and the format of
audio data.
Commands for enabling/disabling audio mode:
AT+FCLASS=8 Enable audio mode.
This affects the following registers:
S18: Bits 0 and 2 are set.
S16: Set to 48 and any further change to
larger values is blocked.
AT+FCLASS=0 Disable audio mode.
Register 18 is set to 4.
AT+FCLASS=? Show possible modes.
AT+FCLASS? Report current mode (0 or 8).
Commands supported in audio mode:
All audio mode commands have one of the following forms:
AT+Vxx? Show current setting.
AT+Vxx=? Show possible settings.
AT+Vxx=v Set simple parameter.
AT+Vxx=v,v ... Set complex parameter.
where xx is a two-character code and v are alphanumerical parameters.
The following commands are supported:
AT+VNH=x Auto hangup setting. NO EFFECT, supported
for compatibility only.
AT+VNH? Always reporting "1"
AT+VNH=? Always reporting "1"
AT+VIP Reset all audio parameters.
AT+VLS=x Line select. x is one of the following:
0 = No device.
2 = Phone line.
AT+VLS=? Always reporting "0,2"
AT+VLS? Show current line.
AT+VRX Start recording. Emulator responds with
CONNECT and starts sending audio data to
the application. See below for data format
AT+VSD=x,y Set silence-detection parameters.
Possible parameters:
x = 0 ... 31 sensitivity threshold level.
(default 0 , deactivated)
y = 0 ... 255 range of interval in units
of 0.1 second. (default 70)
AT+VSD=? Report possible parameters.
AT+VSD? Show current parameters.
AT+VDD=x,y Set DTMF-detection parameters.
Only possible if online and during this connection.
Possible parameters:
x = 0 ... 15 sensitivity threshold level.
(default 0 , I4L soft-decode)
(1-15 soft-decode off, hardware on)
y = 0 ... 255 tone duration in units of 5ms.
Not for I4L soft decode (default 8, 40ms)
AT+VDD=? Report possible parameters.
AT+VDD? Show current parameters.
AT+VSM=x Select audio data format.
Possible parameters:
2 = ADPCM-2
3 = ADPCM-3
4 = ADPCM-4
5 = aLAW
6 = uLAW
AT+VSM=? Show possible audio formats.
AT+VTX Start audio playback. Emulator responds
with CONNECT and starts sending audio data
received from the application via phone line.
General behavior and description of data formats/protocol.
when a connection is made:
On incoming calls, if the application responds to a RING
with ATA, depending on the calling service, the emulator
responds with either CONNECT (data call) or VCON (voice call).
On outgoing voice calls, the emulator responds with VCON
upon connection setup.
Audio recording.
When receiving audio data, a kind of bisync protocol is used.
Upon AT+VRX command, the emulator responds with CONNECT, and
starts sending audio data to the application. There are several
escape sequences defined, all using DLE (0x10) as Escape char:
<DLE><ETX> End of audio data. (i.e. caused by a
hangup of the remote side) Emulator stops
recording, responding with VCON.
<DLE><DC4> Abort recording, (send by appl.) Emulator
stops recording, sends DLE,ETX.
<DLE><DLE> Escape sequence for DLE in data stream.
<DLE>0 Touchtone "0" received.
...
<DLE>9 Touchtone "9" received.
<DLE># Touchtone "#" received.
<DLE>* Touchtone "*" received.
<DLE>A Touchtone "A" received.
<DLE>B Touchtone "B" received.
<DLE>C Touchtone "C" received.
<DLE>D Touchtone "D" received.
<DLE>q quiet. Silence detected after non-silence.
<DLE>s silence. Silence detected from the
start of recording.
Currently unsupported DLE sequences:
<DLE>c FAX calling tone received.
<DLE>b busy tone received.
Audio playback.
When sending audio data, upon AT+VTX command, emulator responds with
CONNECT, and starts transferring data from application to the phone line.
The same DLE sequences apply to this mode.
Full-Duplex-Audio:
When _both_ commands for recording and playback are given in _one_
AT-command-line (i.e.: "AT+VTX+VRX"), full-duplex-mode is selected.
In this mode, the only way to stop recording is sending <DLE><DC4>
and the only way to stop playback is to send <DLE><ETX>.

View File

@ -1,259 +0,0 @@
Description of the "concap" encapsulation protocol interface
============================================================
The "concap" interface is intended to be used by network device
drivers that need to process an encapsulation protocol.
It is assumed that the protocol interacts with a linux network device by
- data transmission
- connection control (establish, release)
Thus, the mnemonic: "CONnection CONtrolling eNCAPsulation Protocol".
This is currently only used inside the isdn subsystem. But it might
also be useful to other kinds of network devices. Thus, if you want
to suggest changes that improve usability or performance of the
interface, please let me know. I'm willing to include them in future
releases (even if I needed to adapt the current isdn code to the
changed interface).
Why is this useful?
===================
The encapsulation protocol used on top of WAN connections or permanent
point-to-point links are frequently chosen upon bilateral agreement.
Thus, a device driver for a certain type of hardware must support
several different encapsulation protocols at once.
The isdn device driver did already support several different
encapsulation protocols. The encapsulation protocol is configured by a
user space utility (isdnctrl). The isdn network interface code then
uses several case statements which select appropriate actions
depending on the currently configured encapsulation protocol.
In contrast, LAN network interfaces always used a single encapsulation
protocol which is unique to the hardware type of the interface. The LAN
encapsulation is usually done by just sticking a header on the data. Thus,
traditional linux network device drivers used to process the
encapsulation protocol directly (usually by just providing a hard_header()
method in the device structure) using some hardware type specific support
functions. This is simple, direct and efficient. But it doesn't fit all
the requirements for complex WAN encapsulations.
The configurability of the encapsulation protocol to be used
makes isdn network interfaces more flexible, but also much more
complex than traditional lan network interfaces.
Many Encapsulation protocols used on top of WAN connections will not just
stick a header on the data. They also might need to set up or release
the WAN connection. They also might want to send other data for their
private purpose over the wire, e.g. ppp does a lot of link level
negotiation before the first piece of user data can be transmitted.
Such encapsulation protocols for WAN devices are typically more complex
than encapsulation protocols for lan devices. Thus, network interface
code for typical WAN devices also tends to be more complex.
In order to support Linux' x25 PLP implementation on top of
isdn network interfaces I could have introduced yet another branch to
the various case statements inside drivers/isdn/isdn_net.c.
This eventually made isdn_net.c even more complex. In addition, it made
isdn_net.c harder to maintain. Thus, by identifying an abstract
interface between the network interface code and the encapsulation
protocol, complexity could be reduced and maintainability could be
increased.
Likewise, a similar encapsulation protocol will frequently be needed by
several different interfaces of even different hardware type, e.g. the
synchronous ppp implementation used by the isdn driver and the
asynchronous ppp implementation used by the ppp driver have a lot of
similar code in them. By cleanly separating the encapsulation protocol
from the hardware specific interface stuff such code could be shared
better in future.
When operating over dial-up-connections (e.g. telephone lines via modem,
non-permanent virtual circuits of wide area networks, ISDN) many
encapsulation protocols will need to control the connection. Therefore,
some basic connection control primitives are supported. The type and
semantics of the connection (i.e the ISO layer where connection service
is provided) is outside our scope and might be different depending on
the encapsulation protocol used, e.g. for a ppp module using our service
on top of a modem connection a connect_request will result in dialing
a (somewhere else configured) remote phone number. For an X25-interface
module (LAPB semantics, as defined in Documentation/networking/x25-iface.txt)
a connect_request will ask for establishing a reliable lapb
datalink connection.
The encapsulation protocol currently provides the following
service primitives to the network device.
- create a new encapsulation protocol instance
- delete encapsulation protocol instance and free all its resources
- initialize (open) the encapsulation protocol instance for use.
- deactivate (close) an encapsulation protocol instance.
- process (xmit) data handed down by upper protocol layer
- receive data from lower (hardware) layer
- process connect indication from lower (hardware) layer
- process disconnect indication from lower (hardware) layer
The network interface driver accesses those primitives via callbacks
provided by the encapsulation protocol instance within a
struct concap_proto_ops.
struct concap_proto_ops{
/* create a new encapsulation protocol instance of same type */
struct concap_proto * (*proto_new) (void);
/* delete encapsulation protocol instance and free all its resources.
cprot may no longer be referenced after calling this */
void (*proto_del)(struct concap_proto *cprot);
/* initialize the protocol's data. To be called at interface startup
or when the device driver resets the interface. All services of the
encapsulation protocol may be used after this*/
int (*restart)(struct concap_proto *cprot,
struct net_device *ndev,
struct concap_device_ops *dops);
/* deactivate an encapsulation protocol instance. The encapsulation
protocol may not call any *dops methods after this. */
int (*close)(struct concap_proto *cprot);
/* process a frame handed down to us by upper layer */
int (*encap_and_xmit)(struct concap_proto *cprot, struct sk_buff *skb);
/* to be called for each data entity received from lower layer*/
int (*data_ind)(struct concap_proto *cprot, struct sk_buff *skb);
/* to be called when a connection was set up/down.
Protocols that don't process these primitives might fill in
dummy methods here */
int (*connect_ind)(struct concap_proto *cprot);
int (*disconn_ind)(struct concap_proto *cprot);
};
The data structures are defined in the header file include/linux/concap.h.
A Network interface using encapsulation protocols must also provide
some service primitives to the encapsulation protocol:
- request data being submitted by lower layer (device hardware)
- request a connection being set up by lower layer
- request a connection being released by lower layer
The encapsulation protocol accesses those primitives via callbacks
provided by the network interface within a struct concap_device_ops.
struct concap_device_ops{
/* to request data be submitted by device */
int (*data_req)(struct concap_proto *, struct sk_buff *);
/* Control methods must be set to NULL by devices which do not
support connection control. */
/* to request a connection be set up */
int (*connect_req)(struct concap_proto *);
/* to request a connection be released */
int (*disconn_req)(struct concap_proto *);
};
The network interface does not explicitly provide a receive service
because the encapsulation protocol directly calls netif_rx().
An encapsulation protocol itself is actually the
struct concap_proto{
struct net_device *net_dev; /* net device using our service */
struct concap_device_ops *dops; /* callbacks provided by device */
struct concap_proto_ops *pops; /* callbacks provided by us */
int flags;
void *proto_data; /* protocol specific private data, to
be accessed via *pops methods only*/
/*
:
whatever
:
*/
};
Most of this is filled in when the device requests the protocol to
be reset (opend). The network interface must provide the net_dev and
dops pointers. Other concap_proto members should be considered private
data that are only accessed by the pops callback functions. Likewise,
a concap proto should access the network device's private data
only by means of the callbacks referred to by the dops pointer.
A possible extended device structure which uses the connection controlling
encapsulation services could look like this:
struct concap_device{
struct net_device net_dev;
struct my_priv /* device->local stuff */
/* the my_priv struct might contain a
struct concap_device_ops *dops;
to provide the device specific callbacks
*/
struct concap_proto *cprot; /* callbacks provided by protocol */
};
Misc Thoughts
=============
The concept of the concap proto might help to reuse protocol code and
reduce the complexity of certain network interface implementations.
The trade off is that it introduces yet another procedure call layer
when processing the protocol. This has of course some impact on
performance. However, typically the concap interface will be used by
devices attached to slow lines (like telephone, isdn, leased synchronous
lines). For such slow lines, the overhead is probably negligible.
This might no longer hold for certain high speed WAN links (like
ATM).
If general linux network interfaces explicitly supported concap
protocols (e.g. by a member struct concap_proto* in struct net_device)
then the interface of the service function could be changed
by passing a pointer of type (struct net_device*) instead of
type (struct concap_proto*). Doing so would make many of the service
functions compatible to network device support functions.
e.g. instead of the concap protocol's service function
int (*encap_and_xmit)(struct concap_proto *cprot, struct sk_buff *skb);
we could have
int (*encap_and_xmit)(struct net_device *ndev, struct sk_buff *skb);
As this is compatible to the dev->hard_start_xmit() method, the device
driver could directly register the concap protocol's encap_and_xmit()
function as its hard_start_xmit() method. This would eliminate one
procedure call layer.
The device's data request function could also be defined as
int (*data_req)(struct net_device *ndev, struct sk_buff *skb);
This might even allow for some protocol stacking. And the network
interface might even register the same data_req() function directly
as its hard_start_xmit() method when a zero layer encapsulation
protocol is configured. Thus, eliminating the performance penalty
of the concap interface when a trivial concap protocol is used.
Nevertheless, the device remains able to support encapsulation
protocol configuration.

View File

@ -1,127 +0,0 @@
The isdn diversion services are a supporting module working together with
the isdn4linux and the HiSax module for passive cards.
Active cards, TAs and cards using a own or other driver than the HiSax
module need to be adapted to the HL<->LL interface described in a separate
document. The diversion services may be used with all cards supported by
the HiSax driver.
The diversion kernel interface and controlling tool divertctrl were written
by Werner Cornelius (werner@isdn4linux.de or werner@titro.de) under the
GNU General Public License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Table of contents
=================
1. Features of the i4l diversion services
(Or what can the i4l diversion services do for me)
2. Required hard- and software
3. Compiling, installing and loading/unloading the module
Tracing calling and diversion information
4. Tracing calling and diversion information
5. Format of the divert device ASCII output
1. Features of the i4l diversion services
(Or what can the i4l diversion services do for me)
The i4l diversion services offers call forwarding and logging normally
only supported by isdn phones. Incoming calls may be diverted
unconditionally (CFU), when not reachable (CFNR) or on busy condition
(CFB).
The diversions may be invoked statically in the providers exchange
as normally done by isdn phones. In this case all incoming calls
with a special (or all) service identifiers are forwarded if the
forwarding reason is met. Activated static services may also be
interrogated (queried).
The i4l diversion services additionally offers a dynamic version of
call forwarding which is not preprogrammed inside the providers exchange
but dynamically activated by i4l.
In this case all incoming calls are checked by rules that may be
compared to the mechanism of ipfwadm or ipchains. If a given rule matches
the checking process is finished and the rule matching will be applied
to the call.
The rules include primary and secondary service identifiers, called
number and subaddress, callers number and subaddress and whether the rule
matches to all filtered calls or only those when all B-channel resources
are exhausted.
Actions that may be invoked by a rule are ignore, proceed, reject,
direct divert or delayed divert of a call.
All incoming calls matching a rule except the ignore rule a reported and
logged as ASCII via the proc filesystem (/proc/net/isdn/divert). If proceed
is selected the call will be held in a proceeding state (without ringing)
for a certain amount of time to let an external program or client decide
how to handle the call.
2. Required hard- and software
For using the i4l diversion services the isdn line must be of a EURO/DSS1
type. Additionally the i4l services only work together with the HiSax
driver for passive isdn cards. All HiSax supported cards may be used for
the diversion purposes.
The static diversion services require the provider having static services
CFU, CFNR, CFB activated on an MSN-line. The static services may not be
used on a point-to-point connection. Further the static services are only
available in some countries (for example germany). Countries requiring the
keypad protocol for activating static diversions (like the netherlands) are
not supported but may use the tty devices for this purpose.
The dynamic diversion services may be used in all countries if the provider
enables the feature CF (call forwarding). This should work on both MSN- and
point-to-point lines.
To add and delete rules the additional divertctrl program is needed. This
program is part of the isdn4kutils package.
3. Compiling, installing and loading/unloading the module
Tracing calling and diversion information
To compile the i4l code with diversion support you need to say yes to the
DSS1 diversion services when selecting the i4l options in the kernel
config (menuconfig or config).
After having properly activated a make modules and make modules_install all
required modules will be correctly installed in the needed modules dirs.
As the diversion services are currently not included in the scripts of most
standard distributions you will have to add a "insmod dss1_divert" after
having loaded the global isdn module.
The module can be loaded without any command line parameters.
If the module is actually loaded and active may be checked with a
"cat /proc/modules" or "ls /proc/net/isdn/divert". The divert file is
dynamically created by the diversion module and removed when the module is
unloaded.
4. Tracing calling and diversion information
You also may put a "cat /proc/net/isdn/divert" in the background with the
output redirected to a file. Then all actions of the module are logged.
The divert file in the proc system may be opened more than once, so in
conjunction with inetd and a small remote client on other machines inside
your network incoming calls and reactions by the module may be shown on
every listening machine.
If a call is reported as proceeding an external program or client may
specify during a certain amount of time (normally 4 to 10 seconds) what
to do with that call.
To unload the module all open files to the device in the proc system must
be closed. Otherwise the module (and isdn.o) may not be unloaded.
5. Format of the divert device ASCII output
To be done later

View File

@ -1,45 +0,0 @@
Fax with isdn4linux
===================
When enabled during kernel configuration, the tty emulator
of the ISDN subsystem is capable of the Fax Class 2 commands.
This only makes sense under the following conditions :
- You need the commands as dummy, because you are using
hylafax (with patch) for AVM capi.
- You want to use the fax capabilities of your isdn-card.
(supported cards are listed below)
NOTE: This implementation does *not* support fax with passive
ISDN-cards (known as softfax). The low-level driver of
the ISDN-card and/or the card itself must support this.
Supported ISDN-Cards
--------------------
Eicon DIVA Server BRI/PCI
- full support with both B-channels.
Eicon DIVA Server 4BRI/PCI
- full support with all B-channels.
Eicon DIVA Server PRI/PCI
- full support on amount of B-channels
depending on DSPs on board.
The command set is known as Class 2 (not Class 2.0) and
can be activated by AT+FCLASS=2
The interface between the link-level-module and the hardware-level driver
is described in the files INTERFACE.fax and INTERFACE.
Armin
mac@melware.de

View File

@ -1,41 +0,0 @@
The driver for the HFC-PCI and HFC-PCI-A chips from CCD may be used
for many OEM cards using this chips.
Additionally the driver has a special feature which makes it possible
to read the echo-channel of the isdn bus. So all frames in both directions
may be logged.
When the echo logging feature is used the number of available B-channels
for a HFC-PCI card is reduced to 1. Of course this is only relevant to
the card, not to the isdn line.
To activate the echo mode the following ioctls must be entered:
hisaxctrl <driver/cardname> 10 1
This reduces the available channels to 1. There must not be open connections
through this card when entering the command.
And then:
hisaxctrl <driver/cardname> 12 1
This enables the echo mode. If Hex logging is activated the isdnctrlx
devices show a output with a line beginning of HEX: for the providers
exchange and ECHO: for isdn devices sending to the provider.
If more than one HFC-PCI cards are installed, a specific card may be selected
at the hisax module load command line. Supply the load command with the desired
IO-address of the desired card.
Example:
There tree cards installed in your machine at IO-base addresses 0xd000, 0xd400
and 0xdc00
If you want to use the card at 0xd400 standalone you should supply the insmod
or depmod with type=35 io=0xd400.
If you want to use all three cards, but the order needs to be at 0xdc00,0xd400,
0xd000 you may give the parameters type=35,35,35 io=0xdc00,0xd400,0xd00
Then the desired card will be the initialised in the desired order.
If the io parameter is used the io addresses of all used cards should be
supplied else the parameter is assumed 0 and a auto search for a free card is
invoked which may not give the wanted result.
Comments and reports to werner@isdn4linux.de or werner@isdn-development.de

View File

@ -1,58 +0,0 @@
Some additional information for setting up a syncPPP
connection using network interfaces.
---------------------------------------------------------------
You need one thing beside the isdn4linux package:
a patched pppd .. (I called it ipppd to show the difference)
Compiling isdn4linux with sync PPP:
-----------------------------------
To compile isdn4linux with the sync PPP part, you have
to answer the appropriate question when doing a "make config"
Don't forget to load the slhc.o
module before the isdn.o module, if VJ-compression support
is not compiled into your kernel. (e.g if you have no PPP or
CSLIP in the kernel)
Using isdn4linux with sync PPP:
-------------------------------
Sync PPP is just another encapsulation for isdn4linux. The
name to enable sync PPP encapsulation is 'syncppp' .. e.g:
/sbin/isdnctrl encap ippp0 syncppp
The name of the interface is here 'ippp0'. You need
one interface with the name 'ippp0' to saturate the
ipppd, which checks the ppp version via this interface.
Currently, all devices must have the name ipppX where
'X' is a decimal value.
To set up a PPP connection you need the ipppd .. You must start
the ipppd once after installing the modules. The ipppd
communicates with the isdn4linux link-level driver using the
/dev/ippp0 to /dev/ippp15 devices. One ipppd can handle
all devices at once. If you want to use two PPP connections
at the same time, you have to connect the ipppd to two
devices .. and so on.
I've implemented one additional option for the ipppd:
'useifip' will get (if set to not 0.0.0.0) the IP address
for the negotiation from the attached network-interface.
(also: ipppd will try to negotiate pointopoint IP as remote IP)
You must disable BSD-compression, this implementation can't
handle compressed packets.
Check the etc/rc.isdn.syncppp in the isdn4kernel-util package
for an example setup script.
To use the MPPP stuff, you must configure a slave device
with isdn4linux. Now call the ipppd with the '+mp' option.
To increase the number of links, you must use the
'addlink' option of the isdnctrl tool. (rc.isdn.syncppp.MPPP is
an example script)
enjoy it,
michael

View File

@ -1,184 +0,0 @@
X.25 support within isdn4linux
==============================
This is alpha/beta test code. Use it completely at your own risk.
As new versions appear, the stuff described here might suddenly change
or become invalid without notice.
Keep in mind:
You are using several new parts of the 2.2.x kernel series which
have not been tested in a large scale. Therefore, you might encounter
more bugs as usual.
- If you connect to an X.25 neighbour not operated by yourself, ASK the
other side first. Be prepared that bugs in the protocol implementation
might result in problems.
- This implementation has never wiped out my whole hard disk yet. But as
this is experimental code, don't blame me if that happened to you.
Backing up important data will never harm.
- Monitor your isdn connections while using this software. This should
prevent you from undesired phone bills in case of driver problems.
How to configure the kernel
===========================
The ITU-T (former CCITT) X.25 network protocol layer has been implemented
in the Linux source tree since version 2.1.16. The isdn subsystem might be
useful to run X.25 on top of ISDN. If you want to try it, select
"CCITT X.25 Packet Layer"
from the networking options as well as
"ISDN Support" and "X.25 PLP on Top of ISDN"
from the ISDN subsystem options when you configure your kernel for
compilation. You currently also need to enable
"Prompt for development and/or incomplete code/drivers" from the
"Code maturity level options" menu. For the x25trace utility to work
you also need to enable "Packet socket".
For local testing it is also recommended to enable the isdnloop driver
from the isdn subsystem's configuration menu.
For testing, it is recommended that all isdn drivers and the X.25 PLP
protocol are compiled as loadable modules. Like this, you can recover
from certain errors by simply unloading and reloading the modules.
What's it for? How to use it?
=============================
X.25 on top of isdn might be useful with two different scenarios:
- You might want to access a public X.25 data network from your Linux box.
You can use i4l if you were physically connected to the X.25 switch
by an ISDN B-channel (leased line as well as dial up connection should
work).
This corresponds to ITU-T recommendation X.31 Case A (circuit-mode
access to PSPDN [packet switched public data network]).
NOTE: X.31 also covers a Case B (access to PSPDN via virtual
circuit / packet mode service). The latter mode (which in theory
also allows using the D-channel) is not supported by isdn4linux.
It should however be possible to establish such packet mode connections
with certain active isdn cards provided that the firmware supports X.31
and the driver exports this functionality to the user. Currently,
the AVM B1 driver is the only driver which does so. (It should be
possible to access D-channel X.31 with active AVM cards using the
CAPI interface of the AVM-B1 driver).
- Or you might want to operate certain ISDN teleservices on your linux
box. A lot of those teleservices run on top of the ISO-8208
(DTE-DTE mode) network layer protocol. ISO-8208 is essentially the
same as ITU-T X.25.
Popular candidates of such teleservices are EUROfile transfer or any
teleservice applying ITU-T recommendation T.90.
To use the X.25 protocol on top of isdn, just create an isdn network
interface as usual, configure your own and/or peer's ISDN numbers,
and choose x25iface encapsulation by
isdnctrl encap <iface-name> x25iface.
Once encap is set like this, the device can be used by the X.25 packet layer.
All the stuff needed for X.25 is implemented inside the isdn link
level (mainly isdn_net.c and some new source files). Thus, it should
work with every existing HL driver. I was able to successfully open X.25
connections on top of the isdnloop driver and the hisax driver.
"x25iface"-encapsulation bypasses demand dialing. Dialing will be
initiated when the upper (X.25 packet) layer requests the lapb datalink to
be established. But hangup timeout is still active. Whenever a hangup
occurs, all existing X.25 connections on that link will be cleared
It is recommended to use sufficiently large hangup-timeouts for the
isdn interfaces.
In order to set up a conforming protocol stack you also need to
specify the proper l2_prot parameter:
To operate in ISO-8208 X.25 DTE-DTE mode, use
isdnctrl l2_prot <iface-name> x75i
To access an X.25 network switch via isdn (your linux box is the DTE), use
isdnctrl l2_prot <iface-name> x25dte
To mimic an X.25 network switch (DCE side of the connection), use
isdnctrl l2_prot <iface-name> x25dce
However, x25dte or x25dce is currently not supported by any real HL
level driver. The main difference between x75i and x25dte/dce is that
x25d[tc]e uses fixed lap_b addresses. With x75i, the side which
initiates the isdn connection uses the DTE's lap_b address while the
called side used the DCE's lap_b address. Thus, l2_prot x75i might
probably work if you access a public X.25 network as long as the
corresponding isdn connection is set up by you. At least one test
was successful to connect via isdn4linux to an X.25 switch using this
trick. At the switch side, a terminal adapter X.21 was used to connect
it to the isdn.
How to set up a test installation?
==================================
To test X.25 on top of isdn, you need to get
- a recent version of the "isdnctrl" program that supports setting the new
X.25 specific parameters.
- the x25-utils-2.X package from
ftp://ftp.hes.iki.fi/pub/ham/linux/ax25/x25utils-*
(don't confuse the x25-utils with the ax25-utils)
- an application program that uses linux PF_X25 sockets (some are
contained in the x25-util package).
Before compiling the user level utilities make sure that the compiler/
preprocessor will fetch the proper kernel header files of this kernel
source tree. Either make /usr/include/linux a symbolic link pointing to
this kernel's include/linux directory or set the appropriate compiler flags.
When all drivers and interfaces are loaded and configured you need to
ifconfig the network interfaces up and add X.25-routes to them. Use
the usual ifconfig tool.
ifconfig <iface-name> up
But a special x25route tool (distributed with the x25-util package)
is needed to set up X.25 routes. I.e.
x25route add 01 <iface-name>
will cause all x.25 connections to the destination X.25-address
"01" to be routed to your created isdn network interface.
There are currently no real X.25 applications available. However, for
tests, the x25-utils package contains a modified version of telnet
and telnetd that uses X.25 sockets instead of tcp/ip sockets. You can
use those for your first tests. Furthermore, you might check
ftp://ftp.hamburg.pop.de/pub/LOCAL/linux/i4l-eft/ which contains some
alpha-test implementation ("eftp4linux") of the EUROfile transfer
protocol.
The scripts distributed with the eftp4linux test releases might also
provide useful examples for setting up X.25 on top of isdn.
The x25-utility package also contains an x25trace tool that can be
used to monitor X.25 packets received by the network interfaces.
The /proc/net/x25* files also contain useful information.
- Henner

View File

@ -1,224 +0,0 @@
simple isdn4linux PPP FAQ .. to be continued .. not 'debugged'
-------------------------------------------------------------------
Q01: what's pppd, ipppd, syncPPP, asyncPPP ??
Q02: error message "this system lacks PPP support"
Q03: strange information using 'ifconfig'
Q04: MPPP?? What's that and how can I use it ...
Q05: I tried MPPP but it doesn't work
Q06: can I use asynchronous PPP encapsulation with network devices
Q07: A SunISDN machine can't connect to my i4l system
Q08: I wanna talk to several machines, which need different configs
Q09: Starting the ipppd, I get only error messages from i4l
Q10: I wanna use dynamic IP address assignment
Q11: I can't connect. How can I check where the problem is.
Q12: How can I reduce login delay?
-------------------------------------------------------------------
Q01: pppd, ipppd, syncPPP, asyncPPP .. what is that ?
what should I use?
A: The pppd is for asynchronous PPP .. asynchronous means
here, the framing is character based. (e.g when
using ttyI* or tty* devices)
The ipppd handles PPP packets coming in HDLC
frames (bit based protocol) ... The PPP driver
in isdn4linux pushes all IP packets direct
to the network layer and all PPP protocol
frames to the /dev/ippp* device.
So, the ipppd is a simple external network
protocol handler.
If you login into a remote machine using the
/dev/ttyI* devices and then enable PPP on the
remote terminal server -> use the 'old' pppd
If your remote side immediately starts to send
frames ... you probably connect to a
syncPPP machine .. use the network device part
of isdn4linux with the 'syncppp' encapsulation
and make sure, that the ipppd is running and
connected to at least one /dev/ippp*. Check the
isdn4linux manual on how to configure a network device.
--
Q02: when I start the ipppd .. I only get the
error message "this system lacks PPP support"
A: check that at least the device 'ippp0' exists.
(you can check this e.g with the program 'ifconfig')
The ipppd NEEDS this device under THIS name ..
If this device doesn't exists, use:
isdnctrl addif ippp0
isdnctrl encap ippp0 syncppp
... (see isdn4linux doc for more) ...
A: Maybe you have compiled the ipppd with another
kernel source tree than the kernel you currently
run ...
--
Q03: when I list the netdevices with ifconfig I see, that
my ISDN interface has a HWaddr and IRQ=0 and Base
address = 0
A: The device is a fake ethernet device .. ignore IRQ and baseaddr
You need the HWaddr only for ethernet encapsulation.
--
Q04: MPPP?? What's that and how can I use it ...
A: MPPP or MP or MPP (Warning: MP is also an
acronym for 'Multi Processor') stands for
Multi Point to Point and means bundling
of several channels to one logical stream.
To enable MPPP negotiation you must call the
ipppd with the '+mp' option.
You must also configure a slave device for
every additional channel. (see the i4l manual
for more)
To use channel bundling you must first activate
the 'master' or initial call. Now you can add
the slave channels with the command:
isdnctrl addlink <device>
e.g:
isdnctrl addlink ippp0
This is different from other encapsulations of
isdn4linux! With syncPPP, there is no automatic
activation of slave devices.
--
Q05: I tried MPPP but it doesn't work .. the ipppd
writes in the debug log something like:
.. rcvd [0][proto=0x3d] c0 00 00 00 80 fd 01 01 00 0a ...
.. sent [0][LCP ProtRej id=0x2 00 3d c0 00 00 00 80 fd 01 ...
A: you forgot to compile MPPP/RFC1717 support into the
ISDN Subsystem. Recompile with this option enabled.
--
Q06: can I use asynchronous PPP encapsulation
over the network interface of isdn4linux ..
A: No .. that's not possible .. Use the standard
PPP package over the /dev/ttyI* devices. You
must not use the ipppd for this.
--
Q07: A SunISDN machine tries to connect my i4l system,
which doesn't work.
Checking the debug log I just saw garbage like:
!![ ... fill in the line ... ]!!
A: The Sun tries to talk asynchronous PPP ... i4l
can't understand this ... try to use the ttyI*
devices with the standard PPP/pppd package
A: (from Alexanter Strauss: )
!![ ... fill in mail ]!!
--
Q08: I wanna talk to remote machines, which need
a different configuration. The only way
I found to do this is to kill the ipppd and
start a new one with another config to connect
to the second machine.
A: you must bind a network interface explicitly to
an ippp device, where you can connect a (for this
interface) individually configured ipppd.
--
Q09: When I start the ipppd I only get error messages
from the i4l driver ..
A: When starting, the ipppd calls functions which may
trigger a network packet. (e.g gethostbyname()).
Without the ipppd (at this moment, it is not
fully started) we can't handle this network request.
Try to configure hostnames necessary for the ipppd
in your local /etc/hosts file or in a way, that
your system can resolve it without using an
isdn/ippp network-interface.
--
Q10: I wanna use dynamic IP address assignment ... How
must I configure the network device.
A: At least you must have a route which forwards
a packet to the ippp network-interface to trigger
the dial-on-demand.
A default route to the ippp-interface will work.
Now you must choose a dummy IP address for your
interface.
If for some reason you can't set the default
route to the ippp interface, you may take any
address of the subnet from which you expect your
dynamic IP number and set a 'network route' for
this subnet to the ippp interface.
To allow overriding of the dummy address you
must call the ipppd with the 'ipcp-accept-local' option.
A: You must know, how the ipppd gets the addresses it wanna
configure. If you don't give any option, the ipppd
tries to negotiate the local host address!
With the option 'noipdefault' it requests an address
from the remote machine. With 'useifip' it gets the
addresses from the net interface. Or you set the address
on the option line with the <a.b.c.d:e.f.g.h> option.
Note: the IP address of the remote machine must be configured
locally or the remote machine must send it in an IPCP request.
If your side doesn't know the IP address after negotiation, it
closes the connection!
You must allow overriding of address with the 'ipcp-accept-*'
options, if you have set your own or the remote address
explicitly.
A: Maybe you try these options .. e.g:
/sbin/ipppd :$REMOTE noipdefault /dev/ippp0
where REMOTE must be the address of the remote machine (the
machine, which gives you your address)
--
Q11: I can't connect. How can I check where the problem is.
A: A good help log is the debug output from the ipppd...
Check whether you can find there:
- only a few LCP-conf-req SENT messages (less then 10)
and then a Term-REQ:
-> check whether your ISDN card is well configured
it seems, that your machine doesn't dial
(IRQ,IO,Proto, etc problems)
Configure your ISDN card to print debug messages and
check the /dev/isdnctrl output next time. There
you can see, whether there is activity on the card/line.
- there are at least a few RECV messages in the log:
-> fine: your card is dialing and your remote machine
tries to talk with you. Maybe only a missing
authentication. Check your ipppd configuration again.
- the ipppd exits for some reason:
-> not good ... check /var/adm/syslog and /var/adm/daemon.
Could be a bug in the ipppd.
--
Q12: How can I reduce login delay?
A: Log a login session ('debug' log) and check which options
your remote side rejects. Next time configure your ipppd
to not negotiate these options. Another 'side effect' is, that
this increases redundancy. (e.g your remote side is buggy and
rejects options in a wrong way).

View File

@ -23,8 +23,8 @@ running, the suggested command should tell you.
Again, keep in mind that this list assumes you are already functionally
running a Linux kernel. Also, not all tools are necessary on all
systems; obviously, if you don't have any ISDN hardware, for example,
you probably needn't concern yourself with isdn4k-utils.
systems; obviously, if you don't have any PC Card hardware, for example,
you probably needn't concern yourself with pcmciautils.
====================== =============== ========================================
Program Minimal version Command to check the version
@ -45,7 +45,6 @@ btrfs-progs 0.18 btrfsck
pcmciautils 004 pccardctl -V
quota-tools 3.09 quota -V
PPP 2.4.0 pppd --version
isdn4k-utils 3.1pre1 isdnctrl 2>&1|grep version
nfs-utils 1.0.5 showmount --version
procps 3.2.0 ps --version
oprofile 0.9 oprofiled --version
@ -279,12 +278,6 @@ which can be made by::
as root.
Isdn4k-utils
------------
Due to changes in the length of the phone number field, isdn4k-utils
needs to be recompiled or (preferably) upgraded.
NFS-utils
---------
@ -448,11 +441,6 @@ PPP
- <ftp://ftp.samba.org/pub/ppp/>
Isdn4k-utils
------------
- <ftp://ftp.isdn4linux.de/pub/isdn4linux/utils/>
NFS-utils
---------

View File

@ -8371,9 +8371,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/kkeil/isdn-2.6.git
S: Maintained
F: Documentation/isdn/
F: drivers/isdn/
F: include/linux/isdn.h
F: include/linux/isdn/
F: include/uapi/linux/isdn.h
F: include/uapi/linux/isdn/
IT87 HARDWARE MONITORING DRIVER

View File

@ -21,27 +21,6 @@ menuconfig ISDN
if ISDN
menuconfig ISDN_I4L
tristate "Old ISDN4Linux (deprecated)"
depends on TTY
---help---
This driver allows you to use an ISDN adapter for networking
connections and as dialin/out device. The isdn-tty's have a built
in AT-compatible modem emulator. Network devices support autodial,
channel-bundling, callback and caller-authentication without having
a daemon running. A reduced T.70 protocol is supported with tty's
suitable for German BTX. On D-Channel, the protocols EDSS1
(Euro-ISDN) and 1TR6 (German style) are supported. See
<file:Documentation/isdn/README> for more information.
ISDN support in the linux kernel is moving towards a new API,
called CAPI (Common ISDN Application Programming Interface).
Therefore the old ISDN4Linux layer will eventually become obsolete.
It is still available, though, for use with adapters that are not
supported by the new CAPI subsystem yet.
source "drivers/isdn/i4l/Kconfig"
menuconfig ISDN_CAPI
tristate "CAPI 2.0 subsystem"
help
@ -71,9 +50,4 @@ source "drivers/isdn/hysdn/Kconfig"
source "drivers/isdn/mISDN/Kconfig"
config ISDN_HDLC
tristate
select CRC_CCITT
select BITREVERSE
endif # ISDN

View File

@ -7,7 +7,5 @@ obj-$(CONFIG_ISDN_I4L) += i4l/
obj-$(CONFIG_ISDN_CAPI) += capi/
obj-$(CONFIG_MISDN) += mISDN/
obj-$(CONFIG_ISDN) += hardware/
obj-$(CONFIG_ISDN_DIVERSION) += divert/
obj-$(CONFIG_ISDN_DRV_LOOP) += isdnloop/
obj-$(CONFIG_HYSDN) += hysdn/
obj-$(CONFIG_ISDN_DRV_GIGASET) += gigaset/

View File

@ -27,15 +27,6 @@ config ISDN_CAPI_MIDDLEWARE
device. If you want to use pppd with pppdcapiplugin to dial up to
your ISP, say Y here.
config ISDN_CAPI_CAPIDRV
tristate "CAPI2.0 capidrv interface support"
depends on ISDN_I4L
help
This option provides the glue code to hook up CAPI driven cards to
the legacy isdn4linux link layer. If you have a card which is
supported by a CAPI driver, but still want to use old features like
ippp interfaces or ttyI emulation, say Y/M here.
config ISDN_CAPI_CAPIDRV_VERBOSE
bool "Verbose reason code reporting"
depends on ISDN_CAPI_CAPIDRV

File diff suppressed because it is too large Load Diff

View File

@ -1,140 +0,0 @@
/* $Id: capidrv.h,v 1.2.8.2 2001/09/23 22:24:33 kai Exp $
*
* ISDN4Linux Driver, using capi20 interface (kernelcapi)
*
* Copyright 1997 by Carsten Paeth <calle@calle.de>
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#ifndef __CAPIDRV_H__
#define __CAPIDRV_H__
/*
* LISTEN state machine
*/
#define ST_LISTEN_NONE 0 /* L-0 */
#define ST_LISTEN_WAIT_CONF 1 /* L-0.1 */
#define ST_LISTEN_ACTIVE 2 /* L-1 */
#define ST_LISTEN_ACTIVE_WAIT_CONF 3 /* L-1.1 */
#define EV_LISTEN_REQ 1 /* L-0 -> L-0.1
L-1 -> L-1.1 */
#define EV_LISTEN_CONF_ERROR 2 /* L-0.1 -> L-0
L-1.1 -> L-1 */
#define EV_LISTEN_CONF_EMPTY 3 /* L-0.1 -> L-0
L-1.1 -> L-0 */
#define EV_LISTEN_CONF_OK 4 /* L-0.1 -> L-1
L-1.1 -> L.1 */
/*
* per plci state machine
*/
#define ST_PLCI_NONE 0 /* P-0 */
#define ST_PLCI_OUTGOING 1 /* P-0.1 */
#define ST_PLCI_ALLOCATED 2 /* P-1 */
#define ST_PLCI_ACTIVE 3 /* P-ACT */
#define ST_PLCI_INCOMING 4 /* P-2 */
#define ST_PLCI_FACILITY_IND 5 /* P-3 */
#define ST_PLCI_ACCEPTING 6 /* P-4 */
#define ST_PLCI_DISCONNECTING 7 /* P-5 */
#define ST_PLCI_DISCONNECTED 8 /* P-6 */
#define ST_PLCI_RESUMEING 9 /* P-0.Res */
#define ST_PLCI_RESUME 10 /* P-Res */
#define ST_PLCI_HELD 11 /* P-HELD */
#define EV_PLCI_CONNECT_REQ 1 /* P-0 -> P-0.1
*/
#define EV_PLCI_CONNECT_CONF_ERROR 2 /* P-0.1 -> P-0
*/
#define EV_PLCI_CONNECT_CONF_OK 3 /* P-0.1 -> P-1
*/
#define EV_PLCI_FACILITY_IND_UP 4 /* P-0 -> P-1
*/
#define EV_PLCI_CONNECT_IND 5 /* P-0 -> P-2
*/
#define EV_PLCI_CONNECT_ACTIVE_IND 6 /* P-1 -> P-ACT
*/
#define EV_PLCI_CONNECT_REJECT 7 /* P-2 -> P-5
P-3 -> P-5
*/
#define EV_PLCI_DISCONNECT_REQ 8 /* P-1 -> P-5
P-2 -> P-5
P-3 -> P-5
P-4 -> P-5
P-ACT -> P-5
P-Res -> P-5 (*)
P-HELD -> P-5 (*)
*/
#define EV_PLCI_DISCONNECT_IND 9 /* P-1 -> P-6
P-2 -> P-6
P-3 -> P-6
P-4 -> P-6
P-5 -> P-6
P-ACT -> P-6
P-Res -> P-6 (*)
P-HELD -> P-6 (*)
*/
#define EV_PLCI_FACILITY_IND_DOWN 10 /* P-0.1 -> P-5
P-1 -> P-5
P-ACT -> P-5
P-2 -> P-5
P-3 -> P-5
P-4 -> P-5
*/
#define EV_PLCI_DISCONNECT_RESP 11 /* P-6 -> P-0
*/
#define EV_PLCI_CONNECT_RESP 12 /* P-6 -> P-0
*/
#define EV_PLCI_RESUME_REQ 13 /* P-0 -> P-0.Res
*/
#define EV_PLCI_RESUME_CONF_OK 14 /* P-0.Res -> P-Res
*/
#define EV_PLCI_RESUME_CONF_ERROR 15 /* P-0.Res -> P-0
*/
#define EV_PLCI_RESUME_IND 16 /* P-Res -> P-ACT
*/
#define EV_PLCI_HOLD_IND 17 /* P-ACT -> P-HELD
*/
#define EV_PLCI_RETRIEVE_IND 18 /* P-HELD -> P-ACT
*/
#define EV_PLCI_SUSPEND_IND 19 /* P-ACT -> P-5
*/
#define EV_PLCI_CD_IND 20 /* P-2 -> P-5
*/
/*
* per ncci state machine
*/
#define ST_NCCI_PREVIOUS -1
#define ST_NCCI_NONE 0 /* N-0 */
#define ST_NCCI_OUTGOING 1 /* N-0.1 */
#define ST_NCCI_INCOMING 2 /* N-1 */
#define ST_NCCI_ALLOCATED 3 /* N-2 */
#define ST_NCCI_ACTIVE 4 /* N-ACT */
#define ST_NCCI_RESETING 5 /* N-3 */
#define ST_NCCI_DISCONNECTING 6 /* N-4 */
#define ST_NCCI_DISCONNECTED 7 /* N-5 */
#define EV_NCCI_CONNECT_B3_REQ 1 /* N-0 -> N-0.1 */
#define EV_NCCI_CONNECT_B3_IND 2 /* N-0 -> N.1 */
#define EV_NCCI_CONNECT_B3_CONF_OK 3 /* N-0.1 -> N.2 */
#define EV_NCCI_CONNECT_B3_CONF_ERROR 4 /* N-0.1 -> N.0 */
#define EV_NCCI_CONNECT_B3_REJECT 5 /* N-1 -> N-4 */
#define EV_NCCI_CONNECT_B3_RESP 6 /* N-1 -> N-2 */
#define EV_NCCI_CONNECT_B3_ACTIVE_IND 7 /* N-2 -> N-ACT */
#define EV_NCCI_RESET_B3_REQ 8 /* N-ACT -> N-3 */
#define EV_NCCI_RESET_B3_IND 9 /* N-3 -> N-ACT */
#define EV_NCCI_DISCONNECT_B3_IND 10 /* N-4 -> N.5 */
#define EV_NCCI_DISCONNECT_B3_CONF_ERROR 11 /* N-4 -> previous */
#define EV_NCCI_DISCONNECT_B3_REQ 12 /* N-1 -> N-4
N-2 -> N-4
N-3 -> N-4
N-ACT -> N-4 */
#define EV_NCCI_DISCONNECT_B3_RESP 13 /* N-5 -> N-0 */
#endif /* __CAPIDRV_H__ */

View File

@ -1,10 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-only
# Makefile for the dss1_divert ISDN module
# Each configuration option enables a list of files.
obj-$(CONFIG_ISDN_DIVERSION) += dss1_divert.o
# Multipart objects.
dss1_divert-y := isdn_divert.o divert_procfs.o divert_init.o

View File

@ -1,82 +0,0 @@
/* $Id divert_init.c,v 1.5.6.2 2001/01/24 22:18:17 kai Exp $
*
* Module init for DSS1 diversion services for i4l.
*
* Copyright 1999 by Werner Cornelius (werner@isdn4linux.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include "isdn_divert.h"
MODULE_DESCRIPTION("ISDN4Linux: Call diversion support");
MODULE_AUTHOR("Werner Cornelius");
MODULE_LICENSE("GPL");
/****************************************/
/* structure containing interface to hl */
/****************************************/
isdn_divert_if divert_if = {
DIVERT_IF_MAGIC, /* magic value */
DIVERT_CMD_REG, /* register cmd */
ll_callback, /* callback routine from ll */
NULL, /* command still not specified */
NULL, /* drv_to_name */
NULL, /* name_to_drv */
};
/*************************/
/* Module interface code */
/* no cmd line parms */
/*************************/
static int __init divert_init(void)
{
int i;
if (divert_dev_init()) {
printk(KERN_WARNING "dss1_divert: cannot install device, not loaded\n");
return (-EIO);
}
if ((i = DIVERT_REG_NAME(&divert_if)) != DIVERT_NO_ERR) {
divert_dev_deinit();
printk(KERN_WARNING "dss1_divert: error %d registering module, not loaded\n", i);
return (-EIO);
}
printk(KERN_INFO "dss1_divert module successfully installed\n");
return (0);
}
/**********************/
/* Module deinit code */
/**********************/
static void __exit divert_exit(void)
{
unsigned long flags;
int i;
spin_lock_irqsave(&divert_lock, flags);
divert_if.cmd = DIVERT_CMD_REL; /* release */
if ((i = DIVERT_REG_NAME(&divert_if)) != DIVERT_NO_ERR) {
printk(KERN_WARNING "dss1_divert: error %d releasing module\n", i);
spin_unlock_irqrestore(&divert_lock, flags);
return;
}
if (divert_dev_deinit()) {
printk(KERN_WARNING "dss1_divert: device busy, remove cancelled\n");
spin_unlock_irqrestore(&divert_lock, flags);
return;
}
spin_unlock_irqrestore(&divert_lock, flags);
deleterule(-1); /* delete all rules and free mem */
deleteprocs();
printk(KERN_INFO "dss1_divert module successfully removed \n");
}
module_init(divert_init);
module_exit(divert_exit);

View File

@ -1,336 +0,0 @@
/* $Id: divert_procfs.c,v 1.11.6.2 2001/09/23 22:24:36 kai Exp $
*
* Filesystem handling for the diversion supplementary services.
*
* Copyright 1998 by Werner Cornelius (werner@isdn4linux.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#include <linux/module.h>
#include <linux/poll.h>
#include <linux/slab.h>
#ifdef CONFIG_PROC_FS
#include <linux/proc_fs.h>
#else
#include <linux/fs.h>
#endif
#include <linux/sched.h>
#include <linux/isdnif.h>
#include <net/net_namespace.h>
#include <linux/mutex.h>
#include "isdn_divert.h"
/*********************************/
/* Variables for interface queue */
/*********************************/
ulong if_used = 0; /* number of interface users */
static DEFINE_MUTEX(isdn_divert_mutex);
static struct divert_info *divert_info_head = NULL; /* head of queue */
static struct divert_info *divert_info_tail = NULL; /* pointer to last entry */
static DEFINE_SPINLOCK(divert_info_lock);/* lock for queue */
static wait_queue_head_t rd_queue;
/*********************************/
/* put an info buffer into queue */
/*********************************/
void
put_info_buffer(char *cp)
{
struct divert_info *ib;
unsigned long flags;
if (if_used <= 0)
return;
if (!cp)
return;
if (!*cp)
return;
if (!(ib = kmalloc(sizeof(struct divert_info) + strlen(cp), GFP_ATOMIC)))
return; /* no memory */
strcpy(ib->info_start, cp); /* set output string */
ib->next = NULL;
spin_lock_irqsave(&divert_info_lock, flags);
ib->usage_cnt = if_used;
if (!divert_info_head)
divert_info_head = ib; /* new head */
else
divert_info_tail->next = ib; /* follows existing messages */
divert_info_tail = ib; /* new tail */
/* delete old entrys */
while (divert_info_head->next) {
if ((divert_info_head->usage_cnt <= 0) &&
(divert_info_head->next->usage_cnt <= 0)) {
ib = divert_info_head;
divert_info_head = divert_info_head->next;
kfree(ib);
} else
break;
} /* divert_info_head->next */
spin_unlock_irqrestore(&divert_info_lock, flags);
wake_up_interruptible(&(rd_queue));
} /* put_info_buffer */
#ifdef CONFIG_PROC_FS
/**********************************/
/* deflection device read routine */
/**********************************/
static ssize_t
isdn_divert_read(struct file *file, char __user *buf, size_t count, loff_t *off)
{
struct divert_info *inf;
int len;
if (!(inf = *((struct divert_info **) file->private_data))) {
if (file->f_flags & O_NONBLOCK)
return -EAGAIN;
wait_event_interruptible(rd_queue, (inf =
*((struct divert_info **) file->private_data)));
}
if (!inf)
return (0);
inf->usage_cnt--; /* new usage count */
file->private_data = &inf->next; /* next structure */
if ((len = strlen(inf->info_start)) <= count) {
if (copy_to_user(buf, inf->info_start, len))
return -EFAULT;
*off += len;
return (len);
}
return (0);
} /* isdn_divert_read */
/**********************************/
/* deflection device write routine */
/**********************************/
static ssize_t
isdn_divert_write(struct file *file, const char __user *buf, size_t count, loff_t *off)
{
return (-ENODEV);
} /* isdn_divert_write */
/***************************************/
/* select routines for various kernels */
/***************************************/
static __poll_t
isdn_divert_poll(struct file *file, poll_table *wait)
{
__poll_t mask = 0;
poll_wait(file, &(rd_queue), wait);
/* mask = EPOLLOUT | EPOLLWRNORM; */
if (*((struct divert_info **) file->private_data)) {
mask |= EPOLLIN | EPOLLRDNORM;
}
return mask;
} /* isdn_divert_poll */
/****************/
/* Open routine */
/****************/
static int
isdn_divert_open(struct inode *ino, struct file *filep)
{
unsigned long flags;
spin_lock_irqsave(&divert_info_lock, flags);
if_used++;
if (divert_info_head)
filep->private_data = &(divert_info_tail->next);
else
filep->private_data = &divert_info_head;
spin_unlock_irqrestore(&divert_info_lock, flags);
/* start_divert(); */
return nonseekable_open(ino, filep);
} /* isdn_divert_open */
/*******************/
/* close routine */
/*******************/
static int
isdn_divert_close(struct inode *ino, struct file *filep)
{
struct divert_info *inf;
unsigned long flags;
spin_lock_irqsave(&divert_info_lock, flags);
if_used--;
inf = *((struct divert_info **) filep->private_data);
while (inf) {
inf->usage_cnt--;
inf = inf->next;
}
if (if_used <= 0)
while (divert_info_head) {
inf = divert_info_head;
divert_info_head = divert_info_head->next;
kfree(inf);
}
spin_unlock_irqrestore(&divert_info_lock, flags);
return (0);
} /* isdn_divert_close */
/*********/
/* IOCTL */
/*********/
static int isdn_divert_ioctl_unlocked(struct file *file, uint cmd, ulong arg)
{
divert_ioctl dioctl;
int i;
unsigned long flags;
divert_rule *rulep;
char *cp;
if (copy_from_user(&dioctl, (void __user *) arg, sizeof(dioctl)))
return -EFAULT;
switch (cmd) {
case IIOCGETVER:
dioctl.drv_version = DIVERT_IIOC_VERSION; /* set version */
break;
case IIOCGETDRV:
if ((dioctl.getid.drvid = divert_if.name_to_drv(dioctl.getid.drvnam)) < 0)
return (-EINVAL);
break;
case IIOCGETNAM:
cp = divert_if.drv_to_name(dioctl.getid.drvid);
if (!cp)
return (-EINVAL);
if (!*cp)
return (-EINVAL);
strcpy(dioctl.getid.drvnam, cp);
break;
case IIOCGETRULE:
if (!(rulep = getruleptr(dioctl.getsetrule.ruleidx)))
return (-EINVAL);
dioctl.getsetrule.rule = *rulep; /* copy data */
break;
case IIOCMODRULE:
if (!(rulep = getruleptr(dioctl.getsetrule.ruleidx)))
return (-EINVAL);
spin_lock_irqsave(&divert_lock, flags);
*rulep = dioctl.getsetrule.rule; /* copy data */
spin_unlock_irqrestore(&divert_lock, flags);
return (0); /* no copy required */
break;
case IIOCINSRULE:
return (insertrule(dioctl.getsetrule.ruleidx, &dioctl.getsetrule.rule));
break;
case IIOCDELRULE:
return (deleterule(dioctl.getsetrule.ruleidx));
break;
case IIOCDODFACT:
return (deflect_extern_action(dioctl.fwd_ctrl.subcmd,
dioctl.fwd_ctrl.callid,
dioctl.fwd_ctrl.to_nr));
case IIOCDOCFACT:
case IIOCDOCFDIS:
case IIOCDOCFINT:
if (!divert_if.drv_to_name(dioctl.cf_ctrl.drvid))
return (-EINVAL); /* invalid driver */
if (strnlen(dioctl.cf_ctrl.msn, sizeof(dioctl.cf_ctrl.msn)) ==
sizeof(dioctl.cf_ctrl.msn))
return -EINVAL;
if (strnlen(dioctl.cf_ctrl.fwd_nr, sizeof(dioctl.cf_ctrl.fwd_nr)) ==
sizeof(dioctl.cf_ctrl.fwd_nr))
return -EINVAL;
if ((i = cf_command(dioctl.cf_ctrl.drvid,
(cmd == IIOCDOCFACT) ? 1 : (cmd == IIOCDOCFDIS) ? 0 : 2,
dioctl.cf_ctrl.cfproc,
dioctl.cf_ctrl.msn,
dioctl.cf_ctrl.service,
dioctl.cf_ctrl.fwd_nr,
&dioctl.cf_ctrl.procid)))
return (i);
break;
default:
return (-EINVAL);
} /* switch cmd */
return copy_to_user((void __user *)arg, &dioctl, sizeof(dioctl)) ? -EFAULT : 0;
} /* isdn_divert_ioctl */
static long isdn_divert_ioctl(struct file *file, uint cmd, ulong arg)
{
long ret;
mutex_lock(&isdn_divert_mutex);
ret = isdn_divert_ioctl_unlocked(file, cmd, arg);
mutex_unlock(&isdn_divert_mutex);
return ret;
}
static const struct file_operations isdn_fops =
{
.owner = THIS_MODULE,
.llseek = no_llseek,
.read = isdn_divert_read,
.write = isdn_divert_write,
.poll = isdn_divert_poll,
.unlocked_ioctl = isdn_divert_ioctl,
.open = isdn_divert_open,
.release = isdn_divert_close,
};
/****************************/
/* isdn subdir in /proc/net */
/****************************/
static struct proc_dir_entry *isdn_proc_entry = NULL;
static struct proc_dir_entry *isdn_divert_entry = NULL;
#endif /* CONFIG_PROC_FS */
/***************************************************************************/
/* divert_dev_init must be called before the proc filesystem may be used */
/***************************************************************************/
int
divert_dev_init(void)
{
init_waitqueue_head(&rd_queue);
#ifdef CONFIG_PROC_FS
isdn_proc_entry = proc_mkdir("isdn", init_net.proc_net);
if (!isdn_proc_entry)
return (-1);
isdn_divert_entry = proc_create("divert", S_IFREG | S_IRUGO,
isdn_proc_entry, &isdn_fops);
if (!isdn_divert_entry) {
remove_proc_entry("isdn", init_net.proc_net);
return (-1);
}
#endif /* CONFIG_PROC_FS */
return (0);
} /* divert_dev_init */
/***************************************************************************/
/* divert_dev_deinit must be called before leaving isdn when included as */
/* a module. */
/***************************************************************************/
int
divert_dev_deinit(void)
{
#ifdef CONFIG_PROC_FS
remove_proc_entry("divert", isdn_proc_entry);
remove_proc_entry("isdn", init_net.proc_net);
#endif /* CONFIG_PROC_FS */
return (0);
} /* divert_dev_deinit */

View File

@ -1,846 +0,0 @@
/* $Id: isdn_divert.c,v 1.6.6.3 2001/09/23 22:24:36 kai Exp $
*
* DSS1 main diversion supplementary handling for i4l.
*
* Copyright 1999 by Werner Cornelius (werner@isdn4linux.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#include <linux/proc_fs.h>
#include <linux/slab.h>
#include <linux/timer.h>
#include <linux/jiffies.h>
#include "isdn_divert.h"
/**********************************/
/* structure keeping calling info */
/**********************************/
struct call_struc {
isdn_ctrl ics; /* delivered setup + driver parameters */
ulong divert_id; /* Id delivered to user */
unsigned char akt_state; /* actual state */
char deflect_dest[35]; /* deflection destination */
struct timer_list timer; /* timer control structure */
char info[90]; /* device info output */
struct call_struc *next; /* pointer to next entry */
struct call_struc *prev;
};
/********************************************/
/* structure keeping deflection table entry */
/********************************************/
struct deflect_struc {
struct deflect_struc *next, *prev;
divert_rule rule; /* used rule */
};
/*****************************************/
/* variables for main diversion services */
/*****************************************/
/* diversion/deflection processes */
static struct call_struc *divert_head = NULL; /* head of remembered entrys */
static ulong next_id = 1; /* next info id */
static struct deflect_struc *table_head = NULL;
static struct deflect_struc *table_tail = NULL;
static unsigned char extern_wait_max = 4; /* maximum wait in s for external process */
DEFINE_SPINLOCK(divert_lock);
/***************************/
/* timer callback function */
/***************************/
static void deflect_timer_expire(struct timer_list *t)
{
unsigned long flags;
struct call_struc *cs = from_timer(cs, t, timer);
spin_lock_irqsave(&divert_lock, flags);
del_timer(&cs->timer); /* delete active timer */
spin_unlock_irqrestore(&divert_lock, flags);
switch (cs->akt_state) {
case DEFLECT_PROCEED:
cs->ics.command = ISDN_CMD_HANGUP; /* cancel action */
divert_if.ll_cmd(&cs->ics);
spin_lock_irqsave(&divert_lock, flags);
cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */
cs->timer.expires = jiffies + (HZ * AUTODEL_TIME);
add_timer(&cs->timer);
spin_unlock_irqrestore(&divert_lock, flags);
break;
case DEFLECT_ALERT:
cs->ics.command = ISDN_CMD_REDIR; /* protocol */
strlcpy(cs->ics.parm.setup.phone, cs->deflect_dest, sizeof(cs->ics.parm.setup.phone));
strcpy(cs->ics.parm.setup.eazmsn, "Testtext delayed");
divert_if.ll_cmd(&cs->ics);
spin_lock_irqsave(&divert_lock, flags);
cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */
cs->timer.expires = jiffies + (HZ * AUTODEL_TIME);
add_timer(&cs->timer);
spin_unlock_irqrestore(&divert_lock, flags);
break;
case DEFLECT_AUTODEL:
default:
spin_lock_irqsave(&divert_lock, flags);
if (cs->prev)
cs->prev->next = cs->next; /* forward link */
else
divert_head = cs->next;
if (cs->next)
cs->next->prev = cs->prev; /* back link */
spin_unlock_irqrestore(&divert_lock, flags);
kfree(cs);
return;
} /* switch */
} /* deflect_timer_func */
/*****************************************/
/* handle call forwarding de/activations */
/* 0 = deact, 1 = act, 2 = interrogate */
/*****************************************/
int cf_command(int drvid, int mode,
u_char proc, char *msn,
u_char service, char *fwd_nr, ulong *procid)
{
unsigned long flags;
int retval, msnlen;
int fwd_len;
char *p, *ielenp, tmp[60];
struct call_struc *cs;
if (strchr(msn, '.')) return (-EINVAL); /* subaddress not allowed in msn */
if ((proc & 0x7F) > 2) return (-EINVAL);
proc &= 3;
p = tmp;
*p++ = 0x30; /* enumeration */
ielenp = p++; /* remember total length position */
*p++ = 0xa; /* proc tag */
*p++ = 1; /* length */
*p++ = proc & 0x7F; /* procedure to de/activate/interrogate */
*p++ = 0xa; /* service tag */
*p++ = 1; /* length */
*p++ = service; /* service to handle */
if (mode == 1) {
if (!*fwd_nr) return (-EINVAL); /* destination missing */
if (strchr(fwd_nr, '.')) return (-EINVAL); /* subaddress not allowed */
fwd_len = strlen(fwd_nr);
*p++ = 0x30; /* number enumeration */
*p++ = fwd_len + 2; /* complete forward to len */
*p++ = 0x80; /* fwd to nr */
*p++ = fwd_len; /* length of number */
strcpy(p, fwd_nr); /* copy number */
p += fwd_len; /* pointer beyond fwd */
} /* activate */
msnlen = strlen(msn);
*p++ = 0x80; /* msn number */
if (msnlen > 1) {
*p++ = msnlen; /* length */
strcpy(p, msn);
p += msnlen;
} else
*p++ = 0;
*ielenp = p - ielenp - 1; /* set total IE length */
/* allocate mem for information struct */
if (!(cs = kmalloc(sizeof(struct call_struc), GFP_ATOMIC)))
return (-ENOMEM); /* no memory */
timer_setup(&cs->timer, deflect_timer_expire, 0);
cs->info[0] = '\0';
cs->ics.driver = drvid;
cs->ics.command = ISDN_CMD_PROT_IO; /* protocol specific io */
cs->ics.arg = DSS1_CMD_INVOKE; /* invoke supplementary service */
cs->ics.parm.dss1_io.proc = (mode == 1) ? 7 : (mode == 2) ? 11 : 8; /* operation */
cs->ics.parm.dss1_io.timeout = 4000; /* from ETS 300 207-1 */
cs->ics.parm.dss1_io.datalen = p - tmp; /* total len */
cs->ics.parm.dss1_io.data = tmp; /* start of buffer */
spin_lock_irqsave(&divert_lock, flags);
cs->ics.parm.dss1_io.ll_id = next_id++; /* id for callback */
spin_unlock_irqrestore(&divert_lock, flags);
*procid = cs->ics.parm.dss1_io.ll_id;
sprintf(cs->info, "%d 0x%lx %s%s 0 %s %02x %d%s%s\n",
(!mode) ? DIVERT_DEACTIVATE : (mode == 1) ? DIVERT_ACTIVATE : DIVERT_REPORT,
cs->ics.parm.dss1_io.ll_id,
(mode != 2) ? "" : "0 ",
divert_if.drv_to_name(cs->ics.driver),
msn,
service & 0xFF,
proc,
(mode != 1) ? "" : " 0 ",
(mode != 1) ? "" : fwd_nr);
retval = divert_if.ll_cmd(&cs->ics); /* execute command */
if (!retval) {
cs->prev = NULL;
spin_lock_irqsave(&divert_lock, flags);
cs->next = divert_head;
divert_head = cs;
spin_unlock_irqrestore(&divert_lock, flags);
} else
kfree(cs);
return (retval);
} /* cf_command */
/****************************************/
/* handle a external deflection command */
/****************************************/
int deflect_extern_action(u_char cmd, ulong callid, char *to_nr)
{
struct call_struc *cs;
isdn_ctrl ic;
unsigned long flags;
int i;
if ((cmd & 0x7F) > 2) return (-EINVAL); /* invalid command */
cs = divert_head; /* start of parameter list */
while (cs) {
if (cs->divert_id == callid) break; /* found */
cs = cs->next;
} /* search entry */
if (!cs) return (-EINVAL); /* invalid callid */
ic.driver = cs->ics.driver;
ic.arg = cs->ics.arg;
i = -EINVAL;
if (cs->akt_state == DEFLECT_AUTODEL) return (i); /* no valid call */
switch (cmd & 0x7F) {
case 0: /* hangup */
del_timer(&cs->timer);
ic.command = ISDN_CMD_HANGUP;
i = divert_if.ll_cmd(&ic);
spin_lock_irqsave(&divert_lock, flags);
cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */
cs->timer.expires = jiffies + (HZ * AUTODEL_TIME);
add_timer(&cs->timer);
spin_unlock_irqrestore(&divert_lock, flags);
break;
case 1: /* alert */
if (cs->akt_state == DEFLECT_ALERT) return (0);
cmd &= 0x7F; /* never wait */
del_timer(&cs->timer);
ic.command = ISDN_CMD_ALERT;
if ((i = divert_if.ll_cmd(&ic))) {
spin_lock_irqsave(&divert_lock, flags);
cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */
cs->timer.expires = jiffies + (HZ * AUTODEL_TIME);
add_timer(&cs->timer);
spin_unlock_irqrestore(&divert_lock, flags);
} else
cs->akt_state = DEFLECT_ALERT;
break;
case 2: /* redir */
del_timer(&cs->timer);
strlcpy(cs->ics.parm.setup.phone, to_nr, sizeof(cs->ics.parm.setup.phone));
strcpy(cs->ics.parm.setup.eazmsn, "Testtext manual");
ic.command = ISDN_CMD_REDIR;
if ((i = divert_if.ll_cmd(&ic))) {
spin_lock_irqsave(&divert_lock, flags);
cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */
cs->timer.expires = jiffies + (HZ * AUTODEL_TIME);
add_timer(&cs->timer);
spin_unlock_irqrestore(&divert_lock, flags);
} else
cs->akt_state = DEFLECT_ALERT;
break;
} /* switch */
return (i);
} /* deflect_extern_action */
/********************************/
/* insert a new rule before idx */
/********************************/
int insertrule(int idx, divert_rule *newrule)
{
struct deflect_struc *ds, *ds1 = NULL;
unsigned long flags;
if (!(ds = kmalloc(sizeof(struct deflect_struc), GFP_KERNEL)))
return (-ENOMEM); /* no memory */
ds->rule = *newrule; /* set rule */
spin_lock_irqsave(&divert_lock, flags);
if (idx >= 0) {
ds1 = table_head;
while ((ds1) && (idx > 0))
{ idx--;
ds1 = ds1->next;
}
if (!ds1) idx = -1;
}
if (idx < 0) {
ds->prev = table_tail; /* previous entry */
ds->next = NULL; /* end of chain */
if (ds->prev)
ds->prev->next = ds; /* last forward */
else
table_head = ds; /* is first entry */
table_tail = ds; /* end of queue */
} else {
ds->next = ds1; /* next entry */
ds->prev = ds1->prev; /* prev entry */
ds1->prev = ds; /* backward chain old element */
if (!ds->prev)
table_head = ds; /* first element */
}
spin_unlock_irqrestore(&divert_lock, flags);
return (0);
} /* insertrule */
/***********************************/
/* delete the rule at position idx */
/***********************************/
int deleterule(int idx)
{
struct deflect_struc *ds, *ds1;
unsigned long flags;
if (idx < 0) {
spin_lock_irqsave(&divert_lock, flags);
ds = table_head;
table_head = NULL;
table_tail = NULL;
spin_unlock_irqrestore(&divert_lock, flags);
while (ds) {
ds1 = ds;
ds = ds->next;
kfree(ds1);
}
return (0);
}
spin_lock_irqsave(&divert_lock, flags);
ds = table_head;
while ((ds) && (idx > 0)) {
idx--;
ds = ds->next;
}
if (!ds) {
spin_unlock_irqrestore(&divert_lock, flags);
return (-EINVAL);
}
if (ds->next)
ds->next->prev = ds->prev; /* backward chain */
else
table_tail = ds->prev; /* end of chain */
if (ds->prev)
ds->prev->next = ds->next; /* forward chain */
else
table_head = ds->next; /* start of chain */
spin_unlock_irqrestore(&divert_lock, flags);
kfree(ds);
return (0);
} /* deleterule */
/*******************************************/
/* get a pointer to a specific rule number */
/*******************************************/
divert_rule *getruleptr(int idx)
{
struct deflect_struc *ds = table_head;
if (idx < 0) return (NULL);
while ((ds) && (idx >= 0)) {
if (!(idx--)) {
return (&ds->rule);
break;
}
ds = ds->next;
}
return (NULL);
} /* getruleptr */
/*************************************************/
/* called from common module on an incoming call */
/*************************************************/
static int isdn_divert_icall(isdn_ctrl *ic)
{
int retval = 0;
unsigned long flags;
struct call_struc *cs = NULL;
struct deflect_struc *dv;
char *p, *p1;
u_char accept;
/* first check the internal deflection table */
for (dv = table_head; dv; dv = dv->next) {
/* scan table */
if (((dv->rule.callopt == 1) && (ic->command == ISDN_STAT_ICALLW)) ||
((dv->rule.callopt == 2) && (ic->command == ISDN_STAT_ICALL)))
continue; /* call option check */
if (!(dv->rule.drvid & (1L << ic->driver)))
continue; /* driver not matching */
if ((dv->rule.si1) && (dv->rule.si1 != ic->parm.setup.si1))
continue; /* si1 not matching */
if ((dv->rule.si2) && (dv->rule.si2 != ic->parm.setup.si2))
continue; /* si2 not matching */
p = dv->rule.my_msn;
p1 = ic->parm.setup.eazmsn;
accept = 0;
while (*p) {
/* complete compare */
if (*p == '-') {
accept = 1; /* call accepted */
break;
}
if (*p++ != *p1++)
break; /* not accepted */
if ((!*p) && (!*p1))
accept = 1;
} /* complete compare */
if (!accept) continue; /* not accepted */
if ((strcmp(dv->rule.caller, "0")) ||
(ic->parm.setup.phone[0])) {
p = dv->rule.caller;
p1 = ic->parm.setup.phone;
accept = 0;
while (*p) {
/* complete compare */
if (*p == '-') {
accept = 1; /* call accepted */
break;
}
if (*p++ != *p1++)
break; /* not accepted */
if ((!*p) && (!*p1))
accept = 1;
} /* complete compare */
if (!accept) continue; /* not accepted */
}
switch (dv->rule.action) {
case DEFLECT_IGNORE:
return 0;
case DEFLECT_ALERT:
case DEFLECT_PROCEED:
case DEFLECT_REPORT:
case DEFLECT_REJECT:
if (dv->rule.action == DEFLECT_PROCEED)
if ((!if_used) || ((!extern_wait_max) && (!dv->rule.waittime)))
return (0); /* no external deflection needed */
if (!(cs = kmalloc(sizeof(struct call_struc), GFP_ATOMIC)))
return (0); /* no memory */
timer_setup(&cs->timer, deflect_timer_expire, 0);
cs->info[0] = '\0';
cs->ics = *ic; /* copy incoming data */
if (!cs->ics.parm.setup.phone[0]) strcpy(cs->ics.parm.setup.phone, "0");
if (!cs->ics.parm.setup.eazmsn[0]) strcpy(cs->ics.parm.setup.eazmsn, "0");
cs->ics.parm.setup.screen = dv->rule.screen;
if (dv->rule.waittime)
cs->timer.expires = jiffies + (HZ * dv->rule.waittime);
else if (dv->rule.action == DEFLECT_PROCEED)
cs->timer.expires = jiffies + (HZ * extern_wait_max);
else
cs->timer.expires = 0;
cs->akt_state = dv->rule.action;
spin_lock_irqsave(&divert_lock, flags);
cs->divert_id = next_id++; /* new sequence number */
spin_unlock_irqrestore(&divert_lock, flags);
cs->prev = NULL;
if (cs->akt_state == DEFLECT_ALERT) {
strcpy(cs->deflect_dest, dv->rule.to_nr);
if (!cs->timer.expires) {
strcpy(ic->parm.setup.eazmsn,
"Testtext direct");
ic->parm.setup.screen = dv->rule.screen;
strlcpy(ic->parm.setup.phone, dv->rule.to_nr, sizeof(ic->parm.setup.phone));
cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */
cs->timer.expires = jiffies + (HZ * AUTODEL_TIME);
retval = 5;
} else
retval = 1; /* alerting */
} else {
cs->deflect_dest[0] = '\0';
retval = 4; /* only proceed */
}
snprintf(cs->info, sizeof(cs->info),
"%d 0x%lx %s %s %s %s 0x%x 0x%x %d %d %s\n",
cs->akt_state,
cs->divert_id,
divert_if.drv_to_name(cs->ics.driver),
(ic->command == ISDN_STAT_ICALLW) ? "1" : "0",
cs->ics.parm.setup.phone,
cs->ics.parm.setup.eazmsn,
cs->ics.parm.setup.si1,
cs->ics.parm.setup.si2,
cs->ics.parm.setup.screen,
dv->rule.waittime,
cs->deflect_dest);
if ((dv->rule.action == DEFLECT_REPORT) ||
(dv->rule.action == DEFLECT_REJECT)) {
put_info_buffer(cs->info);
kfree(cs); /* remove */
return ((dv->rule.action == DEFLECT_REPORT) ? 0 : 2); /* nothing to do */
}
break;
default:
return 0; /* ignore call */
} /* switch action */
break; /* will break the 'for' looping */
} /* scan_table */
if (cs) {
cs->prev = NULL;
spin_lock_irqsave(&divert_lock, flags);
cs->next = divert_head;
divert_head = cs;
if (cs->timer.expires) add_timer(&cs->timer);
spin_unlock_irqrestore(&divert_lock, flags);
put_info_buffer(cs->info);
return (retval);
} else
return (0);
} /* isdn_divert_icall */
void deleteprocs(void)
{
struct call_struc *cs, *cs1;
unsigned long flags;
spin_lock_irqsave(&divert_lock, flags);
cs = divert_head;
divert_head = NULL;
while (cs) {
del_timer(&cs->timer);
cs1 = cs;
cs = cs->next;
kfree(cs1);
}
spin_unlock_irqrestore(&divert_lock, flags);
} /* deleteprocs */
/****************************************************/
/* put a address including address type into buffer */
/****************************************************/
static int put_address(char *st, u_char *p, int len)
{
u_char retval = 0;
u_char adr_typ = 0; /* network standard */
if (len < 2) return (retval);
if (*p == 0xA1) {
retval = *(++p) + 2; /* total length */
if (retval > len) return (0); /* too short */
len = retval - 2; /* remaining length */
if (len < 3) return (0);
if ((*(++p) != 0x0A) || (*(++p) != 1)) return (0);
adr_typ = *(++p);
len -= 3;
p++;
if (len < 2) return (0);
if (*p++ != 0x12) return (0);
if (*p > len) return (0); /* check number length */
len = *p++;
} else if (*p == 0x80) {
retval = *(++p) + 2; /* total length */
if (retval > len) return (0);
len = retval - 2;
p++;
} else
return (0); /* invalid address information */
sprintf(st, "%d ", adr_typ);
st += strlen(st);
if (!len)
*st++ = '-';
else
while (len--)
*st++ = *p++;
*st = '\0';
return (retval);
} /* put_address */
/*************************************/
/* report a successful interrogation */
/*************************************/
static int interrogate_success(isdn_ctrl *ic, struct call_struc *cs)
{
char *src = ic->parm.dss1_io.data;
int restlen = ic->parm.dss1_io.datalen;
int cnt = 1;
u_char n, n1;
char st[90], *p, *stp;
if (restlen < 2) return (-100); /* frame too short */
if (*src++ != 0x30) return (-101);
if ((n = *src++) > 0x81) return (-102); /* invalid length field */
restlen -= 2; /* remaining bytes */
if (n == 0x80) {
if (restlen < 2) return (-103);
if ((*(src + restlen - 1)) || (*(src + restlen - 2))) return (-104);
restlen -= 2;
} else if (n == 0x81) {
n = *src++;
restlen--;
if (n > restlen) return (-105);
restlen = n;
} else if (n > restlen)
return (-106);
else
restlen = n; /* standard format */
if (restlen < 3) return (-107); /* no procedure */
if ((*src++ != 2) || (*src++ != 1) || (*src++ != 0x0B)) return (-108);
restlen -= 3;
if (restlen < 2) return (-109); /* list missing */
if (*src == 0x31) {
src++;
if ((n = *src++) > 0x81) return (-110); /* invalid length field */
restlen -= 2; /* remaining bytes */
if (n == 0x80) {
if (restlen < 2) return (-111);
if ((*(src + restlen - 1)) || (*(src + restlen - 2))) return (-112);
restlen -= 2;
} else if (n == 0x81) {
n = *src++;
restlen--;
if (n > restlen) return (-113);
restlen = n;
} else if (n > restlen)
return (-114);
else
restlen = n; /* standard format */
} /* result list header */
while (restlen >= 2) {
stp = st;
sprintf(stp, "%d 0x%lx %d %s ", DIVERT_REPORT, ic->parm.dss1_io.ll_id,
cnt++, divert_if.drv_to_name(ic->driver));
stp += strlen(stp);
if (*src++ != 0x30) return (-115); /* invalid enum */
n = *src++;
restlen -= 2;
if (n > restlen) return (-116); /* enum length wrong */
restlen -= n;
p = src; /* one entry */
src += n;
if (!(n1 = put_address(stp, p, n & 0xFF))) continue;
stp += strlen(stp);
p += n1;
n -= n1;
if (n < 6) continue; /* no service and proc */
if ((*p++ != 0x0A) || (*p++ != 1)) continue;
sprintf(stp, " 0x%02x ", (*p++) & 0xFF);
stp += strlen(stp);
if ((*p++ != 0x0A) || (*p++ != 1)) continue;
sprintf(stp, "%d ", (*p++) & 0xFF);
stp += strlen(stp);
n -= 6;
if (n > 2) {
if (*p++ != 0x30) continue;
if (*p > (n - 2)) continue;
n = *p++;
if (!(n1 = put_address(stp, p, n & 0xFF))) continue;
stp += strlen(stp);
}
sprintf(stp, "\n");
put_info_buffer(st);
} /* while restlen */
if (restlen) return (-117);
return (0);
} /* interrogate_success */
/*********************************************/
/* callback for protocol specific extensions */
/*********************************************/
static int prot_stat_callback(isdn_ctrl *ic)
{
struct call_struc *cs, *cs1;
int i;
unsigned long flags;
cs = divert_head; /* start of list */
cs1 = NULL;
while (cs) {
if (ic->driver == cs->ics.driver) {
switch (cs->ics.arg) {
case DSS1_CMD_INVOKE:
if ((cs->ics.parm.dss1_io.ll_id == ic->parm.dss1_io.ll_id) &&
(cs->ics.parm.dss1_io.hl_id == ic->parm.dss1_io.hl_id)) {
switch (ic->arg) {
case DSS1_STAT_INVOKE_ERR:
sprintf(cs->info, "128 0x%lx 0x%x\n",
ic->parm.dss1_io.ll_id,
ic->parm.dss1_io.timeout);
put_info_buffer(cs->info);
break;
case DSS1_STAT_INVOKE_RES:
switch (cs->ics.parm.dss1_io.proc) {
case 7:
case 8:
put_info_buffer(cs->info);
break;
case 11:
i = interrogate_success(ic, cs);
if (i)
sprintf(cs->info, "%d 0x%lx %d\n", DIVERT_REPORT,
ic->parm.dss1_io.ll_id, i);
put_info_buffer(cs->info);
break;
default:
printk(KERN_WARNING "dss1_divert: unknown proc %d\n", cs->ics.parm.dss1_io.proc);
break;
}
break;
default:
printk(KERN_WARNING "dss1_divert unknown invoke answer %lx\n", ic->arg);
break;
}
cs1 = cs; /* remember structure */
cs = NULL;
continue; /* abort search */
} /* id found */
break;
case DSS1_CMD_INVOKE_ABORT:
printk(KERN_WARNING "dss1_divert unhandled invoke abort\n");
break;
default:
printk(KERN_WARNING "dss1_divert unknown cmd 0x%lx\n", cs->ics.arg);
break;
} /* switch ics.arg */
cs = cs->next;
} /* driver ok */
}
if (!cs1) {
printk(KERN_WARNING "dss1_divert unhandled process\n");
return (0);
}
if (cs1->ics.driver == -1) {
spin_lock_irqsave(&divert_lock, flags);
del_timer(&cs1->timer);
if (cs1->prev)
cs1->prev->next = cs1->next; /* forward link */
else
divert_head = cs1->next;
if (cs1->next)
cs1->next->prev = cs1->prev; /* back link */
spin_unlock_irqrestore(&divert_lock, flags);
kfree(cs1);
}
return (0);
} /* prot_stat_callback */
/***************************/
/* status callback from HL */
/***************************/
static int isdn_divert_stat_callback(isdn_ctrl *ic)
{
struct call_struc *cs, *cs1;
unsigned long flags;
int retval;
retval = -1;
cs = divert_head; /* start of list */
while (cs) {
if ((ic->driver == cs->ics.driver) &&
(ic->arg == cs->ics.arg)) {
switch (ic->command) {
case ISDN_STAT_DHUP:
sprintf(cs->info, "129 0x%lx\n", cs->divert_id);
del_timer(&cs->timer);
cs->ics.driver = -1;
break;
case ISDN_STAT_CAUSE:
sprintf(cs->info, "130 0x%lx %s\n", cs->divert_id, ic->parm.num);
break;
case ISDN_STAT_REDIR:
sprintf(cs->info, "131 0x%lx\n", cs->divert_id);
del_timer(&cs->timer);
cs->ics.driver = -1;
break;
default:
sprintf(cs->info, "999 0x%lx 0x%x\n", cs->divert_id, (int)(ic->command));
break;
}
put_info_buffer(cs->info);
retval = 0;
}
cs1 = cs;
cs = cs->next;
if (cs1->ics.driver == -1) {
spin_lock_irqsave(&divert_lock, flags);
if (cs1->prev)
cs1->prev->next = cs1->next; /* forward link */
else
divert_head = cs1->next;
if (cs1->next)
cs1->next->prev = cs1->prev; /* back link */
spin_unlock_irqrestore(&divert_lock, flags);
kfree(cs1);
}
}
return (retval); /* not found */
} /* isdn_divert_stat_callback */
/********************/
/* callback from ll */
/********************/
int ll_callback(isdn_ctrl *ic)
{
switch (ic->command) {
case ISDN_STAT_ICALL:
case ISDN_STAT_ICALLW:
return (isdn_divert_icall(ic));
break;
case ISDN_STAT_PROT:
if ((ic->arg & 0xFF) == ISDN_PTYPE_EURO) {
if (ic->arg != DSS1_STAT_INVOKE_BRD)
return (prot_stat_callback(ic));
else
return (0); /* DSS1 invoke broadcast */
} else
return (-1); /* protocol not euro */
default:
return (isdn_divert_stat_callback(ic));
}
} /* ll_callback */

View File

@ -1,132 +0,0 @@
/* $Id: isdn_divert.h,v 1.5.6.1 2001/09/23 22:24:36 kai Exp $
*
* Header for the diversion supplementary ioctl interface.
*
* Copyright 1998 by Werner Cornelius (werner@ikt.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#include <linux/ioctl.h>
#include <linux/types.h>
/******************************************/
/* IOCTL codes for interface to user prog */
/******************************************/
#define DIVERT_IIOC_VERSION 0x01 /* actual version */
#define IIOCGETVER _IO('I', 1) /* get version of interface */
#define IIOCGETDRV _IO('I', 2) /* get driver number */
#define IIOCGETNAM _IO('I', 3) /* get driver name */
#define IIOCGETRULE _IO('I', 4) /* read one rule */
#define IIOCMODRULE _IO('I', 5) /* modify/replace a rule */
#define IIOCINSRULE _IO('I', 6) /* insert/append one rule */
#define IIOCDELRULE _IO('I', 7) /* delete a rule */
#define IIOCDODFACT _IO('I', 8) /* hangup/reject/alert/immediately deflect a call */
#define IIOCDOCFACT _IO('I', 9) /* activate control forwarding in PBX */
#define IIOCDOCFDIS _IO('I', 10) /* deactivate control forwarding in PBX */
#define IIOCDOCFINT _IO('I', 11) /* interrogate control forwarding in PBX */
/*************************************/
/* states reported through interface */
/*************************************/
#define DEFLECT_IGNORE 0 /* ignore incoming call */
#define DEFLECT_REPORT 1 /* only report */
#define DEFLECT_PROCEED 2 /* deflect when externally triggered */
#define DEFLECT_ALERT 3 /* alert and deflect after delay */
#define DEFLECT_REJECT 4 /* reject immediately */
#define DIVERT_ACTIVATE 5 /* diversion activate */
#define DIVERT_DEACTIVATE 6 /* diversion deactivate */
#define DIVERT_REPORT 7 /* interrogation result */
#define DEFLECT_AUTODEL 255 /* only for internal use */
#define DEFLECT_ALL_IDS 0xFFFFFFFF /* all drivers selected */
typedef struct {
ulong drvid; /* driver ids, bit mapped */
char my_msn[35]; /* desired msn, subaddr allowed */
char caller[35]; /* caller id, partial string with * + subaddr allowed */
char to_nr[35]; /* deflected to number incl. subaddress */
u_char si1, si2; /* service indicators, si1=bitmask, si1+2 0 = all */
u_char screen; /* screening: 0 = no info, 1 = info, 2 = nfo with nr */
u_char callopt; /* option for call handling:
0 = all calls
1 = only non waiting calls
2 = only waiting calls */
u_char action; /* desired action:
0 = don't report call -> ignore
1 = report call, do not allow/proceed for deflection
2 = report call, send proceed, wait max waittime secs
3 = report call, alert and deflect after waittime
4 = report call, reject immediately
actions 1-2 only take place if interface is opened
*/
u_char waittime; /* maximum wait time for proceeding */
} divert_rule;
typedef union {
int drv_version; /* return of driver version */
struct {
int drvid; /* id of driver */
char drvnam[30]; /* name of driver */
} getid;
struct {
int ruleidx; /* index of rule */
divert_rule rule; /* rule parms */
} getsetrule;
struct {
u_char subcmd; /* 0 = hangup/reject,
1 = alert,
2 = deflect */
ulong callid; /* id of call delivered by ascii output */
char to_nr[35]; /* destination when deflect,
else uus1 string (maxlen 31),
data from rule used if empty */
} fwd_ctrl;
struct {
int drvid; /* id of driver */
u_char cfproc; /* cfu = 0, cfb = 1, cfnr = 2 */
ulong procid; /* process id returned when no error */
u_char service; /* basically coded service, 0 = all */
char msn[25]; /* desired msn, empty = all */
char fwd_nr[35];/* forwarded to number + subaddress */
} cf_ctrl;
} divert_ioctl;
#ifdef __KERNEL__
#include <linux/isdnif.h>
#include <linux/isdn_divertif.h>
#define AUTODEL_TIME 30 /* timeout in s to delete internal entries */
/**************************************************/
/* structure keeping ascii info for device output */
/**************************************************/
struct divert_info {
struct divert_info *next;
ulong usage_cnt; /* number of files still to work */
char info_start[2]; /* info string start */
};
/**************/
/* Prototypes */
/**************/
extern spinlock_t divert_lock;
extern ulong if_used; /* number of interface users */
extern int divert_dev_deinit(void);
extern int divert_dev_init(void);
extern void put_info_buffer(char *);
extern int ll_callback(isdn_ctrl *);
extern isdn_divert_if divert_if;
extern divert_rule *getruleptr(int);
extern int insertrule(int, divert_rule *);
extern int deleterule(int);
extern void deleteprocs(void);
extern int deflect_extern_action(u_char, ulong, char *);
extern int cf_command(int, int, u_char, char *, u_char, char *, ulong *);
#endif /* __KERNEL__ */

View File

@ -1,127 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Old ISDN4Linux config
#
if ISDN_I4L
config ISDN_PPP
bool "Support synchronous PPP"
depends on INET
select SLHC
help
Over digital connections such as ISDN, there is no need to
synchronize sender and recipient's clocks with start and stop bits
as is done over analog telephone lines. Instead, one can use
"synchronous PPP". Saying Y here will include this protocol. This
protocol is used by Cisco and Sun for example. So you want to say Y
here if the other end of your ISDN connection supports it. You will
need a special version of pppd (called ipppd) for using this
feature. See <file:Documentation/isdn/README.syncppp> and
<file:Documentation/isdn/syncPPP.FAQ> for more information.
config ISDN_PPP_VJ
bool "Use VJ-compression with synchronous PPP"
depends on ISDN_PPP
help
This enables Van Jacobson header compression for synchronous PPP.
Say Y if the other end of the connection supports it.
config ISDN_MPP
bool "Support generic MP (RFC 1717)"
depends on ISDN_PPP
help
With synchronous PPP enabled, it is possible to increase throughput
by bundling several ISDN-connections, using this protocol. See
<file:Documentation/isdn/README.syncppp> for more information.
config IPPP_FILTER
bool "Filtering for synchronous PPP"
depends on ISDN_PPP
help
Say Y here if you want to be able to filter the packets passing over
IPPP interfaces. This allows you to control which packets count as
activity (i.e. which packets will reset the idle timer or bring up
a demand-dialled link) and which packets are to be dropped entirely.
You need to say Y here if you wish to use the pass-filter and
active-filter options to ipppd.
config ISDN_PPP_BSDCOMP
tristate "Support BSD compression"
depends on ISDN_PPP
help
Support for the BSD-Compress compression method for PPP, which uses
the LZW compression method to compress each PPP packet before it is
sent over the wire. The machine at the other end of the PPP link
(usually your ISP) has to support the BSD-Compress compression
method as well for this to be useful. Even if they don't support it,
it is safe to say Y here.
config ISDN_AUDIO
bool "Support audio via ISDN"
help
If you say Y here, the modem-emulator will support a subset of the
EIA Class 8 Voice commands. Using a getty with voice-support
(mgetty+sendfax by <gert@greenie.muc.de> with an extension, available
with the ISDN utility package for example), you will be able to use
your Linux box as an ISDN-answering machine. Of course, this must be
supported by the lowlevel driver also. Currently, the HiSax driver
is the only voice-supporting driver. See
<file:Documentation/isdn/README.audio> for more information.
config ISDN_TTY_FAX
bool "Support AT-Fax Class 1 and 2 commands"
depends on ISDN_AUDIO
help
If you say Y here, the modem-emulator will support a subset of the
Fax Class 1 and 2 commands. Using a getty with fax-support
(mgetty+sendfax, hylafax), you will be able to use your Linux box as
an ISDN-fax-machine. This must be supported by the lowlevel driver
also. See <file:Documentation/isdn/README.fax> for more information.
config ISDN_X25
bool "X.25 PLP on top of ISDN"
depends on X25
help
This feature provides the X.25 protocol over ISDN connections.
See <file:Documentation/isdn/README.x25> for more information
if you are thinking about using this.
menu "ISDN feature submodules"
config ISDN_DRV_LOOP
tristate "isdnloop support"
depends on BROKEN_ON_SMP
help
This driver provides a virtual ISDN card. Its primary purpose is
testing of linklevel features or configuration without getting
charged by your service-provider for lots of phone calls.
You need will need the loopctrl utility from the latest isdn4k-utils
package to set up this driver.
config ISDN_DIVERSION
tristate "Support isdn diversion services"
help
This option allows you to use some supplementary diversion
services in conjunction with the HiSax driver on an EURO/DSS1
line.
Supported options are CD (call deflection), CFU (Call forward
unconditional), CFB (Call forward when busy) and CFNR (call forward
not reachable). Additionally the actual CFU, CFB and CFNR state may
be interrogated.
The use of CFU, CFB, CFNR and interrogation may be limited to some
countries. The keypad protocol is still not implemented. CD should
work in all countries if the service has been subscribed to.
Please read the file <file:Documentation/isdn/README.diversion>.
endmenu
comment "ISDN4Linux hardware drivers"
# end ISDN_I4L
endif

View File

@ -3,18 +3,4 @@
# Each configuration option enables a list of files.
obj-$(CONFIG_ISDN_I4L) += isdn.o
obj-$(CONFIG_ISDN_PPP_BSDCOMP) += isdn_bsdcomp.o
obj-$(CONFIG_ISDN_HDLC) += isdnhdlc.o
# Multipart objects.
isdn-y := isdn_net.o isdn_tty.o isdn_v110.o isdn_common.o
# Optional parts of multipart objects.
isdn-$(CONFIG_ISDN_PPP) += isdn_ppp.o
isdn-$(CONFIG_ISDN_X25) += isdn_concap.o isdn_x25iface.o
isdn-$(CONFIG_ISDN_AUDIO) += isdn_audio.o
isdn-$(CONFIG_ISDN_TTY_FAX) += isdn_ttyfax.o

View File

@ -1,711 +0,0 @@
/* $Id: isdn_audio.c,v 1.1.2.2 2004/01/12 22:37:18 keil Exp $
*
* Linux ISDN subsystem, audio conversion and compression (linklevel).
*
* Copyright 1994-1999 by Fritz Elfert (fritz@isdn4linux.de)
* DTMF code (c) 1996 by Christian Mock (cm@kukuruz.ping.at)
* Silence detection (c) 1998 by Armin Schindler (mac@gismo.telekom.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#include <linux/isdn.h>
#include <linux/slab.h>
#include "isdn_audio.h"
#include "isdn_common.h"
char *isdn_audio_revision = "$Revision: 1.1.2.2 $";
/*
* Misc. lookup-tables.
*/
/* ulaw -> signed 16-bit */
static short isdn_audio_ulaw_to_s16[] =
{
0x8284, 0x8684, 0x8a84, 0x8e84, 0x9284, 0x9684, 0x9a84, 0x9e84,
0xa284, 0xa684, 0xaa84, 0xae84, 0xb284, 0xb684, 0xba84, 0xbe84,
0xc184, 0xc384, 0xc584, 0xc784, 0xc984, 0xcb84, 0xcd84, 0xcf84,
0xd184, 0xd384, 0xd584, 0xd784, 0xd984, 0xdb84, 0xdd84, 0xdf84,
0xe104, 0xe204, 0xe304, 0xe404, 0xe504, 0xe604, 0xe704, 0xe804,
0xe904, 0xea04, 0xeb04, 0xec04, 0xed04, 0xee04, 0xef04, 0xf004,
0xf0c4, 0xf144, 0xf1c4, 0xf244, 0xf2c4, 0xf344, 0xf3c4, 0xf444,
0xf4c4, 0xf544, 0xf5c4, 0xf644, 0xf6c4, 0xf744, 0xf7c4, 0xf844,
0xf8a4, 0xf8e4, 0xf924, 0xf964, 0xf9a4, 0xf9e4, 0xfa24, 0xfa64,
0xfaa4, 0xfae4, 0xfb24, 0xfb64, 0xfba4, 0xfbe4, 0xfc24, 0xfc64,
0xfc94, 0xfcb4, 0xfcd4, 0xfcf4, 0xfd14, 0xfd34, 0xfd54, 0xfd74,
0xfd94, 0xfdb4, 0xfdd4, 0xfdf4, 0xfe14, 0xfe34, 0xfe54, 0xfe74,
0xfe8c, 0xfe9c, 0xfeac, 0xfebc, 0xfecc, 0xfedc, 0xfeec, 0xfefc,
0xff0c, 0xff1c, 0xff2c, 0xff3c, 0xff4c, 0xff5c, 0xff6c, 0xff7c,
0xff88, 0xff90, 0xff98, 0xffa0, 0xffa8, 0xffb0, 0xffb8, 0xffc0,
0xffc8, 0xffd0, 0xffd8, 0xffe0, 0xffe8, 0xfff0, 0xfff8, 0x0000,
0x7d7c, 0x797c, 0x757c, 0x717c, 0x6d7c, 0x697c, 0x657c, 0x617c,
0x5d7c, 0x597c, 0x557c, 0x517c, 0x4d7c, 0x497c, 0x457c, 0x417c,
0x3e7c, 0x3c7c, 0x3a7c, 0x387c, 0x367c, 0x347c, 0x327c, 0x307c,
0x2e7c, 0x2c7c, 0x2a7c, 0x287c, 0x267c, 0x247c, 0x227c, 0x207c,
0x1efc, 0x1dfc, 0x1cfc, 0x1bfc, 0x1afc, 0x19fc, 0x18fc, 0x17fc,
0x16fc, 0x15fc, 0x14fc, 0x13fc, 0x12fc, 0x11fc, 0x10fc, 0x0ffc,
0x0f3c, 0x0ebc, 0x0e3c, 0x0dbc, 0x0d3c, 0x0cbc, 0x0c3c, 0x0bbc,
0x0b3c, 0x0abc, 0x0a3c, 0x09bc, 0x093c, 0x08bc, 0x083c, 0x07bc,
0x075c, 0x071c, 0x06dc, 0x069c, 0x065c, 0x061c, 0x05dc, 0x059c,
0x055c, 0x051c, 0x04dc, 0x049c, 0x045c, 0x041c, 0x03dc, 0x039c,
0x036c, 0x034c, 0x032c, 0x030c, 0x02ec, 0x02cc, 0x02ac, 0x028c,
0x026c, 0x024c, 0x022c, 0x020c, 0x01ec, 0x01cc, 0x01ac, 0x018c,
0x0174, 0x0164, 0x0154, 0x0144, 0x0134, 0x0124, 0x0114, 0x0104,
0x00f4, 0x00e4, 0x00d4, 0x00c4, 0x00b4, 0x00a4, 0x0094, 0x0084,
0x0078, 0x0070, 0x0068, 0x0060, 0x0058, 0x0050, 0x0048, 0x0040,
0x0038, 0x0030, 0x0028, 0x0020, 0x0018, 0x0010, 0x0008, 0x0000
};
/* alaw -> signed 16-bit */
static short isdn_audio_alaw_to_s16[] =
{
0x13fc, 0xec04, 0x0144, 0xfebc, 0x517c, 0xae84, 0x051c, 0xfae4,
0x0a3c, 0xf5c4, 0x0048, 0xffb8, 0x287c, 0xd784, 0x028c, 0xfd74,
0x1bfc, 0xe404, 0x01cc, 0xfe34, 0x717c, 0x8e84, 0x071c, 0xf8e4,
0x0e3c, 0xf1c4, 0x00c4, 0xff3c, 0x387c, 0xc784, 0x039c, 0xfc64,
0x0ffc, 0xf004, 0x0104, 0xfefc, 0x417c, 0xbe84, 0x041c, 0xfbe4,
0x083c, 0xf7c4, 0x0008, 0xfff8, 0x207c, 0xdf84, 0x020c, 0xfdf4,
0x17fc, 0xe804, 0x018c, 0xfe74, 0x617c, 0x9e84, 0x061c, 0xf9e4,
0x0c3c, 0xf3c4, 0x0084, 0xff7c, 0x307c, 0xcf84, 0x030c, 0xfcf4,
0x15fc, 0xea04, 0x0164, 0xfe9c, 0x597c, 0xa684, 0x059c, 0xfa64,
0x0b3c, 0xf4c4, 0x0068, 0xff98, 0x2c7c, 0xd384, 0x02cc, 0xfd34,
0x1dfc, 0xe204, 0x01ec, 0xfe14, 0x797c, 0x8684, 0x07bc, 0xf844,
0x0f3c, 0xf0c4, 0x00e4, 0xff1c, 0x3c7c, 0xc384, 0x03dc, 0xfc24,
0x11fc, 0xee04, 0x0124, 0xfedc, 0x497c, 0xb684, 0x049c, 0xfb64,
0x093c, 0xf6c4, 0x0028, 0xffd8, 0x247c, 0xdb84, 0x024c, 0xfdb4,
0x19fc, 0xe604, 0x01ac, 0xfe54, 0x697c, 0x9684, 0x069c, 0xf964,
0x0d3c, 0xf2c4, 0x00a4, 0xff5c, 0x347c, 0xcb84, 0x034c, 0xfcb4,
0x12fc, 0xed04, 0x0134, 0xfecc, 0x4d7c, 0xb284, 0x04dc, 0xfb24,
0x09bc, 0xf644, 0x0038, 0xffc8, 0x267c, 0xd984, 0x026c, 0xfd94,
0x1afc, 0xe504, 0x01ac, 0xfe54, 0x6d7c, 0x9284, 0x06dc, 0xf924,
0x0dbc, 0xf244, 0x00b4, 0xff4c, 0x367c, 0xc984, 0x036c, 0xfc94,
0x0f3c, 0xf0c4, 0x00f4, 0xff0c, 0x3e7c, 0xc184, 0x03dc, 0xfc24,
0x07bc, 0xf844, 0x0008, 0xfff8, 0x1efc, 0xe104, 0x01ec, 0xfe14,
0x16fc, 0xe904, 0x0174, 0xfe8c, 0x5d7c, 0xa284, 0x05dc, 0xfa24,
0x0bbc, 0xf444, 0x0078, 0xff88, 0x2e7c, 0xd184, 0x02ec, 0xfd14,
0x14fc, 0xeb04, 0x0154, 0xfeac, 0x557c, 0xaa84, 0x055c, 0xfaa4,
0x0abc, 0xf544, 0x0058, 0xffa8, 0x2a7c, 0xd584, 0x02ac, 0xfd54,
0x1cfc, 0xe304, 0x01cc, 0xfe34, 0x757c, 0x8a84, 0x075c, 0xf8a4,
0x0ebc, 0xf144, 0x00d4, 0xff2c, 0x3a7c, 0xc584, 0x039c, 0xfc64,
0x10fc, 0xef04, 0x0114, 0xfeec, 0x457c, 0xba84, 0x045c, 0xfba4,
0x08bc, 0xf744, 0x0018, 0xffe8, 0x227c, 0xdd84, 0x022c, 0xfdd4,
0x18fc, 0xe704, 0x018c, 0xfe74, 0x657c, 0x9a84, 0x065c, 0xf9a4,
0x0cbc, 0xf344, 0x0094, 0xff6c, 0x327c, 0xcd84, 0x032c, 0xfcd4
};
/* alaw -> ulaw */
static char isdn_audio_alaw_to_ulaw[] =
{
0xab, 0x2b, 0xe3, 0x63, 0x8b, 0x0b, 0xc9, 0x49,
0xba, 0x3a, 0xf6, 0x76, 0x9b, 0x1b, 0xd7, 0x57,
0xa3, 0x23, 0xdd, 0x5d, 0x83, 0x03, 0xc1, 0x41,
0xb2, 0x32, 0xeb, 0x6b, 0x93, 0x13, 0xcf, 0x4f,
0xaf, 0x2f, 0xe7, 0x67, 0x8f, 0x0f, 0xcd, 0x4d,
0xbe, 0x3e, 0xfe, 0x7e, 0x9f, 0x1f, 0xdb, 0x5b,
0xa7, 0x27, 0xdf, 0x5f, 0x87, 0x07, 0xc5, 0x45,
0xb6, 0x36, 0xef, 0x6f, 0x97, 0x17, 0xd3, 0x53,
0xa9, 0x29, 0xe1, 0x61, 0x89, 0x09, 0xc7, 0x47,
0xb8, 0x38, 0xf2, 0x72, 0x99, 0x19, 0xd5, 0x55,
0xa1, 0x21, 0xdc, 0x5c, 0x81, 0x01, 0xbf, 0x3f,
0xb0, 0x30, 0xe9, 0x69, 0x91, 0x11, 0xce, 0x4e,
0xad, 0x2d, 0xe5, 0x65, 0x8d, 0x0d, 0xcb, 0x4b,
0xbc, 0x3c, 0xfa, 0x7a, 0x9d, 0x1d, 0xd9, 0x59,
0xa5, 0x25, 0xde, 0x5e, 0x85, 0x05, 0xc3, 0x43,
0xb4, 0x34, 0xed, 0x6d, 0x95, 0x15, 0xd1, 0x51,
0xac, 0x2c, 0xe4, 0x64, 0x8c, 0x0c, 0xca, 0x4a,
0xbb, 0x3b, 0xf8, 0x78, 0x9c, 0x1c, 0xd8, 0x58,
0xa4, 0x24, 0xde, 0x5e, 0x84, 0x04, 0xc2, 0x42,
0xb3, 0x33, 0xec, 0x6c, 0x94, 0x14, 0xd0, 0x50,
0xb0, 0x30, 0xe8, 0x68, 0x90, 0x10, 0xce, 0x4e,
0xbf, 0x3f, 0xfe, 0x7e, 0xa0, 0x20, 0xdc, 0x5c,
0xa8, 0x28, 0xe0, 0x60, 0x88, 0x08, 0xc6, 0x46,
0xb7, 0x37, 0xf0, 0x70, 0x98, 0x18, 0xd4, 0x54,
0xaa, 0x2a, 0xe2, 0x62, 0x8a, 0x0a, 0xc8, 0x48,
0xb9, 0x39, 0xf4, 0x74, 0x9a, 0x1a, 0xd6, 0x56,
0xa2, 0x22, 0xdd, 0x5d, 0x82, 0x02, 0xc0, 0x40,
0xb1, 0x31, 0xea, 0x6a, 0x92, 0x12, 0xcf, 0x4f,
0xae, 0x2e, 0xe6, 0x66, 0x8e, 0x0e, 0xcc, 0x4c,
0xbd, 0x3d, 0xfc, 0x7c, 0x9e, 0x1e, 0xda, 0x5a,
0xa6, 0x26, 0xdf, 0x5f, 0x86, 0x06, 0xc4, 0x44,
0xb5, 0x35, 0xee, 0x6e, 0x96, 0x16, 0xd2, 0x52
};
/* ulaw -> alaw */
static char isdn_audio_ulaw_to_alaw[] =
{
0xab, 0x55, 0xd5, 0x15, 0x95, 0x75, 0xf5, 0x35,
0xb5, 0x45, 0xc5, 0x05, 0x85, 0x65, 0xe5, 0x25,
0xa5, 0x5d, 0xdd, 0x1d, 0x9d, 0x7d, 0xfd, 0x3d,
0xbd, 0x4d, 0xcd, 0x0d, 0x8d, 0x6d, 0xed, 0x2d,
0xad, 0x51, 0xd1, 0x11, 0x91, 0x71, 0xf1, 0x31,
0xb1, 0x41, 0xc1, 0x01, 0x81, 0x61, 0xe1, 0x21,
0x59, 0xd9, 0x19, 0x99, 0x79, 0xf9, 0x39, 0xb9,
0x49, 0xc9, 0x09, 0x89, 0x69, 0xe9, 0x29, 0xa9,
0xd7, 0x17, 0x97, 0x77, 0xf7, 0x37, 0xb7, 0x47,
0xc7, 0x07, 0x87, 0x67, 0xe7, 0x27, 0xa7, 0xdf,
0x9f, 0x7f, 0xff, 0x3f, 0xbf, 0x4f, 0xcf, 0x0f,
0x8f, 0x6f, 0xef, 0x2f, 0x53, 0x13, 0x73, 0x33,
0xb3, 0x43, 0xc3, 0x03, 0x83, 0x63, 0xe3, 0x23,
0xa3, 0x5b, 0xdb, 0x1b, 0x9b, 0x7b, 0xfb, 0x3b,
0xbb, 0xbb, 0x4b, 0x4b, 0xcb, 0xcb, 0x0b, 0x0b,
0x8b, 0x8b, 0x6b, 0x6b, 0xeb, 0xeb, 0x2b, 0x2b,
0xab, 0x54, 0xd4, 0x14, 0x94, 0x74, 0xf4, 0x34,
0xb4, 0x44, 0xc4, 0x04, 0x84, 0x64, 0xe4, 0x24,
0xa4, 0x5c, 0xdc, 0x1c, 0x9c, 0x7c, 0xfc, 0x3c,
0xbc, 0x4c, 0xcc, 0x0c, 0x8c, 0x6c, 0xec, 0x2c,
0xac, 0x50, 0xd0, 0x10, 0x90, 0x70, 0xf0, 0x30,
0xb0, 0x40, 0xc0, 0x00, 0x80, 0x60, 0xe0, 0x20,
0x58, 0xd8, 0x18, 0x98, 0x78, 0xf8, 0x38, 0xb8,
0x48, 0xc8, 0x08, 0x88, 0x68, 0xe8, 0x28, 0xa8,
0xd6, 0x16, 0x96, 0x76, 0xf6, 0x36, 0xb6, 0x46,
0xc6, 0x06, 0x86, 0x66, 0xe6, 0x26, 0xa6, 0xde,
0x9e, 0x7e, 0xfe, 0x3e, 0xbe, 0x4e, 0xce, 0x0e,
0x8e, 0x6e, 0xee, 0x2e, 0x52, 0x12, 0x72, 0x32,
0xb2, 0x42, 0xc2, 0x02, 0x82, 0x62, 0xe2, 0x22,
0xa2, 0x5a, 0xda, 0x1a, 0x9a, 0x7a, 0xfa, 0x3a,
0xba, 0xba, 0x4a, 0x4a, 0xca, 0xca, 0x0a, 0x0a,
0x8a, 0x8a, 0x6a, 0x6a, 0xea, 0xea, 0x2a, 0x2a
};
#define NCOEFF 8 /* number of frequencies to be analyzed */
#define DTMF_TRESH 4000 /* above this is dtmf */
#define SILENCE_TRESH 200 /* below this is silence */
#define AMP_BITS 9 /* bits per sample, reduced to avoid overflow */
#define LOGRP 0
#define HIGRP 1
/* For DTMF recognition:
* 2 * cos(2 * PI * k / N) precalculated for all k
*/
static int cos2pik[NCOEFF] =
{
55813, 53604, 51193, 48591, 38114, 33057, 25889, 18332
};
static char dtmf_matrix[4][4] =
{
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
static inline void
isdn_audio_tlookup(const u_char *table, u_char *buff, unsigned long n)
{
#ifdef __i386__
unsigned long d0, d1, d2, d3;
__asm__ __volatile__(
"cld\n"
"1:\tlodsb\n\t"
"xlatb\n\t"
"stosb\n\t"
"loop 1b\n\t"
: "=&b"(d0), "=&c"(d1), "=&D"(d2), "=&S"(d3)
: "0"((long) table), "1"(n), "2"((long) buff), "3"((long) buff)
: "memory", "ax");
#else
while (n--)
*buff = table[*(unsigned char *)buff], buff++;
#endif
}
void
isdn_audio_ulaw2alaw(unsigned char *buff, unsigned long len)
{
isdn_audio_tlookup(isdn_audio_ulaw_to_alaw, buff, len);
}
void
isdn_audio_alaw2ulaw(unsigned char *buff, unsigned long len)
{
isdn_audio_tlookup(isdn_audio_alaw_to_ulaw, buff, len);
}
/*
* linear <-> adpcm conversion stuff
* Most parts from the mgetty-package.
* (C) by Gert Doering and Klaus Weidner
* Used by permission of Gert Doering
*/
#define ZEROTRAP /* turn on the trap as per the MIL-STD */
#undef ZEROTRAP
#define BIAS 0x84 /* define the add-in bias for 16 bit samples */
#define CLIP 32635
static unsigned char
isdn_audio_linear2ulaw(int sample)
{
static int exp_lut[256] =
{
0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
};
int sign,
exponent,
mantissa;
unsigned char ulawbyte;
/* Get the sample into sign-magnitude. */
sign = (sample >> 8) & 0x80; /* set aside the sign */
if (sign != 0)
sample = -sample; /* get magnitude */
if (sample > CLIP)
sample = CLIP; /* clip the magnitude */
/* Convert from 16 bit linear to ulaw. */
sample = sample + BIAS;
exponent = exp_lut[(sample >> 7) & 0xFF];
mantissa = (sample >> (exponent + 3)) & 0x0F;
ulawbyte = ~(sign | (exponent << 4) | mantissa);
#ifdef ZEROTRAP
/* optional CCITT trap */
if (ulawbyte == 0)
ulawbyte = 0x02;
#endif
return (ulawbyte);
}
static int Mx[3][8] =
{
{0x3800, 0x5600, 0, 0, 0, 0, 0, 0},
{0x399a, 0x3a9f, 0x4d14, 0x6607, 0, 0, 0, 0},
{0x3556, 0x3556, 0x399A, 0x3A9F, 0x4200, 0x4D14, 0x6607, 0x6607},
};
static int bitmask[9] =
{
0, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff
};
static int
isdn_audio_get_bits(adpcm_state *s, unsigned char **in, int *len)
{
while (s->nleft < s->nbits) {
int d = *((*in)++);
(*len)--;
s->word = (s->word << 8) | d;
s->nleft += 8;
}
s->nleft -= s->nbits;
return (s->word >> s->nleft) & bitmask[s->nbits];
}
static void
isdn_audio_put_bits(int data, int nbits, adpcm_state *s,
unsigned char **out, int *len)
{
s->word = (s->word << nbits) | (data & bitmask[nbits]);
s->nleft += nbits;
while (s->nleft >= 8) {
int d = (s->word >> (s->nleft - 8));
*(out[0]++) = d & 255;
(*len)++;
s->nleft -= 8;
}
}
adpcm_state *
isdn_audio_adpcm_init(adpcm_state *s, int nbits)
{
if (!s)
s = kmalloc(sizeof(adpcm_state), GFP_ATOMIC);
if (s) {
s->a = 0;
s->d = 5;
s->word = 0;
s->nleft = 0;
s->nbits = nbits;
}
return s;
}
dtmf_state *
isdn_audio_dtmf_init(dtmf_state *s)
{
if (!s)
s = kmalloc(sizeof(dtmf_state), GFP_ATOMIC);
if (s) {
s->idx = 0;
s->last = ' ';
}
return s;
}
/*
* Decompression of adpcm data to a/u-law
*
*/
int
isdn_audio_adpcm2xlaw(adpcm_state *s, int fmt, unsigned char *in,
unsigned char *out, int len)
{
int a = s->a;
int d = s->d;
int nbits = s->nbits;
int olen = 0;
while (len) {
int e = isdn_audio_get_bits(s, &in, &len);
int sign;
if (nbits == 4 && e == 0)
d = 4;
sign = (e >> (nbits - 1)) ? -1 : 1;
e &= bitmask[nbits - 1];
a += sign * ((e << 1) + 1) * d >> 1;
if (d & 1)
a++;
if (fmt)
*out++ = isdn_audio_ulaw_to_alaw[
isdn_audio_linear2ulaw(a << 2)];
else
*out++ = isdn_audio_linear2ulaw(a << 2);
olen++;
d = (d * Mx[nbits - 2][e] + 0x2000) >> 14;
if (d < 5)
d = 5;
}
s->a = a;
s->d = d;
return olen;
}
int
isdn_audio_xlaw2adpcm(adpcm_state *s, int fmt, unsigned char *in,
unsigned char *out, int len)
{
int a = s->a;
int d = s->d;
int nbits = s->nbits;
int olen = 0;
while (len--) {
int e = 0,
nmax = 1 << (nbits - 1);
int sign,
delta;
if (fmt)
delta = (isdn_audio_alaw_to_s16[*in++] >> 2) - a;
else
delta = (isdn_audio_ulaw_to_s16[*in++] >> 2) - a;
if (delta < 0) {
e = nmax;
delta = -delta;
}
while (--nmax && delta > d) {
delta -= d;
e++;
}
if (nbits == 4 && ((e & 0x0f) == 0))
e = 8;
isdn_audio_put_bits(e, nbits, s, &out, &olen);
sign = (e >> (nbits - 1)) ? -1 : 1;
e &= bitmask[nbits - 1];
a += sign * ((e << 1) + 1) * d >> 1;
if (d & 1)
a++;
d = (d * Mx[nbits - 2][e] + 0x2000) >> 14;
if (d < 5)
d = 5;
}
s->a = a;
s->d = d;
return olen;
}
/*
* Goertzel algorithm.
* See http://ptolemy.eecs.berkeley.edu/papers/96/dtmf_ict/
* for more info.
* Result is stored into an sk_buff and queued up for later
* evaluation.
*/
static void
isdn_audio_goertzel(int *sample, modem_info *info)
{
int sk,
sk1,
sk2;
int k,
n;
struct sk_buff *skb;
int *result;
skb = dev_alloc_skb(sizeof(int) * NCOEFF);
if (!skb) {
printk(KERN_WARNING
"isdn_audio: Could not alloc DTMF result for ttyI%d\n",
info->line);
return;
}
result = skb_put(skb, sizeof(int) * NCOEFF);
for (k = 0; k < NCOEFF; k++) {
sk = sk1 = sk2 = 0;
for (n = 0; n < DTMF_NPOINTS; n++) {
sk = sample[n] + ((cos2pik[k] * sk1) >> 15) - sk2;
sk2 = sk1;
sk1 = sk;
}
/* Avoid overflows */
sk >>= 1;
sk2 >>= 1;
/* compute |X(k)|**2 */
/* report overflows. This should not happen. */
/* Comment this out if desired */
if (sk < -32768 || sk > 32767)
printk(KERN_DEBUG
"isdn_audio: dtmf goertzel overflow, sk=%d\n", sk);
if (sk2 < -32768 || sk2 > 32767)
printk(KERN_DEBUG
"isdn_audio: dtmf goertzel overflow, sk2=%d\n", sk2);
result[k] =
((sk * sk) >> AMP_BITS) -
((((cos2pik[k] * sk) >> 15) * sk2) >> AMP_BITS) +
((sk2 * sk2) >> AMP_BITS);
}
skb_queue_tail(&info->dtmf_queue, skb);
isdn_timer_ctrl(ISDN_TIMER_MODEMREAD, 1);
}
void
isdn_audio_eval_dtmf(modem_info *info)
{
struct sk_buff *skb;
int *result;
dtmf_state *s;
int silence;
int i;
int di;
int ch;
int grp[2];
char what;
char *p;
int thresh;
while ((skb = skb_dequeue(&info->dtmf_queue))) {
result = (int *) skb->data;
s = info->dtmf_state;
grp[LOGRP] = grp[HIGRP] = -1;
silence = 0;
thresh = 0;
for (i = 0; i < NCOEFF; i++) {
if (result[i] > DTMF_TRESH) {
if (result[i] > thresh)
thresh = result[i];
}
else if (result[i] < SILENCE_TRESH)
silence++;
}
if (silence == NCOEFF)
what = ' ';
else {
if (thresh > 0) {
thresh = thresh >> 4; /* touchtones must match within 12 dB */
for (i = 0; i < NCOEFF; i++) {
if (result[i] < thresh)
continue; /* ignore */
/* good level found. This is allowed only one time per group */
if (i < NCOEFF / 2) {
/* lowgroup*/
if (grp[LOGRP] >= 0) {
// Bad. Another tone found. */
grp[LOGRP] = -1;
break;
}
else
grp[LOGRP] = i;
}
else { /* higroup */
if (grp[HIGRP] >= 0) { // Bad. Another tone found. */
grp[HIGRP] = -1;
break;
}
else
grp[HIGRP] = i - NCOEFF/2;
}
}
if ((grp[LOGRP] >= 0) && (grp[HIGRP] >= 0)) {
what = dtmf_matrix[grp[LOGRP]][grp[HIGRP]];
if (s->last != ' ' && s->last != '.')
s->last = what; /* min. 1 non-DTMF between DTMF */
} else
what = '.';
}
else
what = '.';
}
if ((what != s->last) && (what != ' ') && (what != '.')) {
printk(KERN_DEBUG "dtmf: tt='%c'\n", what);
p = skb->data;
*p++ = 0x10;
*p = what;
skb_trim(skb, 2);
ISDN_AUDIO_SKB_DLECOUNT(skb) = 0;
ISDN_AUDIO_SKB_LOCK(skb) = 0;
di = info->isdn_driver;
ch = info->isdn_channel;
__skb_queue_tail(&dev->drv[di]->rpqueue[ch], skb);
dev->drv[di]->rcvcount[ch] += 2;
/* Schedule dequeuing */
if ((dev->modempoll) && (info->rcvsched))
isdn_timer_ctrl(ISDN_TIMER_MODEMREAD, 1);
wake_up_interruptible(&dev->drv[di]->rcv_waitq[ch]);
} else
kfree_skb(skb);
s->last = what;
}
}
/*
* Decode DTMF tones, queue result in separate sk_buf for
* later examination.
* Parameters:
* s = pointer to state-struct.
* buf = input audio data
* len = size of audio data.
* fmt = audio data format (0 = ulaw, 1 = alaw)
*/
void
isdn_audio_calc_dtmf(modem_info *info, unsigned char *buf, int len, int fmt)
{
dtmf_state *s = info->dtmf_state;
int i;
int c;
while (len) {
c = DTMF_NPOINTS - s->idx;
if (c > len)
c = len;
if (c <= 0)
break;
for (i = 0; i < c; i++) {
if (fmt)
s->buf[s->idx++] =
isdn_audio_alaw_to_s16[*buf++] >> (15 - AMP_BITS);
else
s->buf[s->idx++] =
isdn_audio_ulaw_to_s16[*buf++] >> (15 - AMP_BITS);
}
if (s->idx == DTMF_NPOINTS) {
isdn_audio_goertzel(s->buf, info);
s->idx = 0;
}
len -= c;
}
}
silence_state *
isdn_audio_silence_init(silence_state *s)
{
if (!s)
s = kmalloc(sizeof(silence_state), GFP_ATOMIC);
if (s) {
s->idx = 0;
s->state = 0;
}
return s;
}
void
isdn_audio_calc_silence(modem_info *info, unsigned char *buf, int len, int fmt)
{
silence_state *s = info->silence_state;
int i;
signed char c;
if (!info->emu.vpar[1]) return;
for (i = 0; i < len; i++) {
if (fmt)
c = isdn_audio_alaw_to_ulaw[*buf++];
else
c = *buf++;
if (c > 0) c -= 128;
c = abs(c);
if (c > (info->emu.vpar[1] * 4)) {
s->idx = 0;
s->state = 1;
} else {
if (s->idx < 210000) s->idx++;
}
}
}
void
isdn_audio_put_dle_code(modem_info *info, u_char code)
{
struct sk_buff *skb;
int di;
int ch;
char *p;
skb = dev_alloc_skb(2);
if (!skb) {
printk(KERN_WARNING
"isdn_audio: Could not alloc skb for ttyI%d\n",
info->line);
return;
}
p = skb_put(skb, 2);
p[0] = 0x10;
p[1] = code;
ISDN_AUDIO_SKB_DLECOUNT(skb) = 0;
ISDN_AUDIO_SKB_LOCK(skb) = 0;
di = info->isdn_driver;
ch = info->isdn_channel;
__skb_queue_tail(&dev->drv[di]->rpqueue[ch], skb);
dev->drv[di]->rcvcount[ch] += 2;
/* Schedule dequeuing */
if ((dev->modempoll) && (info->rcvsched))
isdn_timer_ctrl(ISDN_TIMER_MODEMREAD, 1);
wake_up_interruptible(&dev->drv[di]->rcv_waitq[ch]);
}
void
isdn_audio_eval_silence(modem_info *info)
{
silence_state *s = info->silence_state;
char what;
what = ' ';
if (s->idx > (info->emu.vpar[2] * 800)) {
s->idx = 0;
if (!s->state) { /* silence from beginning of rec */
what = 's';
} else {
what = 'q';
}
}
if ((what == 's') || (what == 'q')) {
printk(KERN_DEBUG "ttyI%d: %s\n", info->line,
(what == 's') ? "silence" : "quiet");
isdn_audio_put_dle_code(info, what);
}
}

View File

@ -1,44 +0,0 @@
/* $Id: isdn_audio.h,v 1.1.2.2 2004/01/12 22:37:18 keil Exp $
*
* Linux ISDN subsystem, audio conversion and compression (linklevel).
*
* Copyright 1994-1999 by Fritz Elfert (fritz@isdn4linux.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#define DTMF_NPOINTS 205 /* Number of samples for DTMF recognition */
typedef struct adpcm_state {
int a;
int d;
int word;
int nleft;
int nbits;
} adpcm_state;
typedef struct dtmf_state {
char last;
char llast;
int idx;
int buf[DTMF_NPOINTS];
} dtmf_state;
typedef struct silence_state {
int state;
unsigned int idx;
} silence_state;
extern void isdn_audio_ulaw2alaw(unsigned char *, unsigned long);
extern void isdn_audio_alaw2ulaw(unsigned char *, unsigned long);
extern adpcm_state *isdn_audio_adpcm_init(adpcm_state *, int);
extern int isdn_audio_adpcm2xlaw(adpcm_state *, int, unsigned char *, unsigned char *, int);
extern int isdn_audio_xlaw2adpcm(adpcm_state *, int, unsigned char *, unsigned char *, int);
extern void isdn_audio_calc_dtmf(modem_info *, unsigned char *, int, int);
extern void isdn_audio_eval_dtmf(modem_info *);
dtmf_state *isdn_audio_dtmf_init(dtmf_state *);
extern void isdn_audio_calc_silence(modem_info *, unsigned char *, int, int);
extern void isdn_audio_eval_silence(modem_info *);
silence_state *isdn_audio_silence_init(silence_state *);
extern void isdn_audio_put_dle_code(modem_info *, u_char);

View File

@ -1,930 +0,0 @@
/*
* BSD compression module
*
* Patched version for ISDN syncPPP written 1997/1998 by Michael Hipp
* The whole module is now SKB based.
*
*/
/*
* Update: The Berkeley copyright was changed, and the change
* is retroactive to all "true" BSD software (ie everything
* from UCB as opposed to other peoples code that just carried
* the same license). The new copyright doesn't clash with the
* GPL, so the module-only restriction has been removed..
*/
/*
* Original copyright notice:
*
* Copyright (c) 1985, 1986 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* James A. Woods, derived from original work by Spencer Thomas
* and Joseph Orost.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/interrupt.h>
#include <linux/ptrace.h>
#include <linux/ioport.h>
#include <linux/in.h>
#include <linux/slab.h>
#include <linux/tty.h>
#include <linux/errno.h>
#include <linux/string.h> /* used in new tty drivers */
#include <linux/signal.h> /* used in new tty drivers */
#include <linux/bitops.h>
#include <asm/byteorder.h>
#include <asm/types.h>
#include <linux/if.h>
#include <linux/if_ether.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/inet.h>
#include <linux/ioctl.h>
#include <linux/vmalloc.h>
#include <linux/ppp_defs.h>
#include <linux/isdn.h>
#include <linux/isdn_ppp.h>
#include <linux/ip.h>
#include <linux/tcp.h>
#include <linux/if_arp.h>
#include <linux/ppp-comp.h>
#include "isdn_ppp.h"
MODULE_DESCRIPTION("ISDN4Linux: BSD Compression for PPP over ISDN");
MODULE_LICENSE("Dual BSD/GPL");
#define BSD_VERSION(x) ((x) >> 5)
#define BSD_NBITS(x) ((x) & 0x1F)
#define BSD_CURRENT_VERSION 1
#define DEBUG 1
/*
* A dictionary for doing BSD compress.
*/
struct bsd_dict {
u32 fcode;
u16 codem1; /* output of hash table -1 */
u16 cptr; /* map code to hash table entry */
};
struct bsd_db {
int totlen; /* length of this structure */
unsigned int hsize; /* size of the hash table */
unsigned char hshift; /* used in hash function */
unsigned char n_bits; /* current bits/code */
unsigned char maxbits; /* maximum bits/code */
unsigned char debug; /* non-zero if debug desired */
unsigned char unit; /* ppp unit number */
u16 seqno; /* sequence # of next packet */
unsigned int mru; /* size of receive (decompress) bufr */
unsigned int maxmaxcode; /* largest valid code */
unsigned int max_ent; /* largest code in use */
unsigned int in_count; /* uncompressed bytes, aged */
unsigned int bytes_out; /* compressed bytes, aged */
unsigned int ratio; /* recent compression ratio */
unsigned int checkpoint; /* when to next check the ratio */
unsigned int clear_count; /* times dictionary cleared */
unsigned int incomp_count; /* incompressible packets */
unsigned int incomp_bytes; /* incompressible bytes */
unsigned int uncomp_count; /* uncompressed packets */
unsigned int uncomp_bytes; /* uncompressed bytes */
unsigned int comp_count; /* compressed packets */
unsigned int comp_bytes; /* compressed bytes */
unsigned short *lens; /* array of lengths of codes */
struct bsd_dict *dict; /* dictionary */
int xmit;
};
#define BSD_OVHD 2 /* BSD compress overhead/packet */
#define MIN_BSD_BITS 9
#define BSD_INIT_BITS MIN_BSD_BITS
#define MAX_BSD_BITS 15
/*
* the next two codes should not be changed lightly, as they must not
* lie within the contiguous general code space.
*/
#define CLEAR 256 /* table clear output code */
#define FIRST 257 /* first free entry */
#define LAST 255
#define MAXCODE(b) ((1 << (b)) - 1)
#define BADCODEM1 MAXCODE(MAX_BSD_BITS)
#define BSD_HASH(prefix, suffix, hshift) ((((unsigned long)(suffix)) << (hshift)) \
^ (unsigned long)(prefix))
#define BSD_KEY(prefix, suffix) ((((unsigned long)(suffix)) << 16) \
+ (unsigned long)(prefix))
#define CHECK_GAP 10000 /* Ratio check interval */
#define RATIO_SCALE_LOG 8
#define RATIO_SCALE (1 << RATIO_SCALE_LOG)
#define RATIO_MAX (0x7fffffff >> RATIO_SCALE_LOG)
/*
* clear the dictionary
*/
static void bsd_clear(struct bsd_db *db)
{
db->clear_count++;
db->max_ent = FIRST - 1;
db->n_bits = BSD_INIT_BITS;
db->bytes_out = 0;
db->in_count = 0;
db->incomp_count = 0;
db->ratio = 0;
db->checkpoint = CHECK_GAP;
}
/*
* If the dictionary is full, then see if it is time to reset it.
*
* Compute the compression ratio using fixed-point arithmetic
* with 8 fractional bits.
*
* Since we have an infinite stream instead of a single file,
* watch only the local compression ratio.
*
* Since both peers must reset the dictionary at the same time even in
* the absence of CLEAR codes (while packets are incompressible), they
* must compute the same ratio.
*/
static int bsd_check(struct bsd_db *db) /* 1=output CLEAR */
{
unsigned int new_ratio;
if (db->in_count >= db->checkpoint)
{
/* age the ratio by limiting the size of the counts */
if (db->in_count >= RATIO_MAX || db->bytes_out >= RATIO_MAX)
{
db->in_count -= (db->in_count >> 2);
db->bytes_out -= (db->bytes_out >> 2);
}
db->checkpoint = db->in_count + CHECK_GAP;
if (db->max_ent >= db->maxmaxcode)
{
/* Reset the dictionary only if the ratio is worse,
* or if it looks as if it has been poisoned
* by incompressible data.
*
* This does not overflow, because
* db->in_count <= RATIO_MAX.
*/
new_ratio = db->in_count << RATIO_SCALE_LOG;
if (db->bytes_out != 0)
{
new_ratio /= db->bytes_out;
}
if (new_ratio < db->ratio || new_ratio < 1 * RATIO_SCALE)
{
bsd_clear(db);
return 1;
}
db->ratio = new_ratio;
}
}
return 0;
}
/*
* Return statistics.
*/
static void bsd_stats(void *state, struct compstat *stats)
{
struct bsd_db *db = (struct bsd_db *) state;
stats->unc_bytes = db->uncomp_bytes;
stats->unc_packets = db->uncomp_count;
stats->comp_bytes = db->comp_bytes;
stats->comp_packets = db->comp_count;
stats->inc_bytes = db->incomp_bytes;
stats->inc_packets = db->incomp_count;
stats->in_count = db->in_count;
stats->bytes_out = db->bytes_out;
}
/*
* Reset state, as on a CCP ResetReq.
*/
static void bsd_reset(void *state, unsigned char code, unsigned char id,
unsigned char *data, unsigned len,
struct isdn_ppp_resetparams *rsparm)
{
struct bsd_db *db = (struct bsd_db *) state;
bsd_clear(db);
db->seqno = 0;
db->clear_count = 0;
}
/*
* Release the compression structure
*/
static void bsd_free(void *state)
{
struct bsd_db *db = (struct bsd_db *) state;
if (db) {
/*
* Release the dictionary
*/
vfree(db->dict);
db->dict = NULL;
/*
* Release the string buffer
*/
vfree(db->lens);
db->lens = NULL;
/*
* Finally release the structure itself.
*/
kfree(db);
}
}
/*
* Allocate space for a (de) compressor.
*/
static void *bsd_alloc(struct isdn_ppp_comp_data *data)
{
int bits;
unsigned int hsize, hshift, maxmaxcode;
struct bsd_db *db;
int decomp;
static unsigned int htab[][2] = {
{ 5003 , 4 } , { 5003 , 4 } , { 5003 , 4 } , { 5003 , 4 } ,
{ 9001 , 5 } , { 18013 , 6 } , { 35023 , 7 } , { 69001 , 8 }
};
if (data->optlen != 1 || data->num != CI_BSD_COMPRESS
|| BSD_VERSION(data->options[0]) != BSD_CURRENT_VERSION)
return NULL;
bits = BSD_NBITS(data->options[0]);
if (bits < 9 || bits > 15)
return NULL;
hsize = htab[bits - 9][0];
hshift = htab[bits - 9][1];
/*
* Allocate the main control structure for this instance.
*/
maxmaxcode = MAXCODE(bits);
db = kzalloc(sizeof(struct bsd_db), GFP_KERNEL);
if (!db)
return NULL;
db->xmit = data->flags & IPPP_COMP_FLAG_XMIT;
decomp = db->xmit ? 0 : 1;
/*
* Allocate space for the dictionary. This may be more than one page in
* length.
*/
db->dict = vmalloc(array_size(hsize, sizeof(struct bsd_dict)));
if (!db->dict) {
bsd_free(db);
return NULL;
}
/*
* If this is the compression buffer then there is no length data.
* For decompression, the length information is needed as well.
*/
if (!decomp)
db->lens = NULL;
else {
db->lens = vmalloc(array_size(sizeof(db->lens[0]),
maxmaxcode + 1));
if (!db->lens) {
bsd_free(db);
return (NULL);
}
}
/*
* Initialize the data information for the compression code
*/
db->totlen = sizeof(struct bsd_db) + (sizeof(struct bsd_dict) * hsize);
db->hsize = hsize;
db->hshift = hshift;
db->maxmaxcode = maxmaxcode;
db->maxbits = bits;
return (void *)db;
}
/*
* Initialize the database.
*/
static int bsd_init(void *state, struct isdn_ppp_comp_data *data, int unit, int debug)
{
struct bsd_db *db = state;
int indx;
int decomp;
if (!state || !data) {
printk(KERN_ERR "isdn_bsd_init: [%d] ERR, state %lx data %lx\n", unit, (long)state, (long)data);
return 0;
}
decomp = db->xmit ? 0 : 1;
if (data->optlen != 1 || data->num != CI_BSD_COMPRESS
|| (BSD_VERSION(data->options[0]) != BSD_CURRENT_VERSION)
|| (BSD_NBITS(data->options[0]) != db->maxbits)
|| (decomp && db->lens == NULL)) {
printk(KERN_ERR "isdn_bsd: %d %d %d %d %lx\n", data->optlen, data->num, data->options[0], decomp, (unsigned long)db->lens);
return 0;
}
if (decomp)
for (indx = LAST; indx >= 0; indx--)
db->lens[indx] = 1;
indx = db->hsize;
while (indx-- != 0) {
db->dict[indx].codem1 = BADCODEM1;
db->dict[indx].cptr = 0;
}
db->unit = unit;
db->mru = 0;
db->debug = 1;
bsd_reset(db, 0, 0, NULL, 0, NULL);
return 1;
}
/*
* Obtain pointers to the various structures in the compression tables
*/
#define dict_ptrx(p, idx) &(p->dict[idx])
#define lens_ptrx(p, idx) &(p->lens[idx])
#ifdef DEBUG
static unsigned short *lens_ptr(struct bsd_db *db, int idx)
{
if ((unsigned int) idx > (unsigned int) db->maxmaxcode) {
printk(KERN_DEBUG "<9>ppp: lens_ptr(%d) > max\n", idx);
idx = 0;
}
return lens_ptrx(db, idx);
}
static struct bsd_dict *dict_ptr(struct bsd_db *db, int idx)
{
if ((unsigned int) idx >= (unsigned int) db->hsize) {
printk(KERN_DEBUG "<9>ppp: dict_ptr(%d) > max\n", idx);
idx = 0;
}
return dict_ptrx(db, idx);
}
#else
#define lens_ptr(db, idx) lens_ptrx(db, idx)
#define dict_ptr(db, idx) dict_ptrx(db, idx)
#endif
/*
* compress a packet
*/
static int bsd_compress(void *state, struct sk_buff *skb_in, struct sk_buff *skb_out, int proto)
{
struct bsd_db *db;
int hshift;
unsigned int max_ent;
unsigned int n_bits;
unsigned int bitno;
unsigned long accm;
int ent;
unsigned long fcode;
struct bsd_dict *dictp;
unsigned char c;
int hval, disp, ilen, mxcode;
unsigned char *rptr = skb_in->data;
int isize = skb_in->len;
#define OUTPUT(ent) \
{ \
bitno -= n_bits; \
accm |= ((ent) << bitno); \
do { \
if (skb_out && skb_tailroom(skb_out) > 0) \
skb_put_u8(skb_out, (u8)(accm >> 24)); \
accm <<= 8; \
bitno += 8; \
} while (bitno <= 24); \
}
/*
* If the protocol is not in the range we're interested in,
* just return without compressing the packet. If it is,
* the protocol becomes the first byte to compress.
*/
printk(KERN_DEBUG "bsd_compress called with %x\n", proto);
ent = proto;
if (proto < 0x21 || proto > 0xf9 || !(proto & 0x1))
return 0;
db = (struct bsd_db *) state;
hshift = db->hshift;
max_ent = db->max_ent;
n_bits = db->n_bits;
bitno = 32;
accm = 0;
mxcode = MAXCODE(n_bits);
/* This is the PPP header information */
if (skb_out && skb_tailroom(skb_out) >= 2) {
char *v = skb_put(skb_out, 2);
/* we only push our own data on the header,
AC,PC and protos is pushed by caller */
v[0] = db->seqno >> 8;
v[1] = db->seqno;
}
ilen = ++isize; /* This is off by one, but that is what is in draft! */
while (--ilen > 0) {
c = *rptr++;
fcode = BSD_KEY(ent, c);
hval = BSD_HASH(ent, c, hshift);
dictp = dict_ptr(db, hval);
/* Validate and then check the entry. */
if (dictp->codem1 >= max_ent)
goto nomatch;
if (dictp->fcode == fcode) {
ent = dictp->codem1 + 1;
continue; /* found (prefix,suffix) */
}
/* continue probing until a match or invalid entry */
disp = (hval == 0) ? 1 : hval;
do {
hval += disp;
if (hval >= db->hsize)
hval -= db->hsize;
dictp = dict_ptr(db, hval);
if (dictp->codem1 >= max_ent)
goto nomatch;
} while (dictp->fcode != fcode);
ent = dictp->codem1 + 1; /* finally found (prefix,suffix) */
continue;
nomatch:
OUTPUT(ent); /* output the prefix */
/* code -> hashtable */
if (max_ent < db->maxmaxcode) {
struct bsd_dict *dictp2;
struct bsd_dict *dictp3;
int indx;
/* expand code size if needed */
if (max_ent >= mxcode) {
db->n_bits = ++n_bits;
mxcode = MAXCODE(n_bits);
}
/*
* Invalidate old hash table entry using
* this code, and then take it over.
*/
dictp2 = dict_ptr(db, max_ent + 1);
indx = dictp2->cptr;
dictp3 = dict_ptr(db, indx);
if (dictp3->codem1 == max_ent)
dictp3->codem1 = BADCODEM1;
dictp2->cptr = hval;
dictp->codem1 = max_ent;
dictp->fcode = fcode;
db->max_ent = ++max_ent;
if (db->lens) {
unsigned short *len1 = lens_ptr(db, max_ent);
unsigned short *len2 = lens_ptr(db, ent);
*len1 = *len2 + 1;
}
}
ent = c;
}
OUTPUT(ent); /* output the last code */
if (skb_out)
db->bytes_out += skb_out->len; /* Do not count bytes from here */
db->uncomp_bytes += isize;
db->in_count += isize;
++db->uncomp_count;
++db->seqno;
if (bitno < 32)
++db->bytes_out; /* must be set before calling bsd_check */
/*
* Generate the clear command if needed
*/
if (bsd_check(db))
OUTPUT(CLEAR);
/*
* Pad dribble bits of last code with ones.
* Do not emit a completely useless byte of ones.
*/
if (bitno < 32 && skb_out && skb_tailroom(skb_out) > 0)
skb_put_u8(skb_out,
(unsigned char)((accm | (0xff << (bitno - 8))) >> 24));
/*
* Increase code size if we would have without the packet
* boundary because the decompressor will do so.
*/
if (max_ent >= mxcode && max_ent < db->maxmaxcode)
db->n_bits++;
/* If output length is too large then this is an incompressible frame. */
if (!skb_out || skb_out->len >= skb_in->len) {
++db->incomp_count;
db->incomp_bytes += isize;
return 0;
}
/* Count the number of compressed frames */
++db->comp_count;
db->comp_bytes += skb_out->len;
return skb_out->len;
#undef OUTPUT
}
/*
* Update the "BSD Compress" dictionary on the receiver for
* incompressible data by pretending to compress the incoming data.
*/
static void bsd_incomp(void *state, struct sk_buff *skb_in, int proto)
{
bsd_compress(state, skb_in, NULL, proto);
}
/*
* Decompress "BSD Compress".
*/
static int bsd_decompress(void *state, struct sk_buff *skb_in, struct sk_buff *skb_out,
struct isdn_ppp_resetparams *rsparm)
{
struct bsd_db *db;
unsigned int max_ent;
unsigned long accm;
unsigned int bitno; /* 1st valid bit in accm */
unsigned int n_bits;
unsigned int tgtbitno; /* bitno when we have a code */
struct bsd_dict *dictp;
int seq;
unsigned int incode;
unsigned int oldcode;
unsigned int finchar;
unsigned char *p, *ibuf;
int ilen;
int codelen;
int extra;
db = (struct bsd_db *) state;
max_ent = db->max_ent;
accm = 0;
bitno = 32; /* 1st valid bit in accm */
n_bits = db->n_bits;
tgtbitno = 32 - n_bits; /* bitno when we have a code */
printk(KERN_DEBUG "bsd_decompress called\n");
if (!skb_in || !skb_out) {
printk(KERN_ERR "bsd_decompress called with NULL parameter\n");
return DECOMP_ERROR;
}
/*
* Get the sequence number.
*/
if ((p = skb_pull(skb_in, 2)) == NULL) {
return DECOMP_ERROR;
}
p -= 2;
seq = (p[0] << 8) + p[1];
ilen = skb_in->len;
ibuf = skb_in->data;
/*
* Check the sequence number and give up if it differs from
* the value we're expecting.
*/
if (seq != db->seqno) {
if (db->debug) {
printk(KERN_DEBUG "bsd_decomp%d: bad sequence # %d, expected %d\n",
db->unit, seq, db->seqno - 1);
}
return DECOMP_ERROR;
}
++db->seqno;
db->bytes_out += ilen;
if (skb_tailroom(skb_out) > 0)
skb_put_u8(skb_out, 0);
else
return DECOMP_ERR_NOMEM;
oldcode = CLEAR;
/*
* Keep the checkpoint correctly so that incompressible packets
* clear the dictionary at the proper times.
*/
for (;;) {
if (ilen-- <= 0) {
db->in_count += (skb_out->len - 1); /* don't count the header */
break;
}
/*
* Accumulate bytes until we have a complete code.
* Then get the next code, relying on the 32-bit,
* unsigned accm to mask the result.
*/
bitno -= 8;
accm |= *ibuf++ << bitno;
if (tgtbitno < bitno)
continue;
incode = accm >> tgtbitno;
accm <<= n_bits;
bitno += n_bits;
/*
* The dictionary must only be cleared at the end of a packet.
*/
if (incode == CLEAR) {
if (ilen > 0) {
if (db->debug)
printk(KERN_DEBUG "bsd_decomp%d: bad CLEAR\n", db->unit);
return DECOMP_FATALERROR; /* probably a bug */
}
bsd_clear(db);
break;
}
if ((incode > max_ent + 2) || (incode > db->maxmaxcode)
|| (incode > max_ent && oldcode == CLEAR)) {
if (db->debug) {
printk(KERN_DEBUG "bsd_decomp%d: bad code 0x%x oldcode=0x%x ",
db->unit, incode, oldcode);
printk(KERN_DEBUG "max_ent=0x%x skb->Len=%d seqno=%d\n",
max_ent, skb_out->len, db->seqno);
}
return DECOMP_FATALERROR; /* probably a bug */
}
/* Special case for KwKwK string. */
if (incode > max_ent) {
finchar = oldcode;
extra = 1;
} else {
finchar = incode;
extra = 0;
}
codelen = *(lens_ptr(db, finchar));
if (skb_tailroom(skb_out) < codelen + extra) {
if (db->debug) {
printk(KERN_DEBUG "bsd_decomp%d: ran out of mru\n", db->unit);
#ifdef DEBUG
printk(KERN_DEBUG " len=%d, finchar=0x%x, codelen=%d,skblen=%d\n",
ilen, finchar, codelen, skb_out->len);
#endif
}
return DECOMP_FATALERROR;
}
/*
* Decode this code and install it in the decompressed buffer.
*/
p = skb_put(skb_out, codelen);
p += codelen;
while (finchar > LAST) {
struct bsd_dict *dictp2 = dict_ptr(db, finchar);
dictp = dict_ptr(db, dictp2->cptr);
#ifdef DEBUG
if (--codelen <= 0 || dictp->codem1 != finchar - 1) {
if (codelen <= 0) {
printk(KERN_ERR "bsd_decomp%d: fell off end of chain ", db->unit);
printk(KERN_ERR "0x%x at 0x%x by 0x%x, max_ent=0x%x\n", incode, finchar, dictp2->cptr, max_ent);
} else {
if (dictp->codem1 != finchar - 1) {
printk(KERN_ERR "bsd_decomp%d: bad code chain 0x%x finchar=0x%x ", db->unit, incode, finchar);
printk(KERN_ERR "oldcode=0x%x cptr=0x%x codem1=0x%x\n", oldcode, dictp2->cptr, dictp->codem1);
}
}
return DECOMP_FATALERROR;
}
#endif
{
u32 fcode = dictp->fcode;
*--p = (fcode >> 16) & 0xff;
finchar = fcode & 0xffff;
}
}
*--p = finchar;
#ifdef DEBUG
if (--codelen != 0)
printk(KERN_ERR "bsd_decomp%d: short by %d after code 0x%x, max_ent=0x%x\n", db->unit, codelen, incode, max_ent);
#endif
if (extra) /* the KwKwK case again */
skb_put_u8(skb_out, finchar);
/*
* If not first code in a packet, and
* if not out of code space, then allocate a new code.
*
* Keep the hash table correct so it can be used
* with uncompressed packets.
*/
if (oldcode != CLEAR && max_ent < db->maxmaxcode) {
struct bsd_dict *dictp2, *dictp3;
u16 *lens1, *lens2;
unsigned long fcode;
int hval, disp, indx;
fcode = BSD_KEY(oldcode, finchar);
hval = BSD_HASH(oldcode, finchar, db->hshift);
dictp = dict_ptr(db, hval);
/* look for a free hash table entry */
if (dictp->codem1 < max_ent) {
disp = (hval == 0) ? 1 : hval;
do {
hval += disp;
if (hval >= db->hsize)
hval -= db->hsize;
dictp = dict_ptr(db, hval);
} while (dictp->codem1 < max_ent);
}
/*
* Invalidate previous hash table entry
* assigned this code, and then take it over
*/
dictp2 = dict_ptr(db, max_ent + 1);
indx = dictp2->cptr;
dictp3 = dict_ptr(db, indx);
if (dictp3->codem1 == max_ent)
dictp3->codem1 = BADCODEM1;
dictp2->cptr = hval;
dictp->codem1 = max_ent;
dictp->fcode = fcode;
db->max_ent = ++max_ent;
/* Update the length of this string. */
lens1 = lens_ptr(db, max_ent);
lens2 = lens_ptr(db, oldcode);
*lens1 = *lens2 + 1;
/* Expand code size if needed. */
if (max_ent >= MAXCODE(n_bits) && max_ent < db->maxmaxcode) {
db->n_bits = ++n_bits;
tgtbitno = 32-n_bits;
}
}
oldcode = incode;
}
++db->comp_count;
++db->uncomp_count;
db->comp_bytes += skb_in->len - BSD_OVHD;
db->uncomp_bytes += skb_out->len;
if (bsd_check(db)) {
if (db->debug)
printk(KERN_DEBUG "bsd_decomp%d: peer should have cleared dictionary on %d\n",
db->unit, db->seqno - 1);
}
return skb_out->len;
}
/*************************************************************
* Table of addresses for the BSD compression module
*************************************************************/
static struct isdn_ppp_compressor ippp_bsd_compress = {
.owner = THIS_MODULE,
.num = CI_BSD_COMPRESS,
.alloc = bsd_alloc,
.free = bsd_free,
.init = bsd_init,
.reset = bsd_reset,
.compress = bsd_compress,
.decompress = bsd_decompress,
.incomp = bsd_incomp,
.stat = bsd_stats,
};
/*************************************************************
* Module support routines
*************************************************************/
static int __init isdn_bsdcomp_init(void)
{
int answer = isdn_ppp_register_compressor(&ippp_bsd_compress);
if (answer == 0)
printk(KERN_INFO "PPP BSD Compression module registered\n");
return answer;
}
static void __exit isdn_bsdcomp_exit(void)
{
isdn_ppp_unregister_compressor(&ippp_bsd_compress);
}
module_init(isdn_bsdcomp_init);
module_exit(isdn_bsdcomp_exit);

File diff suppressed because it is too large Load Diff

View File

@ -1,47 +0,0 @@
/* $Id: isdn_common.h,v 1.1.2.2 2004/01/12 22:37:19 keil Exp $
*
* header for Linux ISDN subsystem
* common used functions and debugging-switches (linklevel).
*
* Copyright 1994-1999 by Fritz Elfert (fritz@isdn4linux.de)
* Copyright 1995,96 by Thinking Objects Software GmbH Wuerzburg
* Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#undef ISDN_DEBUG_MODEM_OPEN
#undef ISDN_DEBUG_MODEM_IOCTL
#undef ISDN_DEBUG_MODEM_WAITSENT
#undef ISDN_DEBUG_MODEM_HUP
#undef ISDN_DEBUG_MODEM_ICALL
#undef ISDN_DEBUG_MODEM_DUMP
#undef ISDN_DEBUG_MODEM_VOICE
#undef ISDN_DEBUG_AT
#undef ISDN_DEBUG_NET_DUMP
#undef ISDN_DEBUG_NET_DIAL
#undef ISDN_DEBUG_NET_ICALL
/* Prototypes */
extern void isdn_lock_drivers(void);
extern void isdn_unlock_drivers(void);
extern void isdn_free_channel(int di, int ch, int usage);
extern void isdn_all_eaz(int di, int ch);
extern int isdn_command(isdn_ctrl *);
extern int isdn_dc2minor(int di, int ch);
extern void isdn_info_update(void);
extern char *isdn_map_eaz2msn(char *msn, int di);
extern void isdn_timer_ctrl(int tf, int onoff);
extern void isdn_unexclusive_channel(int di, int ch);
extern int isdn_getnum(char **);
extern int isdn_readbchan(int, int, u_char *, u_char *, int, wait_queue_head_t *);
extern int isdn_readbchan_tty(int, int, struct tty_port *, int);
extern int isdn_get_free_channel(int, int, int, int, int, char *);
extern int isdn_writebuf_skb_stub(int, int, int, struct sk_buff *);
extern int register_isdn(isdn_if *i);
extern int isdn_msncmp(const char *, const char *);
#if defined(ISDN_DEBUG_NET_DUMP) || defined(ISDN_DEBUG_MODEM_DUMP)
extern void isdn_dumppkt(char *, u_char *, int, int);
#endif

View File

@ -1,99 +0,0 @@
/* $Id: isdn_concap.c,v 1.1.2.2 2004/01/12 22:37:19 keil Exp $
*
* Linux ISDN subsystem, protocol encapsulation
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
/* Stuff to support the concap_proto by isdn4linux. isdn4linux - specific
* stuff goes here. Stuff that depends only on the concap protocol goes to
* another -- protocol specific -- source file.
*
*/
#include <linux/isdn.h>
#include "isdn_x25iface.h"
#include "isdn_net.h"
#include <linux/concap.h>
#include "isdn_concap.h"
/* The following set of device service operations are for encapsulation
protocols that require for reliable datalink semantics. That means:
- before any data is to be submitted the connection must explicitly
be set up.
- after the successful set up of the connection is signalled the
connection is considered to be reliably up.
Auto-dialing ist not compatible with this requirements. Thus, auto-dialing
is completely bypassed.
It might be possible to implement a (non standardized) datalink protocol
that provides a reliable data link service while using some auto dialing
mechanism. Such a protocol would need an auxiliary channel (i.e. user-user-
signaling on the D-channel) while the B-channel is down.
*/
static int isdn_concap_dl_data_req(struct concap_proto *concap, struct sk_buff *skb)
{
struct net_device *ndev = concap->net_dev;
isdn_net_dev *nd = ((isdn_net_local *) netdev_priv(ndev))->netdev;
isdn_net_local *lp = isdn_net_get_locked_lp(nd);
IX25DEBUG("isdn_concap_dl_data_req: %s \n", concap->net_dev->name);
if (!lp) {
IX25DEBUG("isdn_concap_dl_data_req: %s : isdn_net_send_skb returned %d\n", concap->net_dev->name, 1);
return 1;
}
lp->huptimer = 0;
isdn_net_writebuf_skb(lp, skb);
spin_unlock_bh(&lp->xmit_lock);
IX25DEBUG("isdn_concap_dl_data_req: %s : isdn_net_send_skb returned %d\n", concap->net_dev->name, 0);
return 0;
}
static int isdn_concap_dl_connect_req(struct concap_proto *concap)
{
struct net_device *ndev = concap->net_dev;
isdn_net_local *lp = netdev_priv(ndev);
int ret;
IX25DEBUG("isdn_concap_dl_connect_req: %s \n", ndev->name);
/* dial ... */
ret = isdn_net_dial_req(lp);
if (ret) IX25DEBUG("dialing failed\n");
return ret;
}
static int isdn_concap_dl_disconn_req(struct concap_proto *concap)
{
IX25DEBUG("isdn_concap_dl_disconn_req: %s \n", concap->net_dev->name);
isdn_net_hangup(concap->net_dev);
return 0;
}
struct concap_device_ops isdn_concap_reliable_dl_dops = {
.data_req = &isdn_concap_dl_data_req,
.connect_req = &isdn_concap_dl_connect_req,
.disconn_req = &isdn_concap_dl_disconn_req
};
/* The following should better go into a dedicated source file such that
this sourcefile does not need to include any protocol specific header
files. For now:
*/
struct concap_proto *isdn_concap_new(int encap)
{
switch (encap) {
case ISDN_NET_ENCAP_X25IFACE:
return isdn_x25iface_proto_new();
}
return NULL;
}

View File

@ -1,11 +0,0 @@
/* $Id: isdn_concap.h,v 1.1.2.2 2004/01/12 22:37:19 keil Exp $
*
* Linux ISDN subsystem, protocol encapsulation
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
extern struct concap_device_ops isdn_concap_reliable_dl_dops;
extern struct concap_proto *isdn_concap_new(int);

File diff suppressed because it is too large Load Diff

View File

@ -1,151 +0,0 @@
/* $Id: isdn_net.h,v 1.1.2.2 2004/01/12 22:37:19 keil Exp $
*
* header for Linux ISDN subsystem, network related functions (linklevel).
*
* Copyright 1994-1999 by Fritz Elfert (fritz@isdn4linux.de)
* Copyright 1995,96 by Thinking Objects Software GmbH Wuerzburg
* Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
/* Definitions for hupflags: */
#define ISDN_WAITCHARGE 1 /* did not get a charge info yet */
#define ISDN_HAVECHARGE 2 /* We know a charge info */
#define ISDN_CHARGEHUP 4 /* We want to use the charge mechanism */
#define ISDN_INHUP 8 /* Even if incoming, close after huptimeout */
#define ISDN_MANCHARGE 16 /* Charge Interval manually set */
/*
* Definitions for Cisco-HDLC header.
*/
#define CISCO_ADDR_UNICAST 0x0f
#define CISCO_ADDR_BROADCAST 0x8f
#define CISCO_CTRL 0x00
#define CISCO_TYPE_CDP 0x2000
#define CISCO_TYPE_SLARP 0x8035
#define CISCO_SLARP_REQUEST 0
#define CISCO_SLARP_REPLY 1
#define CISCO_SLARP_KEEPALIVE 2
extern char *isdn_net_new(char *, struct net_device *);
extern char *isdn_net_newslave(char *);
extern int isdn_net_rm(char *);
extern int isdn_net_rmall(void);
extern int isdn_net_stat_callback(int, isdn_ctrl *);
extern int isdn_net_setcfg(isdn_net_ioctl_cfg *);
extern int isdn_net_getcfg(isdn_net_ioctl_cfg *);
extern int isdn_net_addphone(isdn_net_ioctl_phone *);
extern int isdn_net_getphones(isdn_net_ioctl_phone *, char __user *);
extern int isdn_net_getpeer(isdn_net_ioctl_phone *, isdn_net_ioctl_phone __user *);
extern int isdn_net_delphone(isdn_net_ioctl_phone *);
extern int isdn_net_find_icall(int, int, int, setup_parm *);
extern void isdn_net_hangup(struct net_device *);
extern void isdn_net_dial(void);
extern void isdn_net_autohup(void);
extern int isdn_net_force_hangup(char *);
extern int isdn_net_force_dial(char *);
extern isdn_net_dev *isdn_net_findif(char *);
extern int isdn_net_rcv_skb(int, struct sk_buff *);
extern int isdn_net_dial_req(isdn_net_local *);
extern void isdn_net_writebuf_skb(isdn_net_local *lp, struct sk_buff *skb);
extern void isdn_net_write_super(isdn_net_local *lp, struct sk_buff *skb);
#define ISDN_NET_MAX_QUEUE_LENGTH 2
#define ISDN_MASTER_PRIV(lp) ((isdn_net_local *) netdev_priv(lp->master))
#define ISDN_SLAVE_PRIV(lp) ((isdn_net_local *) netdev_priv(lp->slave))
#define MASTER_TO_SLAVE(master) \
(((isdn_net_local *) netdev_priv(master))->slave)
/*
* is this particular channel busy?
*/
static __inline__ int isdn_net_lp_busy(isdn_net_local *lp)
{
if (atomic_read(&lp->frame_cnt) < ISDN_NET_MAX_QUEUE_LENGTH)
return 0;
else
return 1;
}
/*
* For the given net device, this will get a non-busy channel out of the
* corresponding bundle. The returned channel is locked.
*/
static __inline__ isdn_net_local *isdn_net_get_locked_lp(isdn_net_dev *nd)
{
unsigned long flags;
isdn_net_local *lp;
spin_lock_irqsave(&nd->queue_lock, flags);
lp = nd->queue; /* get lp on top of queue */
while (isdn_net_lp_busy(nd->queue)) {
nd->queue = nd->queue->next;
if (nd->queue == lp) { /* not found -- should never happen */
lp = NULL;
goto errout;
}
}
lp = nd->queue;
nd->queue = nd->queue->next;
spin_unlock_irqrestore(&nd->queue_lock, flags);
spin_lock(&lp->xmit_lock);
local_bh_disable();
return lp;
errout:
spin_unlock_irqrestore(&nd->queue_lock, flags);
return lp;
}
/*
* add a channel to a bundle
*/
static __inline__ void isdn_net_add_to_bundle(isdn_net_dev *nd, isdn_net_local *nlp)
{
isdn_net_local *lp;
unsigned long flags;
spin_lock_irqsave(&nd->queue_lock, flags);
lp = nd->queue;
// printk(KERN_DEBUG "%s: lp:%s(%p) nlp:%s(%p) last(%p)\n",
// __func__, lp->name, lp, nlp->name, nlp, lp->last);
nlp->last = lp->last;
lp->last->next = nlp;
lp->last = nlp;
nlp->next = lp;
nd->queue = nlp;
spin_unlock_irqrestore(&nd->queue_lock, flags);
}
/*
* remove a channel from the bundle it belongs to
*/
static __inline__ void isdn_net_rm_from_bundle(isdn_net_local *lp)
{
isdn_net_local *master_lp = lp;
unsigned long flags;
if (lp->master)
master_lp = ISDN_MASTER_PRIV(lp);
// printk(KERN_DEBUG "%s: lp:%s(%p) mlp:%s(%p) last(%p) next(%p) mndq(%p)\n",
// __func__, lp->name, lp, master_lp->name, master_lp, lp->last, lp->next, master_lp->netdev->queue);
spin_lock_irqsave(&master_lp->netdev->queue_lock, flags);
lp->last->next = lp->next;
lp->next->last = lp->last;
if (master_lp->netdev->queue == lp) {
master_lp->netdev->queue = lp->next;
if (lp->next == lp) { /* last in queue */
master_lp->netdev->queue = master_lp->netdev->local;
}
}
lp->next = lp->last = lp; /* (re)set own pointers */
// printk(KERN_DEBUG "%s: mndq(%p)\n",
// __func__, master_lp->netdev->queue);
spin_unlock_irqrestore(&master_lp->netdev->queue_lock, flags);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,41 +0,0 @@
/* $Id: isdn_ppp.h,v 1.1.2.2 2004/01/12 22:37:19 keil Exp $
*
* header for Linux ISDN subsystem, functions for synchronous PPP (linklevel).
*
* Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#include <linux/ppp_defs.h> /* for PPP_PROTOCOL */
#include <linux/isdn_ppp.h> /* for isdn_ppp info */
extern int isdn_ppp_read(int, struct file *, char __user *, int);
extern int isdn_ppp_write(int, struct file *, const char __user *, int);
extern int isdn_ppp_open(int, struct file *);
extern int isdn_ppp_init(void);
extern void isdn_ppp_cleanup(void);
extern int isdn_ppp_free(isdn_net_local *);
extern int isdn_ppp_bind(isdn_net_local *);
extern int isdn_ppp_autodial_filter(struct sk_buff *, isdn_net_local *);
extern int isdn_ppp_xmit(struct sk_buff *, struct net_device *);
extern void isdn_ppp_receive(isdn_net_dev *, isdn_net_local *, struct sk_buff *);
extern int isdn_ppp_dev_ioctl(struct net_device *, struct ifreq *, int);
extern __poll_t isdn_ppp_poll(struct file *, struct poll_table_struct *);
extern int isdn_ppp_ioctl(int, struct file *, unsigned int, unsigned long);
extern void isdn_ppp_release(int, struct file *);
extern int isdn_ppp_dial_slave(char *);
extern void isdn_ppp_wakeup_daemon(isdn_net_local *);
extern int isdn_ppp_register_compressor(struct isdn_ppp_compressor *ipc);
extern int isdn_ppp_unregister_compressor(struct isdn_ppp_compressor *ipc);
#define IPPP_OPEN 0x01
#define IPPP_CONNECT 0x02
#define IPPP_CLOSEWAIT 0x04
#define IPPP_NOBLOCK 0x08
#define IPPP_ASSIGNED 0x10
#define IPPP_MAX_HEADER 10

File diff suppressed because it is too large Load Diff

View File

@ -1,120 +0,0 @@
/* $Id: isdn_tty.h,v 1.1.2.2 2004/01/12 22:37:19 keil Exp $
*
* header for Linux ISDN subsystem, tty related functions (linklevel).
*
* Copyright 1994-1999 by Fritz Elfert (fritz@isdn4linux.de)
* Copyright 1995,96 by Thinking Objects Software GmbH Wuerzburg
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#define DLE 0x10
#define ETX 0x03
#define DC4 0x14
/*
* Definition of some special Registers of AT-Emulator
*/
#define REG_RINGATA 0
#define REG_RINGCNT 1 /* ring counter register */
#define REG_ESC 2
#define REG_CR 3
#define REG_LF 4
#define REG_BS 5
#define REG_WAITC 7
#define REG_RESP 12 /* show response messages register */
#define BIT_RESP 1 /* show response messages bit */
#define REG_RESPNUM 12 /* show numeric responses register */
#define BIT_RESPNUM 2 /* show numeric responses bit */
#define REG_ECHO 12
#define BIT_ECHO 4
#define REG_DCD 12
#define BIT_DCD 8
#define REG_CTS 12
#define BIT_CTS 16
#define REG_DTRR 12
#define BIT_DTRR 32
#define REG_DSR 12
#define BIT_DSR 64
#define REG_CPPP 12
#define BIT_CPPP 128
#define REG_DXMT 13
#define BIT_DXMT 1
#define REG_T70 13
#define BIT_T70 2
#define BIT_T70_EXT 32
#define REG_DTRHUP 13
#define BIT_DTRHUP 4
#define REG_RESPXT 13
#define BIT_RESPXT 8
#define REG_CIDONCE 13
#define BIT_CIDONCE 16
#define REG_RUNG 13 /* show RUNG message register */
#define BIT_RUNG 64 /* show RUNG message bit */
#define REG_DISPLAY 13
#define BIT_DISPLAY 128
#define REG_L2PROT 14
#define REG_L3PROT 15
#define REG_PSIZE 16
#define REG_WSIZE 17
#define REG_SI1 18
#define REG_SI2 19
#define REG_SI1I 20
#define REG_PLAN 21
#define REG_SCREEN 22
#define REG_CPN 23
#define BIT_CPN 1
#define REG_CPNFCON 23
#define BIT_CPNFCON 2
#define REG_CDN 23
#define BIT_CDN 4
/* defines for result codes */
#define RESULT_OK 0
#define RESULT_CONNECT 1
#define RESULT_RING 2
#define RESULT_NO_CARRIER 3
#define RESULT_ERROR 4
#define RESULT_CONNECT64000 5
#define RESULT_NO_DIALTONE 6
#define RESULT_BUSY 7
#define RESULT_NO_ANSWER 8
#define RESULT_RINGING 9
#define RESULT_NO_MSN_EAZ 10
#define RESULT_VCON 11
#define RESULT_RUNG 12
#define TTY_IS_FCLASS1(info) \
((info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_FAX) && \
(info->emu.mdmreg[REG_L3PROT] == ISDN_PROTO_L3_FCLASS1))
#define TTY_IS_FCLASS2(info) \
((info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_FAX) && \
(info->emu.mdmreg[REG_L3PROT] == ISDN_PROTO_L3_FCLASS2))
extern void isdn_tty_modem_escape(void);
extern void isdn_tty_modem_ring(void);
extern void isdn_tty_carrier_timeout(void);
extern void isdn_tty_modem_xmit(void);
extern int isdn_tty_modem_init(void);
extern void isdn_tty_exit(void);
extern void isdn_tty_readmodem(void);
extern int isdn_tty_find_icall(int, int, setup_parm *);
extern int isdn_tty_stat_callback(int, isdn_ctrl *);
extern int isdn_tty_rcv_skb(int, int, int, struct sk_buff *);
extern int isdn_tty_capi_facility(capi_msg *cm);
extern void isdn_tty_at_cout(char *, modem_info *);
extern void isdn_tty_modem_hup(modem_info *, int);
#ifdef CONFIG_ISDN_TTY_FAX
extern int isdn_tty_cmd_PLUSF_FAX(char **, modem_info *);
extern int isdn_tty_fax_command(modem_info *, isdn_ctrl *);
extern void isdn_tty_fax_bitorder(modem_info *, struct sk_buff *);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +0,0 @@
/* $Id: isdn_ttyfax.h,v 1.1.2.2 2004/01/12 22:37:19 keil Exp $
*
* header for Linux ISDN subsystem, tty_fax related functions (linklevel).
*
* Copyright 1999 by Armin Schindler (mac@melware.de)
* Copyright 1999 by Ralf Spachmann (mel@melware.de)
* Copyright 1999 by Cytronics & Melware
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#define XON 0x11
#define XOFF 0x13
#define DC2 0x12

View File

@ -1,625 +0,0 @@
/* $Id: isdn_v110.c,v 1.1.2.2 2004/01/12 22:37:19 keil Exp $
*
* Linux ISDN subsystem, V.110 related functions (linklevel).
*
* Copyright by Thomas Pfeiffer (pfeiffer@pds.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/delay.h>
#include <linux/isdn.h>
#include "isdn_v110.h"
#undef ISDN_V110_DEBUG
char *isdn_v110_revision = "$Revision: 1.1.2.2 $";
#define V110_38400 255
#define V110_19200 15
#define V110_9600 3
/*
* The following data are precoded matrices, online and offline matrix
* for 9600, 19200 und 38400, respectively
*/
static unsigned char V110_OnMatrix_9600[] =
{0xfc, 0xfc, 0xfc, 0xfc, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff,
0xff, 0xfd, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xfd,
0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff,
0xff, 0xfd, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xfd};
static unsigned char V110_OffMatrix_9600[] =
{0xfc, 0xfc, 0xfc, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
static unsigned char V110_OnMatrix_19200[] =
{0xf0, 0xf0, 0xff, 0xf7, 0xff, 0xf7, 0xff, 0xf7, 0xff, 0xf7,
0xfd, 0xff, 0xff, 0xf7, 0xff, 0xf7, 0xff, 0xf7, 0xff, 0xf7};
static unsigned char V110_OffMatrix_19200[] =
{0xf0, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
static unsigned char V110_OnMatrix_38400[] =
{0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0xfd, 0x7f, 0x7f, 0x7f, 0x7f};
static unsigned char V110_OffMatrix_38400[] =
{0x00, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff};
/*
* FlipBits reorders sequences of keylen bits in one byte.
* E.g. source order 7654321 will be converted to 45670123 when keylen = 4,
* and to 67452301 when keylen = 2. This is necessary because ordering on
* the isdn line is the other way.
*/
static inline unsigned char
FlipBits(unsigned char c, int keylen)
{
unsigned char b = c;
unsigned char bit = 128;
int i;
int j;
int hunks = (8 / keylen);
c = 0;
for (i = 0; i < hunks; i++) {
for (j = 0; j < keylen; j++) {
if (b & (bit >> j))
c |= bit >> (keylen - j - 1);
}
bit >>= keylen;
}
return c;
}
/* isdn_v110_open allocates and initializes private V.110 data
* structures and returns a pointer to these.
*/
static isdn_v110_stream *
isdn_v110_open(unsigned char key, int hdrlen, int maxsize)
{
int i;
isdn_v110_stream *v;
if ((v = kzalloc(sizeof(isdn_v110_stream), GFP_ATOMIC)) == NULL)
return NULL;
v->key = key;
v->nbits = 0;
for (i = 0; key & (1 << i); i++)
v->nbits++;
v->nbytes = 8 / v->nbits;
v->decodelen = 0;
switch (key) {
case V110_38400:
v->OnlineFrame = V110_OnMatrix_38400;
v->OfflineFrame = V110_OffMatrix_38400;
break;
case V110_19200:
v->OnlineFrame = V110_OnMatrix_19200;
v->OfflineFrame = V110_OffMatrix_19200;
break;
default:
v->OnlineFrame = V110_OnMatrix_9600;
v->OfflineFrame = V110_OffMatrix_9600;
break;
}
v->framelen = v->nbytes * 10;
v->SyncInit = 5;
v->introducer = 0;
v->dbit = 1;
v->b = 0;
v->skbres = hdrlen;
v->maxsize = maxsize - hdrlen;
if ((v->encodebuf = kmalloc(maxsize, GFP_ATOMIC)) == NULL) {
kfree(v);
return NULL;
}
return v;
}
/* isdn_v110_close frees private V.110 data structures */
void
isdn_v110_close(isdn_v110_stream *v)
{
if (v == NULL)
return;
#ifdef ISDN_V110_DEBUG
printk(KERN_DEBUG "v110 close\n");
#endif
kfree(v->encodebuf);
kfree(v);
}
/*
* ValidHeaderBytes return the number of valid bytes in v->decodebuf
*/
static int
ValidHeaderBytes(isdn_v110_stream *v)
{
int i;
for (i = 0; (i < v->decodelen) && (i < v->nbytes); i++)
if ((v->decodebuf[i] & v->key) != 0)
break;
return i;
}
/*
* SyncHeader moves the decodebuf ptr to the next valid header
*/
static void
SyncHeader(isdn_v110_stream *v)
{
unsigned char *rbuf = v->decodebuf;
int len = v->decodelen;
if (len == 0)
return;
for (rbuf++, len--; len > 0; len--, rbuf++) /* such den SyncHeader in buf ! */
if ((*rbuf & v->key) == 0) /* erstes byte gefunden ? */
break; /* jupp! */
if (len)
memcpy(v->decodebuf, rbuf, len);
v->decodelen = len;
#ifdef ISDN_V110_DEBUG
printk(KERN_DEBUG "isdn_v110: Header resync\n");
#endif
}
/* DecodeMatrix takes n (n>=1) matrices (v110 frames, 10 bytes) where
len is the number of matrix-lines. len must be a multiple of 10, i.e.
only complete matices must be given.
From these, netto data is extracted and returned in buf. The return-value
is the bytecount of the decoded data.
*/
static int
DecodeMatrix(isdn_v110_stream *v, unsigned char *m, int len, unsigned char *buf)
{
int line = 0;
int buflen = 0;
int mbit = 64;
int introducer = v->introducer;
int dbit = v->dbit;
unsigned char b = v->b;
while (line < len) { /* Are we done with all lines of the matrix? */
if ((line % 10) == 0) { /* the 0. line of the matrix is always 0 ! */
if (m[line] != 0x00) { /* not 0 ? -> error! */
#ifdef ISDN_V110_DEBUG
printk(KERN_DEBUG "isdn_v110: DecodeMatrix, V110 Bad Header\n");
/* returning now is not the right thing, though :-( */
#endif
}
line++; /* next line of matrix */
continue;
} else if ((line % 10) == 5) { /* in line 5 there's only e-bits ! */
if ((m[line] & 0x70) != 0x30) { /* 011 has to be at the beginning! */
#ifdef ISDN_V110_DEBUG
printk(KERN_DEBUG "isdn_v110: DecodeMatrix, V110 Bad 5th line\n");
/* returning now is not the right thing, though :-( */
#endif
}
line++; /* next line */
continue;
} else if (!introducer) { /* every byte starts with 10 (stopbit, startbit) */
introducer = (m[line] & mbit) ? 0 : 1; /* current bit of the matrix */
next_byte:
if (mbit > 2) { /* was it the last bit in this line ? */
mbit >>= 1; /* no -> take next */
continue;
} /* otherwise start with leftmost bit in the next line */
mbit = 64;
line++;
continue;
} else { /* otherwise we need to set a data bit */
if (m[line] & mbit) /* was that bit set in the matrix ? */
b |= dbit; /* yes -> set it in the data byte */
else
b &= dbit - 1; /* no -> clear it in the data byte */
if (dbit < 128) /* is that data byte done ? */
dbit <<= 1; /* no, got the next bit */
else { /* data byte is done */
buf[buflen++] = b; /* copy byte into the output buffer */
introducer = b = 0; /* init of the intro sequence and of the data byte */
dbit = 1; /* next we look for the 0th bit */
}
goto next_byte; /* look for next bit in the matrix */
}
}
v->introducer = introducer;
v->dbit = dbit;
v->b = b;
return buflen; /* return number of bytes in the output buffer */
}
/*
* DecodeStream receives V.110 coded data from the input stream. It recovers the
* original frames.
* The input stream doesn't need to be framed
*/
struct sk_buff *
isdn_v110_decode(isdn_v110_stream *v, struct sk_buff *skb)
{
int i;
int j;
int len;
unsigned char *v110_buf;
unsigned char *rbuf;
if (!skb) {
printk(KERN_WARNING "isdn_v110_decode called with NULL skb!\n");
return NULL;
}
rbuf = skb->data;
len = skb->len;
if (v == NULL) {
/* invalid handle, no chance to proceed */
printk(KERN_WARNING "isdn_v110_decode called with NULL stream!\n");
dev_kfree_skb(skb);
return NULL;
}
if (v->decodelen == 0) /* cache empty? */
for (; len > 0; len--, rbuf++) /* scan for SyncHeader in buf */
if ((*rbuf & v->key) == 0)
break; /* found first byte */
if (len == 0) {
dev_kfree_skb(skb);
return NULL;
}
/* copy new data to decode-buffer */
memcpy(&(v->decodebuf[v->decodelen]), rbuf, len);
v->decodelen += len;
ReSync:
if (v->decodelen < v->nbytes) { /* got a new header ? */
dev_kfree_skb(skb);
return NULL; /* no, try later */
}
if (ValidHeaderBytes(v) != v->nbytes) { /* is that a valid header? */
SyncHeader(v); /* no -> look for header */
goto ReSync;
}
len = (v->decodelen - (v->decodelen % (10 * v->nbytes))) / v->nbytes;
if ((v110_buf = kmalloc(len, GFP_ATOMIC)) == NULL) {
printk(KERN_WARNING "isdn_v110_decode: Couldn't allocate v110_buf\n");
dev_kfree_skb(skb);
return NULL;
}
for (i = 0; i < len; i++) {
v110_buf[i] = 0;
for (j = 0; j < v->nbytes; j++)
v110_buf[i] |= (v->decodebuf[(i * v->nbytes) + j] & v->key) << (8 - ((j + 1) * v->nbits));
v110_buf[i] = FlipBits(v110_buf[i], v->nbits);
}
v->decodelen = (v->decodelen % (10 * v->nbytes));
memcpy(v->decodebuf, &(v->decodebuf[len * v->nbytes]), v->decodelen);
skb_trim(skb, DecodeMatrix(v, v110_buf, len, skb->data));
kfree(v110_buf);
if (skb->len)
return skb;
else {
kfree_skb(skb);
return NULL;
}
}
/* EncodeMatrix takes input data in buf, len is the bytecount.
Data is encoded into v110 frames in m. Return value is the number of
matrix-lines generated.
*/
static int
EncodeMatrix(unsigned char *buf, int len, unsigned char *m, int mlen)
{
int line = 0;
int i = 0;
int mbit = 128;
int dbit = 1;
int introducer = 3;
int ibit[] = {0, 1, 1};
while ((i < len) && (line < mlen)) { /* while we still have input data */
switch (line % 10) { /* in which line of the matrix are we? */
case 0:
m[line++] = 0x00; /* line 0 is always 0 */
mbit = 128; /* go on with the 7th bit */
break;
case 5:
m[line++] = 0xbf; /* line 5 is always 10111111 */
mbit = 128; /* go on with the 7th bit */
break;
}
if (line >= mlen) {
printk(KERN_WARNING "isdn_v110 (EncodeMatrix): buffer full!\n");
return line;
}
next_bit:
switch (mbit) { /* leftmost or rightmost bit ? */
case 1:
line++; /* rightmost -> go to next line */
if (line >= mlen) {
printk(KERN_WARNING "isdn_v110 (EncodeMatrix): buffer full!\n");
return line;
}
/* fall through */
case 128:
m[line] = 128; /* leftmost -> set byte to 1000000 */
mbit = 64; /* current bit in the matrix line */
continue;
}
if (introducer) { /* set 110 sequence ? */
introducer--; /* set on digit less */
m[line] |= ibit[introducer] ? mbit : 0; /* set corresponding bit */
mbit >>= 1; /* bit of matrix line >> 1 */
goto next_bit; /* and go on there */
} /* else push data bits into the matrix! */
m[line] |= (buf[i] & dbit) ? mbit : 0; /* set data bit in matrix */
if (dbit == 128) { /* was it the last one? */
dbit = 1; /* then go on with first bit of */
i++; /* next byte in input buffer */
if (i < len) /* input buffer done ? */
introducer = 3; /* no, write introducer 110 */
else { /* input buffer done ! */
m[line] |= (mbit - 1) & 0xfe; /* set remaining bits in line to 1 */
break;
}
} else /* not the last data bit */
dbit <<= 1; /* then go to next data bit */
mbit >>= 1; /* go to next bit of matrix */
goto next_bit;
}
/* if necessary, generate remaining lines of the matrix... */
if ((line) && ((line + 10) < mlen))
switch (++line % 10) {
case 1:
m[line++] = 0xfe;
/* fall through */
case 2:
m[line++] = 0xfe;
/* fall through */
case 3:
m[line++] = 0xfe;
/* fall through */
case 4:
m[line++] = 0xfe;
/* fall through */
case 5:
m[line++] = 0xbf;
/* fall through */
case 6:
m[line++] = 0xfe;
/* fall through */
case 7:
m[line++] = 0xfe;
/* fall through */
case 8:
m[line++] = 0xfe;
/* fall through */
case 9:
m[line++] = 0xfe;
}
return line; /* that's how many lines we have */
}
/*
* Build a sync frame.
*/
static struct sk_buff *
isdn_v110_sync(isdn_v110_stream *v)
{
struct sk_buff *skb;
if (v == NULL) {
/* invalid handle, no chance to proceed */
printk(KERN_WARNING "isdn_v110_sync called with NULL stream!\n");
return NULL;
}
if ((skb = dev_alloc_skb(v->framelen + v->skbres))) {
skb_reserve(skb, v->skbres);
skb_put_data(skb, v->OfflineFrame, v->framelen);
}
return skb;
}
/*
* Build an idle frame.
*/
static struct sk_buff *
isdn_v110_idle(isdn_v110_stream *v)
{
struct sk_buff *skb;
if (v == NULL) {
/* invalid handle, no chance to proceed */
printk(KERN_WARNING "isdn_v110_sync called with NULL stream!\n");
return NULL;
}
if ((skb = dev_alloc_skb(v->framelen + v->skbres))) {
skb_reserve(skb, v->skbres);
skb_put_data(skb, v->OnlineFrame, v->framelen);
}
return skb;
}
struct sk_buff *
isdn_v110_encode(isdn_v110_stream *v, struct sk_buff *skb)
{
int i;
int j;
int rlen;
int mlen;
int olen;
int size;
int sval1;
int sval2;
int nframes;
unsigned char *v110buf;
unsigned char *rbuf;
struct sk_buff *nskb;
if (v == NULL) {
/* invalid handle, no chance to proceed */
printk(KERN_WARNING "isdn_v110_encode called with NULL stream!\n");
return NULL;
}
if (!skb) {
/* invalid skb, no chance to proceed */
printk(KERN_WARNING "isdn_v110_encode called with NULL skb!\n");
return NULL;
}
rlen = skb->len;
nframes = (rlen + 3) / 4;
v110buf = v->encodebuf;
if ((nframes * 40) > v->maxsize) {
size = v->maxsize;
rlen = v->maxsize / 40;
} else
size = nframes * 40;
if (!(nskb = dev_alloc_skb(size + v->skbres + sizeof(int)))) {
printk(KERN_WARNING "isdn_v110_encode: Couldn't alloc skb\n");
return NULL;
}
skb_reserve(nskb, v->skbres + sizeof(int));
if (skb->len == 0) {
skb_put_data(nskb, v->OnlineFrame, v->framelen);
*((int *)skb_push(nskb, sizeof(int))) = 0;
return nskb;
}
mlen = EncodeMatrix(skb->data, rlen, v110buf, size);
/* now distribute 2 or 4 bits each to the output stream! */
rbuf = skb_put(nskb, size);
olen = 0;
sval1 = 8 - v->nbits;
sval2 = v->key << sval1;
for (i = 0; i < mlen; i++) {
v110buf[i] = FlipBits(v110buf[i], v->nbits);
for (j = 0; j < v->nbytes; j++) {
if (size--)
*rbuf++ = ~v->key | (((v110buf[i] << (j * v->nbits)) & sval2) >> sval1);
else {
printk(KERN_WARNING "isdn_v110_encode: buffers full!\n");
goto buffer_full;
}
olen++;
}
}
buffer_full:
skb_trim(nskb, olen);
*((int *)skb_push(nskb, sizeof(int))) = rlen;
return nskb;
}
int
isdn_v110_stat_callback(int idx, isdn_ctrl *c)
{
isdn_v110_stream *v = NULL;
int i;
int ret = 0;
if (idx < 0)
return 0;
switch (c->command) {
case ISDN_STAT_BSENT:
/* Keep the send-queue of the driver filled
* with frames:
* If number of outstanding frames < 3,
* send down an Idle-Frame (or an Sync-Frame, if
* v->SyncInit != 0).
*/
if (!(v = dev->v110[idx]))
return 0;
atomic_inc(&dev->v110use[idx]);
for (i = 0; i * v->framelen < c->parm.length; i++) {
if (v->skbidle > 0) {
v->skbidle--;
ret = 1;
} else {
if (v->skbuser > 0)
v->skbuser--;
ret = 0;
}
}
for (i = v->skbuser + v->skbidle; i < 2; i++) {
struct sk_buff *skb;
if (v->SyncInit > 0)
skb = isdn_v110_sync(v);
else
skb = isdn_v110_idle(v);
if (skb) {
if (dev->drv[c->driver]->interface->writebuf_skb(c->driver, c->arg, 1, skb) <= 0) {
dev_kfree_skb(skb);
break;
} else {
if (v->SyncInit)
v->SyncInit--;
v->skbidle++;
}
} else
break;
}
atomic_dec(&dev->v110use[idx]);
return ret;
case ISDN_STAT_DHUP:
case ISDN_STAT_BHUP:
while (1) {
atomic_inc(&dev->v110use[idx]);
if (atomic_dec_and_test(&dev->v110use[idx])) {
isdn_v110_close(dev->v110[idx]);
dev->v110[idx] = NULL;
break;
}
mdelay(1);
}
break;
case ISDN_STAT_BCONN:
if (dev->v110emu[idx] && (dev->v110[idx] == NULL)) {
int hdrlen = dev->drv[c->driver]->interface->hl_hdrlen;
int maxsize = dev->drv[c->driver]->interface->maxbufsize;
atomic_inc(&dev->v110use[idx]);
switch (dev->v110emu[idx]) {
case ISDN_PROTO_L2_V11096:
dev->v110[idx] = isdn_v110_open(V110_9600, hdrlen, maxsize);
break;
case ISDN_PROTO_L2_V11019:
dev->v110[idx] = isdn_v110_open(V110_19200, hdrlen, maxsize);
break;
case ISDN_PROTO_L2_V11038:
dev->v110[idx] = isdn_v110_open(V110_38400, hdrlen, maxsize);
break;
default:;
}
if ((v = dev->v110[idx])) {
while (v->SyncInit) {
struct sk_buff *skb = isdn_v110_sync(v);
if (dev->drv[c->driver]->interface->writebuf_skb(c->driver, c->arg, 1, skb) <= 0) {
dev_kfree_skb(skb);
/* Unable to send, try later */
break;
}
v->SyncInit--;
v->skbidle++;
}
} else
printk(KERN_WARNING "isdn_v110: Couldn't open stream for chan %d\n", idx);
atomic_dec(&dev->v110use[idx]);
}
break;
default:
return 0;
}
return 0;
}

View File

@ -1,29 +0,0 @@
/* $Id: isdn_v110.h,v 1.1.2.2 2004/01/12 22:37:19 keil Exp $
*
* Linux ISDN subsystem, V.110 related functions (linklevel).
*
* Copyright by Thomas Pfeiffer (pfeiffer@pds.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#ifndef _isdn_v110_h_
#define _isdn_v110_h_
/*
* isdn_v110_encode will take raw data and encode it using V.110
*/
extern struct sk_buff *isdn_v110_encode(isdn_v110_stream *, struct sk_buff *);
/*
* isdn_v110_decode receives V.110 coded data from the stream and rebuilds
* frames from them. The source stream doesn't need to be framed.
*/
extern struct sk_buff *isdn_v110_decode(isdn_v110_stream *, struct sk_buff *);
extern int isdn_v110_stat_callback(int, isdn_ctrl *);
extern void isdn_v110_close(isdn_v110_stream *v);
#endif

View File

@ -1,332 +0,0 @@
/* $Id: isdn_x25iface.c,v 1.1.2.2 2004/01/12 22:37:19 keil Exp $
*
* Linux ISDN subsystem, X.25 related functions
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
* stuff needed to support the Linux X.25 PLP code on top of devices that
* can provide a lab_b service using the concap_proto mechanism.
* This module supports a network interface which provides lapb_sematics
* -- as defined in Documentation/networking/x25-iface.txt -- to
* the upper layer and assumes that the lower layer provides a reliable
* data link service by means of the concap_device_ops callbacks.
*
* Only protocol specific stuff goes here. Device specific stuff
* goes to another -- device related -- concap_proto support source file.
*
*/
/* #include <linux/isdn.h> */
#include <linux/netdevice.h>
#include <linux/concap.h>
#include <linux/slab.h>
#include <linux/wanrouter.h>
#include <net/x25device.h>
#include "isdn_x25iface.h"
/* for debugging messages not to cause an oops when device pointer is NULL*/
#define MY_DEVNAME(dev) ((dev) ? (dev)->name : "DEVICE UNSPECIFIED")
typedef struct isdn_x25iface_proto_data {
int magic;
enum wan_states state;
/* Private stuff, not to be accessed via proto_data. We provide the
other storage for the concap_proto instance here as well,
enabling us to allocate both with just one kmalloc(): */
struct concap_proto priv;
} ix25_pdata_t;
/* is now in header file (extern): struct concap_proto * isdn_x25iface_proto_new(void); */
static void isdn_x25iface_proto_del(struct concap_proto *);
static int isdn_x25iface_proto_close(struct concap_proto *);
static int isdn_x25iface_proto_restart(struct concap_proto *,
struct net_device *,
struct concap_device_ops *);
static int isdn_x25iface_xmit(struct concap_proto *, struct sk_buff *);
static int isdn_x25iface_receive(struct concap_proto *, struct sk_buff *);
static int isdn_x25iface_connect_ind(struct concap_proto *);
static int isdn_x25iface_disconn_ind(struct concap_proto *);
static struct concap_proto_ops ix25_pops = {
.proto_new = &isdn_x25iface_proto_new,
.proto_del = &isdn_x25iface_proto_del,
.restart = &isdn_x25iface_proto_restart,
.close = &isdn_x25iface_proto_close,
.encap_and_xmit = &isdn_x25iface_xmit,
.data_ind = &isdn_x25iface_receive,
.connect_ind = &isdn_x25iface_connect_ind,
.disconn_ind = &isdn_x25iface_disconn_ind
};
/* error message helper function */
static void illegal_state_warn(unsigned state, unsigned char firstbyte)
{
printk(KERN_WARNING "isdn_x25iface: firstbyte %x illegal in"
"current state %d\n", firstbyte, state);
}
/* check protocol data field for consistency */
static int pdata_is_bad(ix25_pdata_t *pda) {
if (pda && pda->magic == ISDN_X25IFACE_MAGIC) return 0;
printk(KERN_WARNING
"isdn_x25iface_xxx: illegal pointer to proto data\n");
return 1;
}
/* create a new x25 interface protocol instance
*/
struct concap_proto *isdn_x25iface_proto_new(void)
{
ix25_pdata_t *tmp = kmalloc(sizeof(ix25_pdata_t), GFP_KERNEL);
IX25DEBUG("isdn_x25iface_proto_new\n");
if (tmp) {
tmp->magic = ISDN_X25IFACE_MAGIC;
tmp->state = WAN_UNCONFIGURED;
/* private data space used to hold the concap_proto data.
Only to be accessed via the returned pointer */
spin_lock_init(&tmp->priv.lock);
tmp->priv.dops = NULL;
tmp->priv.net_dev = NULL;
tmp->priv.pops = &ix25_pops;
tmp->priv.flags = 0;
tmp->priv.proto_data = tmp;
return (&(tmp->priv));
}
return NULL;
};
/* close the x25iface encapsulation protocol
*/
static int isdn_x25iface_proto_close(struct concap_proto *cprot) {
ix25_pdata_t *tmp;
int ret = 0;
ulong flags;
if (!cprot) {
printk(KERN_ERR "isdn_x25iface_proto_close: "
"invalid concap_proto pointer\n");
return -1;
}
IX25DEBUG("isdn_x25iface_proto_close %s \n", MY_DEVNAME(cprot->net_dev));
spin_lock_irqsave(&cprot->lock, flags);
cprot->dops = NULL;
cprot->net_dev = NULL;
tmp = cprot->proto_data;
if (pdata_is_bad(tmp)) {
ret = -1;
} else {
tmp->state = WAN_UNCONFIGURED;
}
spin_unlock_irqrestore(&cprot->lock, flags);
return ret;
}
/* Delete the x25iface encapsulation protocol instance
*/
static void isdn_x25iface_proto_del(struct concap_proto *cprot) {
ix25_pdata_t *tmp;
IX25DEBUG("isdn_x25iface_proto_del \n");
if (!cprot) {
printk(KERN_ERR "isdn_x25iface_proto_del: "
"concap_proto pointer is NULL\n");
return;
}
tmp = cprot->proto_data;
if (tmp == NULL) {
printk(KERN_ERR "isdn_x25iface_proto_del: inconsistent "
"proto_data pointer (maybe already deleted?)\n");
return;
}
/* close if the protocol is still open */
if (cprot->dops) isdn_x25iface_proto_close(cprot);
/* freeing the storage should be sufficient now. But some additional
settings might help to catch wild pointer bugs */
tmp->magic = 0;
cprot->proto_data = NULL;
kfree(tmp);
return;
}
/* (re-)initialize the data structures for x25iface encapsulation
*/
static int isdn_x25iface_proto_restart(struct concap_proto *cprot,
struct net_device *ndev,
struct concap_device_ops *dops)
{
ix25_pdata_t *pda = cprot->proto_data;
ulong flags;
IX25DEBUG("isdn_x25iface_proto_restart %s \n", MY_DEVNAME(ndev));
if (pdata_is_bad(pda)) return -1;
if (!(dops && dops->data_req && dops->connect_req
&& dops->disconn_req)) {
printk(KERN_WARNING "isdn_x25iface_restart: required dops"
" missing\n");
isdn_x25iface_proto_close(cprot);
return -1;
}
spin_lock_irqsave(&cprot->lock, flags);
cprot->net_dev = ndev;
cprot->pops = &ix25_pops;
cprot->dops = dops;
pda->state = WAN_DISCONNECTED;
spin_unlock_irqrestore(&cprot->lock, flags);
return 0;
}
/* deliver a dl_data frame received from i4l HL driver to the network layer
*/
static int isdn_x25iface_receive(struct concap_proto *cprot, struct sk_buff *skb)
{
IX25DEBUG("isdn_x25iface_receive %s \n", MY_DEVNAME(cprot->net_dev));
if (((ix25_pdata_t *)(cprot->proto_data))
->state == WAN_CONNECTED) {
if (skb_push(skb, 1)) {
skb->data[0] = X25_IFACE_DATA;
skb->protocol = x25_type_trans(skb, cprot->net_dev);
netif_rx(skb);
return 0;
}
}
printk(KERN_WARNING "isdn_x25iface_receive %s: not connected, skb dropped\n", MY_DEVNAME(cprot->net_dev));
dev_kfree_skb(skb);
return -1;
}
/* a connection set up is indicated by lower layer
*/
static int isdn_x25iface_connect_ind(struct concap_proto *cprot)
{
struct sk_buff *skb;
enum wan_states *state_p
= &(((ix25_pdata_t *)(cprot->proto_data))->state);
IX25DEBUG("isdn_x25iface_connect_ind %s \n"
, MY_DEVNAME(cprot->net_dev));
if (*state_p == WAN_UNCONFIGURED) {
printk(KERN_WARNING
"isdn_x25iface_connect_ind while unconfigured %s\n"
, MY_DEVNAME(cprot->net_dev));
return -1;
}
*state_p = WAN_CONNECTED;
skb = dev_alloc_skb(1);
if (skb) {
skb_put_u8(skb, X25_IFACE_CONNECT);
skb->protocol = x25_type_trans(skb, cprot->net_dev);
netif_rx(skb);
return 0;
} else {
printk(KERN_WARNING "isdn_x25iface_connect_ind: "
" out of memory -- disconnecting\n");
cprot->dops->disconn_req(cprot);
return -1;
}
}
/* a disconnect is indicated by lower layer
*/
static int isdn_x25iface_disconn_ind(struct concap_proto *cprot)
{
struct sk_buff *skb;
enum wan_states *state_p
= &(((ix25_pdata_t *)(cprot->proto_data))->state);
IX25DEBUG("isdn_x25iface_disconn_ind %s \n", MY_DEVNAME(cprot->net_dev));
if (*state_p == WAN_UNCONFIGURED) {
printk(KERN_WARNING
"isdn_x25iface_disconn_ind while unconfigured\n");
return -1;
}
if (!cprot->net_dev) return -1;
*state_p = WAN_DISCONNECTED;
skb = dev_alloc_skb(1);
if (skb) {
skb_put_u8(skb, X25_IFACE_DISCONNECT);
skb->protocol = x25_type_trans(skb, cprot->net_dev);
netif_rx(skb);
return 0;
} else {
printk(KERN_WARNING "isdn_x25iface_disconn_ind:"
" out of memory\n");
return -1;
}
}
/* process a frame handed over to us from linux network layer. First byte
semantics as defined in Documentation/networking/x25-iface.txt
*/
static int isdn_x25iface_xmit(struct concap_proto *cprot, struct sk_buff *skb)
{
unsigned char firstbyte = skb->data[0];
enum wan_states *state = &((ix25_pdata_t *)cprot->proto_data)->state;
int ret = 0;
IX25DEBUG("isdn_x25iface_xmit: %s first=%x state=%d\n",
MY_DEVNAME(cprot->net_dev), firstbyte, *state);
switch (firstbyte) {
case X25_IFACE_DATA:
if (*state == WAN_CONNECTED) {
skb_pull(skb, 1);
netif_trans_update(cprot->net_dev);
ret = (cprot->dops->data_req(cprot, skb));
/* prepare for future retransmissions */
if (ret) skb_push(skb, 1);
return ret;
}
illegal_state_warn(*state, firstbyte);
break;
case X25_IFACE_CONNECT:
if (*state == WAN_DISCONNECTED) {
*state = WAN_CONNECTING;
ret = cprot->dops->connect_req(cprot);
if (ret) {
/* reset state and notify upper layer about
* immidiatly failed attempts */
isdn_x25iface_disconn_ind(cprot);
}
} else {
illegal_state_warn(*state, firstbyte);
}
break;
case X25_IFACE_DISCONNECT:
switch (*state) {
case WAN_DISCONNECTED:
/* Should not happen. However, give upper layer a
chance to recover from inconstistency but don't
trust the lower layer sending the disconn_confirm
when already disconnected */
printk(KERN_WARNING "isdn_x25iface_xmit: disconnect "
" requested while disconnected\n");
isdn_x25iface_disconn_ind(cprot);
break; /* prevent infinite loops */
case WAN_CONNECTING:
case WAN_CONNECTED:
*state = WAN_DISCONNECTED;
cprot->dops->disconn_req(cprot);
break;
default:
illegal_state_warn(*state, firstbyte);
}
break;
case X25_IFACE_PARAMS:
printk(KERN_WARNING "isdn_x25iface_xmit: setting of lapb"
" options not yet supported\n");
break;
default:
printk(KERN_WARNING "isdn_x25iface_xmit: frame with illegal"
" first byte %x ignored:\n", firstbyte);
}
dev_kfree_skb(skb);
return 0;
}

View File

@ -1,30 +0,0 @@
/* $Id: isdn_x25iface.h,v 1.1.2.2 2004/01/12 22:37:19 keil Exp $
*
* header for Linux ISDN subsystem, x.25 related functions
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#ifndef _LINUX_ISDN_X25IFACE_H
#define _LINUX_ISDN_X25IFACE_H
#define ISDN_X25IFACE_MAGIC 0x1e75a2b9
/* #define DEBUG_ISDN_X25 if you want isdn_x25 debugging messages */
#ifdef DEBUG_ISDN_X25
# define IX25DEBUG(fmt, args...) printk(KERN_DEBUG fmt, ##args)
#else
# define IX25DEBUG(fmt, args...)
#endif
#include <linux/skbuff.h>
#include <linux/isdn.h>
#include <linux/concap.h>
extern struct concap_proto_ops *isdn_x25iface_concap_proto_ops_pt;
extern struct concap_proto *isdn_x25iface_proto_new(void);
#endif

View File

@ -1,6 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-only
# Makefile for the isdnloop ISDN device driver
# Each configuration option enables a list of files.
obj-$(CONFIG_ISDN_DRV_LOOP) += isdnloop.o

File diff suppressed because it is too large Load Diff

View File

@ -1,112 +0,0 @@
/* $Id: isdnloop.h,v 1.5.6.3 2001/09/23 22:24:56 kai Exp $
*
* Loopback lowlevel module for testing of linklevel.
*
* Copyright 1997 by Fritz Elfert (fritz@isdn4linux.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#ifndef isdnloop_h
#define isdnloop_h
#define ISDNLOOP_IOCTL_DEBUGVAR 0
#define ISDNLOOP_IOCTL_ADDCARD 1
#define ISDNLOOP_IOCTL_LEASEDCFG 2
#define ISDNLOOP_IOCTL_STARTUP 3
/* Struct for adding new cards */
typedef struct isdnloop_cdef {
char id1[10];
} isdnloop_cdef;
/* Struct for configuring cards */
typedef struct isdnloop_sdef {
int ptype;
char num[3][20];
} isdnloop_sdef;
#if defined(__KERNEL__) || defined(__DEBUGVAR__)
#ifdef __KERNEL__
/* Kernel includes */
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/major.h>
#include <asm/io.h>
#include <linux/kernel.h>
#include <linux/signal.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/mman.h>
#include <linux/ioport.h>
#include <linux/timer.h>
#include <linux/wait.h>
#include <linux/isdnif.h>
#endif /* __KERNEL__ */
#define ISDNLOOP_FLAGS_B1ACTIVE 1 /* B-Channel-1 is open */
#define ISDNLOOP_FLAGS_B2ACTIVE 2 /* B-Channel-2 is open */
#define ISDNLOOP_FLAGS_RUNNING 4 /* Cards driver activated */
#define ISDNLOOP_FLAGS_RBTIMER 8 /* scheduling of B-Channel-poll */
#define ISDNLOOP_TIMER_BCREAD 1 /* B-Channel poll-cycle */
#define ISDNLOOP_TIMER_DCREAD (HZ/2) /* D-Channel poll-cycle */
#define ISDNLOOP_TIMER_ALERTWAIT (10 * HZ) /* Alert timeout */
#define ISDNLOOP_MAX_SQUEUE 65536 /* Max. outstanding send-data */
#define ISDNLOOP_BCH 2 /* channels per card */
/*
* Per card driver data
*/
typedef struct isdnloop_card {
struct isdnloop_card *next; /* Pointer to next device struct */
struct isdnloop_card
*rcard[ISDNLOOP_BCH]; /* Pointer to 'remote' card */
int rch[ISDNLOOP_BCH]; /* 'remote' channel */
int myid; /* Driver-Nr. assigned by linklevel */
int leased; /* Flag: This Adapter is connected */
/* to a leased line */
int sil[ISDNLOOP_BCH]; /* SI's to listen for */
char eazlist[ISDNLOOP_BCH][11];
/* EAZ's to listen for */
char s0num[3][20]; /* 1TR6 base-number or MSN's */
unsigned short flags; /* Statusflags */
int ptype; /* Protocol type (1TR6 or Euro) */
struct timer_list st_timer; /* Timer for Status-Polls */
struct timer_list rb_timer; /* Timer for B-Channel-Polls */
struct timer_list
c_timer[ISDNLOOP_BCH]; /* Timer for Alerting */
int l2_proto[ISDNLOOP_BCH]; /* Current layer-2-protocol */
isdn_if interface; /* Interface to upper layer */
int iptr; /* Index to imsg-buffer */
char imsg[60]; /* Internal buf for status-parsing */
int optr; /* Index to omsg-buffer */
char omsg[60]; /* Internal buf for cmd-parsing */
char msg_buf[2048]; /* Buffer for status-messages */
char *msg_buf_write; /* Writepointer for statusbuffer */
char *msg_buf_read; /* Readpointer for statusbuffer */
char *msg_buf_end; /* Pointer to end of statusbuffer */
int sndcount[ISDNLOOP_BCH]; /* Byte-counters for B-Ch.-send */
struct sk_buff_head
bqueue[ISDNLOOP_BCH]; /* B-Channel queues */
struct sk_buff_head dqueue; /* D-Channel queue */
spinlock_t isdnloop_lock;
} isdnloop_card;
/*
* Main driver data
*/
#ifdef __KERNEL__
static isdnloop_card *cards = (isdnloop_card *) 0;
#endif /* __KERNEL__ */
/* Utility-Macros */
#define CID (card->interface.id)
#endif /* defined(__KERNEL__) || defined(__DEBUGVAR__) */
#endif /* isdnloop_h */

View File

@ -1,112 +0,0 @@
/* $Id: concap.h,v 1.3.2.2 2004/01/12 23:08:35 keil Exp $
*
* Copyright 1997 by Henner Eisen <eis@baty.hanse.de>
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*/
#ifndef _LINUX_CONCAP_H
#define _LINUX_CONCAP_H
#include <linux/skbuff.h>
#include <linux/netdevice.h>
/* Stuff to support encapsulation protocols genericly. The encapsulation
protocol is processed at the uppermost layer of the network interface.
Based on a ideas developed in a 'synchronous device' thread in the
linux-x25 mailing list contributed by Alan Cox, Thomasz Motylewski
and Jonathan Naylor.
For more documetation on this refer to Documentation/isdn/README.concap
*/
struct concap_proto_ops;
struct concap_device_ops;
/* this manages all data needed by the encapsulation protocol
*/
struct concap_proto{
struct net_device *net_dev; /* net device using our service */
struct concap_device_ops *dops; /* callbacks provided by device */
struct concap_proto_ops *pops; /* callbacks provided by us */
spinlock_t lock;
int flags;
void *proto_data; /* protocol specific private data, to
be accessed via *pops methods only*/
/*
:
whatever
:
*/
};
/* Operations to be supported by the net device. Called by the encapsulation
* protocol entity. No receive method is offered because the encapsulation
* protocol directly calls netif_rx().
*/
struct concap_device_ops{
/* to request data is submitted by device*/
int (*data_req)(struct concap_proto *, struct sk_buff *);
/* Control methods must be set to NULL by devices which do not
support connection control.*/
/* to request a connection is set up */
int (*connect_req)(struct concap_proto *);
/* to request a connection is released */
int (*disconn_req)(struct concap_proto *);
};
/* Operations to be supported by the encapsulation protocol. Called by
* device driver.
*/
struct concap_proto_ops{
/* create a new encapsulation protocol instance of same type */
struct concap_proto * (*proto_new) (void);
/* delete encapsulation protocol instance and free all its resources.
cprot may no loger be referenced after calling this */
void (*proto_del)(struct concap_proto *cprot);
/* initialize the protocol's data. To be called at interface startup
or when the device driver resets the interface. All services of the
encapsulation protocol may be used after this*/
int (*restart)(struct concap_proto *cprot,
struct net_device *ndev,
struct concap_device_ops *dops);
/* inactivate an encapsulation protocol instance. The encapsulation
protocol may not call any *dops methods after this. */
int (*close)(struct concap_proto *cprot);
/* process a frame handed down to us by upper layer */
int (*encap_and_xmit)(struct concap_proto *cprot, struct sk_buff *skb);
/* to be called for each data entity received from lower layer*/
int (*data_ind)(struct concap_proto *cprot, struct sk_buff *skb);
/* to be called when a connection was set up/down.
Protocols that don't process these primitives might fill in
dummy methods here */
int (*connect_ind)(struct concap_proto *cprot);
int (*disconn_ind)(struct concap_proto *cprot);
/*
Some network device support functions, like net_header(), rebuild_header(),
and others, that depend solely on the encapsulation protocol, might
be provided here, too. The net device would just fill them in its
corresponding fields when it is opened.
*/
};
/* dummy restart/close/connect/reset/disconn methods
*/
extern int concap_nop(struct concap_proto *cprot);
/* dummy submit method
*/
extern int concap_drop_skb(struct concap_proto *cprot, struct sk_buff *skb);
#endif

View File

@ -1,473 +0,0 @@
/* $Id: isdn.h,v 1.125.2.3 2004/02/10 01:07:14 keil Exp $
*
* Main header for the Linux ISDN subsystem (linklevel).
*
* Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de)
* Copyright 1995,96 by Thinking Objects Software GmbH Wuerzburg
* Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#ifndef __ISDN_H__
#define __ISDN_H__
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/major.h>
#include <asm/io.h>
#include <linux/kernel.h>
#include <linux/signal.h>
#include <linux/slab.h>
#include <linux/timer.h>
#include <linux/wait.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/serial_reg.h>
#include <linux/fcntl.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/ip.h>
#include <linux/in.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/tcp.h>
#include <linux/mutex.h>
#include <uapi/linux/isdn.h>
#define ISDN_TTY_MAJOR 43
#define ISDN_TTYAUX_MAJOR 44
#define ISDN_MAJOR 45
/* The minor-devicenumbers for Channel 0 and 1 are used as arguments for
* physical Channel-Mapping, so they MUST NOT be changed without changing
* the correspondent code in isdn.c
*/
#define ISDN_MINOR_B 0
#define ISDN_MINOR_BMAX (ISDN_MAX_CHANNELS-1)
#define ISDN_MINOR_CTRL 64
#define ISDN_MINOR_CTRLMAX (64 + (ISDN_MAX_CHANNELS-1))
#define ISDN_MINOR_PPP 128
#define ISDN_MINOR_PPPMAX (128 + (ISDN_MAX_CHANNELS-1))
#define ISDN_MINOR_STATUS 255
#ifdef CONFIG_ISDN_PPP
#ifdef CONFIG_ISDN_PPP_VJ
# include <net/slhc_vj.h>
#endif
#include <linux/ppp_defs.h>
#include <linux/ppp-ioctl.h>
#include <linux/isdn_ppp.h>
#endif
#ifdef CONFIG_ISDN_X25
# include <linux/concap.h>
#endif
#include <linux/isdnif.h>
#define ISDN_DRVIOCTL_MASK 0x7f /* Mask for Device-ioctl */
/* Until now unused */
#define ISDN_SERVICE_VOICE 1
#define ISDN_SERVICE_AB 1<<1
#define ISDN_SERVICE_X21 1<<2
#define ISDN_SERVICE_G4 1<<3
#define ISDN_SERVICE_BTX 1<<4
#define ISDN_SERVICE_DFUE 1<<5
#define ISDN_SERVICE_X25 1<<6
#define ISDN_SERVICE_TTX 1<<7
#define ISDN_SERVICE_MIXED 1<<8
#define ISDN_SERVICE_FW 1<<9
#define ISDN_SERVICE_GTEL 1<<10
#define ISDN_SERVICE_BTXN 1<<11
#define ISDN_SERVICE_BTEL 1<<12
/* Macros checking plain usage */
#define USG_NONE(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NONE)
#define USG_RAW(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_RAW)
#define USG_MODEM(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM)
#define USG_VOICE(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE)
#define USG_NET(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NET)
#define USG_FAX(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_FAX)
#define USG_OUTGOING(x) ((x & ISDN_USAGE_OUTGOING)==ISDN_USAGE_OUTGOING)
#define USG_MODEMORVOICE(x) (((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM) || \
((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE) )
/* Timer-delays and scheduling-flags */
#define ISDN_TIMER_RES 4 /* Main Timer-Resolution */
#define ISDN_TIMER_02SEC (HZ/ISDN_TIMER_RES/5) /* Slow-Timer1 .2 sec */
#define ISDN_TIMER_1SEC (HZ/ISDN_TIMER_RES) /* Slow-Timer2 1 sec */
#define ISDN_TIMER_RINGING 5 /* tty RINGs = ISDN_TIMER_1SEC * this factor */
#define ISDN_TIMER_KEEPINT 10 /* Cisco-Keepalive = ISDN_TIMER_1SEC * this factor */
#define ISDN_TIMER_MODEMREAD 1
#define ISDN_TIMER_MODEMPLUS 2
#define ISDN_TIMER_MODEMRING 4
#define ISDN_TIMER_MODEMXMIT 8
#define ISDN_TIMER_NETDIAL 16
#define ISDN_TIMER_NETHANGUP 32
#define ISDN_TIMER_CARRIER 256 /* Wait for Carrier */
#define ISDN_TIMER_FAST (ISDN_TIMER_MODEMREAD | ISDN_TIMER_MODEMPLUS | \
ISDN_TIMER_MODEMXMIT)
#define ISDN_TIMER_SLOW (ISDN_TIMER_MODEMRING | ISDN_TIMER_NETHANGUP | \
ISDN_TIMER_NETDIAL | ISDN_TIMER_CARRIER)
/* Timeout-Values for isdn_net_dial() */
#define ISDN_TIMER_DTIMEOUT10 (10*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
#define ISDN_TIMER_DTIMEOUT15 (15*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
#define ISDN_TIMER_DTIMEOUT60 (60*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
/* GLOBAL_FLAGS */
#define ISDN_GLOBAL_STOPPED 1
/*=================== Start of ip-over-ISDN stuff =========================*/
/* Feature- and status-flags for a net-interface */
#define ISDN_NET_CONNECTED 0x01 /* Bound to ISDN-Channel */
#define ISDN_NET_SECURE 0x02 /* Accept calls from phonelist only */
#define ISDN_NET_CALLBACK 0x04 /* activate callback */
#define ISDN_NET_CBHUP 0x08 /* hangup before callback */
#define ISDN_NET_CBOUT 0x10 /* remote machine does callback */
#define ISDN_NET_MAGIC 0x49344C02 /* for paranoia-checking */
/* Phone-list-element */
typedef struct {
void *next;
char num[ISDN_MSNLEN];
} isdn_net_phone;
/*
Principles when extending structures for generic encapsulation protocol
("concap") support:
- Stuff which is hardware specific (here i4l-specific) goes in
the netdev -> local structure (here: isdn_net_local)
- Stuff which is encapsulation protocol specific goes in the structure
which holds the linux device structure (here: isdn_net_device)
*/
/* Local interface-data */
typedef struct isdn_net_local_s {
ulong magic;
struct net_device_stats stats; /* Ethernet Statistics */
int isdn_device; /* Index to isdn-device */
int isdn_channel; /* Index to isdn-channel */
int ppp_slot; /* PPPD device slot number */
int pre_device; /* Preselected isdn-device */
int pre_channel; /* Preselected isdn-channel */
int exclusive; /* If non-zero idx to reserved chan.*/
int flags; /* Connection-flags */
int dialretry; /* Counter for Dialout-retries */
int dialmax; /* Max. Number of Dial-retries */
int cbdelay; /* Delay before Callback starts */
int dtimer; /* Timeout-counter for dialing */
char msn[ISDN_MSNLEN]; /* MSNs/EAZs for this interface */
u_char cbhup; /* Flag: Reject Call before Callback*/
u_char dialstate; /* State for dialing */
u_char p_encap; /* Packet encapsulation */
/* 0 = Ethernet over ISDN */
/* 1 = RAW-IP */
/* 2 = IP with type field */
u_char l2_proto; /* Layer-2-protocol */
/* See ISDN_PROTO_L2..-constants in */
/* isdnif.h */
/* 0 = X75/LAPB with I-Frames */
/* 1 = X75/LAPB with UI-Frames */
/* 2 = X75/LAPB with BUI-Frames */
/* 3 = HDLC */
u_char l3_proto; /* Layer-3-protocol */
/* See ISDN_PROTO_L3..-constants in */
/* isdnif.h */
/* 0 = Transparent */
int huptimer; /* Timeout-counter for auto-hangup */
int charge; /* Counter for charging units */
ulong chargetime; /* Timer for Charging info */
int hupflags; /* Flags for charge-unit-hangup: */
/* bit0: chargeint is invalid */
/* bit1: Getting charge-interval */
/* bit2: Do charge-unit-hangup */
/* bit3: Do hangup even on incoming */
int outgoing; /* Flag: outgoing call */
int onhtime; /* Time to keep link up */
int chargeint; /* Interval between charge-infos */
int onum; /* Flag: at least 1 outgoing number */
int cps; /* current speed of this interface */
int transcount; /* byte-counter for cps-calculation */
int sqfull; /* Flag: netdev-queue overloaded */
ulong sqfull_stamp; /* Start-Time of overload */
ulong slavedelay; /* Dynamic bundling delaytime */
int triggercps; /* BogoCPS needed for trigger slave */
isdn_net_phone *phone[2]; /* List of remote-phonenumbers */
/* phone[0] = Incoming Numbers */
/* phone[1] = Outgoing Numbers */
isdn_net_phone *dial; /* Pointer to dialed number */
struct net_device *master; /* Ptr to Master device for slaves */
struct net_device *slave; /* Ptr to Slave device for masters */
struct isdn_net_local_s *next; /* Ptr to next link in bundle */
struct isdn_net_local_s *last; /* Ptr to last link in bundle */
struct isdn_net_dev_s *netdev; /* Ptr to netdev */
struct sk_buff_head super_tx_queue; /* List of supervisory frames to */
/* be transmitted asap */
atomic_t frame_cnt; /* number of frames currently */
/* queued in HL driver */
/* Ptr to orig. hard_header_cache */
spinlock_t xmit_lock; /* used to protect the xmit path of */
/* a particular channel (including */
/* the frame_cnt */
int pppbind; /* ippp device for bindings */
int dialtimeout; /* How long shall we try on dialing? (jiffies) */
int dialwait; /* How long shall we wait after failed attempt? (jiffies) */
ulong dialstarted; /* jiffies of first dialing-attempt */
ulong dialwait_timer; /* jiffies of earliest next dialing-attempt */
int huptimeout; /* How long will the connection be up? (seconds) */
#ifdef CONFIG_ISDN_X25
struct concap_device_ops *dops; /* callbacks used by encapsulator */
#endif
/* use an own struct for that in later versions */
ulong cisco_myseq; /* Local keepalive seq. for Cisco */
ulong cisco_mineseen; /* returned keepalive seq. from remote */
ulong cisco_yourseq; /* Remote keepalive seq. for Cisco */
int cisco_keepalive_period; /* keepalive period */
ulong cisco_last_slarp_in; /* jiffie of last keepalive packet we received */
char cisco_line_state; /* state of line according to keepalive packets */
char cisco_debserint; /* debugging flag of cisco hdlc with slarp */
struct timer_list cisco_timer;
struct work_struct tqueue;
} isdn_net_local;
/* the interface itself */
typedef struct isdn_net_dev_s {
isdn_net_local *local;
isdn_net_local *queue; /* circular list of all bundled
channels, which are currently
online */
spinlock_t queue_lock; /* lock to protect queue */
void *next; /* Pointer to next isdn-interface */
struct net_device *dev; /* interface to upper levels */
#ifdef CONFIG_ISDN_PPP
ippp_bundle * pb; /* pointer to the common bundle structure
* with the per-bundle data */
#endif
#ifdef CONFIG_ISDN_X25
struct concap_proto *cprot; /* connection oriented encapsulation protocol */
#endif
} isdn_net_dev;
/*===================== End of ip-over-ISDN stuff ===========================*/
/*======================= Start of ISDN-tty stuff ===========================*/
#define ISDN_ASYNC_MAGIC 0x49344C01 /* for paranoia-checking */
#define ISDN_SERIAL_XMIT_SIZE 1024 /* Default bufsize for write */
#define ISDN_SERIAL_XMIT_MAX 4000 /* Maximum bufsize for write */
#ifdef CONFIG_ISDN_AUDIO
/* For using sk_buffs with audio we need some private variables
* within each sk_buff. For this purpose, we declare a struct here,
* and put it always at the private skb->cb data array. A few macros help
* accessing the variables.
*/
typedef struct _isdn_audio_data {
unsigned short dle_count;
unsigned char lock;
} isdn_audio_data_t;
#define ISDN_AUDIO_SKB_DLECOUNT(skb) (((isdn_audio_data_t *)&skb->cb[0])->dle_count)
#define ISDN_AUDIO_SKB_LOCK(skb) (((isdn_audio_data_t *)&skb->cb[0])->lock)
#endif
/* Private data of AT-command-interpreter */
typedef struct atemu {
u_char profile[ISDN_MODEM_NUMREG]; /* Modem-Regs. Profile 0 */
u_char mdmreg[ISDN_MODEM_NUMREG]; /* Modem-Registers */
char pmsn[ISDN_MSNLEN]; /* EAZ/MSNs Profile 0 */
char msn[ISDN_MSNLEN]; /* EAZ/MSN */
char plmsn[ISDN_LMSNLEN]; /* Listening MSNs Profile 0 */
char lmsn[ISDN_LMSNLEN]; /* Listening MSNs */
char cpn[ISDN_MSNLEN]; /* CalledPartyNumber on incoming call */
char connmsg[ISDN_CMSGLEN]; /* CONNECT-Msg from HL-Driver */
#ifdef CONFIG_ISDN_AUDIO
u_char vpar[10]; /* Voice-parameters */
int lastDLE; /* Flag for voice-coding: DLE seen */
#endif
int mdmcmdl; /* Length of Modem-Commandbuffer */
int pluscount; /* Counter for +++ sequence */
u_long lastplus; /* Timestamp of last + */
int carrierwait; /* Seconds of carrier waiting */
char mdmcmd[255]; /* Modem-Commandbuffer */
unsigned int charge; /* Charge units of current connection */
} atemu;
/* Private data (similar to async_struct in <linux/serial.h>) */
typedef struct modem_info {
int magic;
struct tty_port port;
int x_char; /* xon/xoff character */
int mcr; /* Modem control register */
int msr; /* Modem status register */
int lsr; /* Line status register */
int line;
int online; /* 1 = B-Channel is up, drop data */
/* 2 = B-Channel is up, deliver d.*/
int dialing; /* Dial in progress or ATA */
int closing;
int rcvsched; /* Receive needs schedule */
int isdn_driver; /* Index to isdn-driver */
int isdn_channel; /* Index to isdn-channel */
int drv_index; /* Index to dev->usage */
int ncarrier; /* Flag: schedule NO CARRIER */
unsigned char last_cause[8]; /* Last cause message */
unsigned char last_num[ISDN_MSNLEN];
/* Last phone-number */
unsigned char last_l2; /* Last layer-2 protocol */
unsigned char last_si; /* Last service */
unsigned char last_lhup; /* Last hangup local? */
unsigned char last_dir; /* Last direction (in or out) */
struct timer_list nc_timer; /* Timer for delayed NO CARRIER */
int send_outstanding;/* # of outstanding send-requests */
int xmit_size; /* max. # of chars in xmit_buf */
int xmit_count; /* # of chars in xmit_buf */
struct sk_buff_head xmit_queue; /* transmit queue */
atomic_t xmit_lock; /* Semaphore for isdn_tty_write */
#ifdef CONFIG_ISDN_AUDIO
int vonline; /* Voice-channel status */
/* Bit 0 = recording */
/* Bit 1 = playback */
/* Bit 2 = playback, DLE-ETX seen */
struct sk_buff_head dtmf_queue; /* queue for dtmf results */
void *adpcms; /* state for adpcm decompression */
void *adpcmr; /* state for adpcm compression */
void *dtmf_state; /* state for dtmf decoder */
void *silence_state; /* state for silence detection */
#endif
#ifdef CONFIG_ISDN_TTY_FAX
struct T30_s *fax; /* T30 Fax Group 3 data/interface */
int faxonline; /* Fax-channel status */
#endif
atemu emu; /* AT-emulator data */
spinlock_t readlock;
} modem_info;
#define ISDN_MODEM_WINSIZE 8
/* Description of one ISDN-tty */
typedef struct _isdn_modem {
int refcount; /* Number of opens */
struct tty_driver *tty_modem; /* tty-device */
struct tty_struct *modem_table[ISDN_MAX_CHANNELS]; /* ?? copied from Orig */
struct ktermios *modem_termios[ISDN_MAX_CHANNELS];
struct ktermios *modem_termios_locked[ISDN_MAX_CHANNELS];
modem_info info[ISDN_MAX_CHANNELS]; /* Private data */
} isdn_modem_t;
/*======================= End of ISDN-tty stuff ============================*/
/*======================== Start of V.110 stuff ============================*/
#define V110_BUFSIZE 1024
typedef struct {
int nbytes; /* 1 Matrixbyte -> nbytes in stream */
int nbits; /* Number of used bits in streambyte */
unsigned char key; /* Bitmask in stream eg. 11 (nbits=2) */
int decodelen; /* Amount of data in decodebuf */
int SyncInit; /* Number of sync frames to send */
unsigned char *OnlineFrame; /* Precalculated V110 idle frame */
unsigned char *OfflineFrame; /* Precalculated V110 sync Frame */
int framelen; /* Length of frames */
int skbuser; /* Number of unacked userdata skbs */
int skbidle; /* Number of unacked idle/sync skbs */
int introducer; /* Local vars for decoder */
int dbit;
unsigned char b;
int skbres; /* space to reserve in outgoing skb */
int maxsize; /* maxbufsize of lowlevel driver */
unsigned char *encodebuf; /* temporary buffer for encoding */
unsigned char decodebuf[V110_BUFSIZE]; /* incomplete V110 matrices */
} isdn_v110_stream;
/*========================= End of V.110 stuff =============================*/
/*======================= Start of general stuff ===========================*/
typedef struct {
char *next;
char *private;
} infostruct;
#define DRV_FLAG_RUNNING 1
#define DRV_FLAG_REJBUS 2
#define DRV_FLAG_LOADED 4
/* Description of hardware-level-driver */
typedef struct _isdn_driver {
ulong online; /* Channel-Online flags */
ulong flags; /* Misc driver Flags */
int locks; /* Number of locks for this driver */
int channels; /* Number of channels */
wait_queue_head_t st_waitq; /* Wait-Queue for status-read's */
int maxbufsize; /* Maximum Buffersize supported */
unsigned long pktcount; /* Until now: unused */
int stavail; /* Chars avail on Status-device */
isdn_if *interface; /* Interface to driver */
int *rcverr; /* Error-counters for B-Ch.-receive */
int *rcvcount; /* Byte-counters for B-Ch.-receive */
#ifdef CONFIG_ISDN_AUDIO
unsigned long DLEflag; /* Flags: Insert DLE at next read */
#endif
struct sk_buff_head *rpqueue; /* Pointers to start of Rcv-Queue */
wait_queue_head_t *rcv_waitq; /* Wait-Queues for B-Channel-Reads */
wait_queue_head_t *snd_waitq; /* Wait-Queue for B-Channel-Send's */
char msn2eaz[10][ISDN_MSNLEN]; /* Mapping-Table MSN->EAZ */
} isdn_driver_t;
/* Main driver-data */
typedef struct isdn_devt {
struct module *owner;
spinlock_t lock;
unsigned short flags; /* Bitmapped Flags: */
int drivers; /* Current number of drivers */
int channels; /* Current number of channels */
int net_verbose; /* Verbose-Flag */
int modempoll; /* Flag: tty-read active */
spinlock_t timerlock;
int tflags; /* Timer-Flags: */
/* see ISDN_TIMER_..defines */
int global_flags;
infostruct *infochain; /* List of open info-devs. */
wait_queue_head_t info_waitq; /* Wait-Queue for isdninfo */
struct timer_list timer; /* Misc.-function Timer */
int chanmap[ISDN_MAX_CHANNELS]; /* Map minor->device-channel */
int drvmap[ISDN_MAX_CHANNELS]; /* Map minor->driver-index */
int usage[ISDN_MAX_CHANNELS]; /* Used by tty/ip/voice */
char num[ISDN_MAX_CHANNELS][ISDN_MSNLEN];
/* Remote number of active ch.*/
int m_idx[ISDN_MAX_CHANNELS]; /* Index for mdm.... */
isdn_driver_t *drv[ISDN_MAX_DRIVERS]; /* Array of drivers */
isdn_net_dev *netdev; /* Linked list of net-if's */
char drvid[ISDN_MAX_DRIVERS][20];/* Driver-ID */
struct task_struct *profd; /* For iprofd */
isdn_modem_t mdm; /* tty-driver-data */
isdn_net_dev *rx_netdev[ISDN_MAX_CHANNELS]; /* rx netdev-pointers */
isdn_net_dev *st_netdev[ISDN_MAX_CHANNELS]; /* stat netdev-pointers */
ulong ibytes[ISDN_MAX_CHANNELS]; /* Statistics incoming bytes */
ulong obytes[ISDN_MAX_CHANNELS]; /* Statistics outgoing bytes */
int v110emu[ISDN_MAX_CHANNELS]; /* V.110 emulator-mode 0=none */
atomic_t v110use[ISDN_MAX_CHANNELS]; /* Usage-Semaphore for stream */
isdn_v110_stream *v110[ISDN_MAX_CHANNELS]; /* V.110 private data */
struct mutex mtx; /* serialize list access*/
unsigned long global_features;
} isdn_dev;
extern isdn_dev *dev;
#endif /* __ISDN_H__ */

View File

@ -1,35 +0,0 @@
/* $Id: isdn_divertif.h,v 1.4.6.1 2001/09/23 22:25:05 kai Exp $
*
* Header for the diversion supplementary interface for i4l.
*
* Author Werner Cornelius (werner@titro.de)
* Copyright by Werner Cornelius (werner@titro.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#ifndef _LINUX_ISDN_DIVERTIF_H
#define _LINUX_ISDN_DIVERTIF_H
#include <linux/isdnif.h>
#include <linux/types.h>
#include <uapi/linux/isdn_divertif.h>
/***************************************************************/
/* structure exchanging data between isdn hl and divert module */
/***************************************************************/
typedef struct
{ ulong if_magic; /* magic info and version */
int cmd; /* command */
int (*stat_callback)(isdn_ctrl *); /* supplied by divert module when calling */
int (*ll_cmd)(isdn_ctrl *); /* supplied by hl on return */
char * (*drv_to_name)(int); /* map a driver id to name, supplied by hl */
int (*name_to_drv)(char *); /* map a driver id to name, supplied by hl */
} isdn_divert_if;
/*********************/
/* function register */
/*********************/
extern int DIVERT_REG_NAME(isdn_divert_if *);
#endif /* _LINUX_ISDN_DIVERTIF_H */

View File

@ -1,194 +0,0 @@
/* Linux ISDN subsystem, sync PPP, interface to ipppd
*
* Copyright 1994-1999 by Fritz Elfert (fritz@isdn4linux.de)
* Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg
* Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de)
* Copyright 2000-2002 by Kai Germaschewski (kai@germaschewski.name)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#ifndef _LINUX_ISDN_PPP_H
#define _LINUX_ISDN_PPP_H
#ifdef CONFIG_IPPP_FILTER
#include <linux/filter.h>
#endif
#include <uapi/linux/isdn_ppp.h>
#define DECOMP_ERR_NOMEM (-10)
#define MP_END_FRAG 0x40
#define MP_BEGIN_FRAG 0x80
#define MP_MAX_QUEUE_LEN 16
/*
* We need a way for the decompressor to influence the generation of CCP
* Reset-Requests in a variety of ways. The decompressor is already returning
* a lot of information (generated skb length, error conditions) so we use
* another parameter. This parameter is a pointer to a structure which is
* to be marked valid by the decompressor and only in this case is ever used.
* Furthermore, the only case where this data is used is when the decom-
* pressor returns DECOMP_ERROR.
*
* We use this same struct for the reset entry of the compressor to commu-
* nicate to its caller how to deal with sending of a Reset Ack. In this
* case, expra is not used, but other options still apply (suppressing
* sending with rsend, appending arbitrary data, etc).
*/
#define IPPP_RESET_MAXDATABYTES 32
struct isdn_ppp_resetparams {
unsigned char valid:1; /* rw Is this structure filled at all ? */
unsigned char rsend:1; /* rw Should we send one at all ? */
unsigned char idval:1; /* rw Is the id field valid ? */
unsigned char dtval:1; /* rw Is the data field valid ? */
unsigned char expra:1; /* rw Is an Ack expected for this Req ? */
unsigned char id; /* wo Send CCP ResetReq with this id */
unsigned short maxdlen; /* ro Max bytes to be stored in data field */
unsigned short dlen; /* rw Bytes stored in data field */
unsigned char *data; /* wo Data for ResetReq info field */
};
/*
* this is an 'old friend' from ppp-comp.h under a new name
* check the original include for more information
*/
struct isdn_ppp_compressor {
struct isdn_ppp_compressor *next, *prev;
struct module *owner;
int num; /* CCP compression protocol number */
void *(*alloc) (struct isdn_ppp_comp_data *);
void (*free) (void *state);
int (*init) (void *state, struct isdn_ppp_comp_data *,
int unit,int debug);
/* The reset entry needs to get more exact information about the
ResetReq or ResetAck it was called with. The parameters are
obvious. If reset is called without a Req or Ack frame which
could be handed into it, code MUST be set to 0. Using rsparm,
the reset entry can control if and how a ResetAck is returned. */
void (*reset) (void *state, unsigned char code, unsigned char id,
unsigned char *data, unsigned len,
struct isdn_ppp_resetparams *rsparm);
int (*compress) (void *state, struct sk_buff *in,
struct sk_buff *skb_out, int proto);
int (*decompress) (void *state,struct sk_buff *in,
struct sk_buff *skb_out,
struct isdn_ppp_resetparams *rsparm);
void (*incomp) (void *state, struct sk_buff *in,int proto);
void (*stat) (void *state, struct compstat *stats);
};
extern int isdn_ppp_register_compressor(struct isdn_ppp_compressor *);
extern int isdn_ppp_unregister_compressor(struct isdn_ppp_compressor *);
extern int isdn_ppp_dial_slave(char *);
extern int isdn_ppp_hangup_slave(char *);
typedef struct {
unsigned long seqerrs;
unsigned long frame_drops;
unsigned long overflows;
unsigned long max_queue_len;
} isdn_mppp_stats;
typedef struct {
int mp_mrru; /* unused */
struct sk_buff * frags; /* fragments sl list -- use skb->next */
long frames; /* number of frames in the frame list */
unsigned int seq; /* last processed packet seq #: any packets
* with smaller seq # will be dropped
* unconditionally */
spinlock_t lock;
int ref_ct;
/* statistics */
isdn_mppp_stats stats;
} ippp_bundle;
#define NUM_RCV_BUFFS 64
struct ippp_buf_queue {
struct ippp_buf_queue *next;
struct ippp_buf_queue *last;
char *buf; /* NULL here indicates end of queue */
int len;
};
/* The data structure for one CCP reset transaction */
enum ippp_ccp_reset_states {
CCPResetIdle,
CCPResetSentReq,
CCPResetRcvdReq,
CCPResetSentAck,
CCPResetRcvdAck
};
struct ippp_ccp_reset_state {
enum ippp_ccp_reset_states state; /* State of this transaction */
struct ippp_struct *is; /* Backlink to device stuff */
unsigned char id; /* Backlink id index */
unsigned char ta:1; /* The timer is active (flag) */
unsigned char expra:1; /* We expect a ResetAck at all */
int dlen; /* Databytes stored in data */
struct timer_list timer; /* For timeouts/retries */
/* This is a hack but seems sufficient for the moment. We do not want
to have this be yet another allocation for some bytes, it is more
memory management overhead than the whole mess is worth. */
unsigned char data[IPPP_RESET_MAXDATABYTES];
};
/* The data structure keeping track of the currently outstanding CCP Reset
transactions. */
struct ippp_ccp_reset {
struct ippp_ccp_reset_state *rs[256]; /* One per possible id */
unsigned char lastid; /* Last id allocated by the engine */
};
struct ippp_struct {
struct ippp_struct *next_link;
int state;
spinlock_t buflock;
struct ippp_buf_queue rq[NUM_RCV_BUFFS]; /* packet queue for isdn_ppp_read() */
struct ippp_buf_queue *first; /* pointer to (current) first packet */
struct ippp_buf_queue *last; /* pointer to (current) last used packet in queue */
wait_queue_head_t wq;
struct task_struct *tk;
unsigned int mpppcfg;
unsigned int pppcfg;
unsigned int mru;
unsigned int mpmru;
unsigned int mpmtu;
unsigned int maxcid;
struct isdn_net_local_s *lp;
int unit;
int minor;
unsigned int last_link_seqno;
long mp_seqno;
#ifdef CONFIG_ISDN_PPP_VJ
unsigned char *cbuf;
struct slcompress *slcomp;
#endif
#ifdef CONFIG_IPPP_FILTER
struct bpf_prog *pass_filter; /* filter for packets to pass */
struct bpf_prog *active_filter; /* filter for pkts to reset idle */
#endif
unsigned long debug;
struct isdn_ppp_compressor *compressor,*decompressor;
struct isdn_ppp_compressor *link_compressor,*link_decompressor;
void *decomp_stat,*comp_stat,*link_decomp_stat,*link_comp_stat;
struct ippp_ccp_reset *reset; /* Allocated on demand, may never be needed */
unsigned long compflags;
};
#endif /* _LINUX_ISDN_PPP_H */

View File

@ -1,505 +0,0 @@
/* $Id: isdnif.h,v 1.43.2.2 2004/01/12 23:08:35 keil Exp $
*
* Linux ISDN subsystem
* Definition of the interface between the subsystem and its low-level drivers.
*
* Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de)
* Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#ifndef __ISDNIF_H__
#define __ISDNIF_H__
#include <linux/skbuff.h>
#include <uapi/linux/isdnif.h>
/***************************************************************************/
/* Extensions made by Werner Cornelius (werner@ikt.de) */
/* */
/* The proceed command holds a incoming call in a state to leave processes */
/* enough time to check whether ist should be accepted. */
/* The PROT_IO Command extends the interface to make protocol dependent */
/* features available (call diversion, call waiting...). */
/* */
/* The PROT_IO Command is executed with the desired driver id and the arg */
/* parameter coded as follows: */
/* The lower 8 bits of arg contain the desired protocol from ISDN_PTYPE */
/* definitions. The upper 24 bits represent the protocol specific cmd/stat.*/
/* Any additional data is protocol and command specific. */
/* This mechanism also applies to the statcallb callback STAT_PROT. */
/* */
/* This suggested extension permits an easy expansion of protocol specific */
/* handling. Extensions may be added at any time without changing the HL */
/* driver code and not getting conflicts without certifications. */
/* The well known CAPI 2.0 interface handles such extensions in a similar */
/* way. Perhaps a protocol specific module may be added and separately */
/* loaded and linked to the basic isdn module for handling. */
/***************************************************************************/
/*****************/
/* DSS1 commands */
/*****************/
#define DSS1_CMD_INVOKE ((0x00 << 8) | ISDN_PTYPE_EURO) /* invoke a supplementary service */
#define DSS1_CMD_INVOKE_ABORT ((0x01 << 8) | ISDN_PTYPE_EURO) /* abort a invoke cmd */
/*******************************/
/* DSS1 Status callback values */
/*******************************/
#define DSS1_STAT_INVOKE_RES ((0x80 << 8) | ISDN_PTYPE_EURO) /* Result for invocation */
#define DSS1_STAT_INVOKE_ERR ((0x81 << 8) | ISDN_PTYPE_EURO) /* Error Return for invocation */
#define DSS1_STAT_INVOKE_BRD ((0x82 << 8) | ISDN_PTYPE_EURO) /* Deliver invoke broadcast info */
/*********************************************************************/
/* structures for DSS1 commands and callback */
/* */
/* An action is invoked by sending a DSS1_CMD_INVOKE. The ll_id, proc*/
/* timeout, datalen and data fields must be set before calling. */
/* */
/* The return value is a positive hl_id value also delivered in the */
/* hl_id field. A value of zero signals no more left hl_id capacitys.*/
/* A negative return value signals errors in LL. So if the return */
/* value is <= 0 no action in LL will be taken -> request ignored */
/* */
/* The timeout field must be filled with a positive value specifying */
/* the amount of time the INVOKED process waits for a reaction from */
/* the network. */
/* If a response (either error or result) is received during this */
/* intervall, a reporting callback is initiated and the process will */
/* be deleted, the hl identifier will be freed. */
/* If no response is received during the specified intervall, a error*/
/* callback is initiated with timeout set to -1 and a datalen set */
/* to 0. */
/* If timeout is set to a value <= 0 during INVOCATION the process is*/
/* immediately deleted after sending the data. No callback occurs ! */
/* */
/* A currently waiting process may be aborted with INVOKE_ABORT. No */
/* callback will occur when a process has been aborted. */
/* */
/* Broadcast invoke frames from the network are reported via the */
/* STAT_INVOKE_BRD callback. The ll_id is set to 0, the other fields */
/* are supplied by the network and not by the HL. */
/*********************************************************************/
/*****************/
/* NI1 commands */
/*****************/
#define NI1_CMD_INVOKE ((0x00 << 8) | ISDN_PTYPE_NI1) /* invoke a supplementary service */
#define NI1_CMD_INVOKE_ABORT ((0x01 << 8) | ISDN_PTYPE_NI1) /* abort a invoke cmd */
/*******************************/
/* NI1 Status callback values */
/*******************************/
#define NI1_STAT_INVOKE_RES ((0x80 << 8) | ISDN_PTYPE_NI1) /* Result for invocation */
#define NI1_STAT_INVOKE_ERR ((0x81 << 8) | ISDN_PTYPE_NI1) /* Error Return for invocation */
#define NI1_STAT_INVOKE_BRD ((0x82 << 8) | ISDN_PTYPE_NI1) /* Deliver invoke broadcast info */
typedef struct
{ ulong ll_id; /* ID supplied by LL when executing */
/* a command and returned by HL for */
/* INVOKE_RES and INVOKE_ERR */
int hl_id; /* ID supplied by HL when called */
/* for executing a cmd and delivered */
/* for results and errors */
/* must be supplied by LL when aborting*/
int proc; /* invoke procedure used by CMD_INVOKE */
/* returned by callback and broadcast */
int timeout; /* timeout for INVOKE CMD in ms */
/* -1 in stat callback when timed out */
/* error value when error callback */
int datalen; /* length of cmd or stat data */
u_char *data;/* pointer to data delivered or send */
} isdn_cmd_stat;
/*
* Commands from linklevel to lowlevel
*
*/
#define ISDN_CMD_IOCTL 0 /* Perform ioctl */
#define ISDN_CMD_DIAL 1 /* Dial out */
#define ISDN_CMD_ACCEPTD 2 /* Accept an incoming call on D-Chan. */
#define ISDN_CMD_ACCEPTB 3 /* Request B-Channel connect. */
#define ISDN_CMD_HANGUP 4 /* Hangup */
#define ISDN_CMD_CLREAZ 5 /* Clear EAZ(s) of channel */
#define ISDN_CMD_SETEAZ 6 /* Set EAZ(s) of channel */
#define ISDN_CMD_GETEAZ 7 /* Get EAZ(s) of channel */
#define ISDN_CMD_SETSIL 8 /* Set Service-Indicator-List of channel */
#define ISDN_CMD_GETSIL 9 /* Get Service-Indicator-List of channel */
#define ISDN_CMD_SETL2 10 /* Set B-Chan. Layer2-Parameter */
#define ISDN_CMD_GETL2 11 /* Get B-Chan. Layer2-Parameter */
#define ISDN_CMD_SETL3 12 /* Set B-Chan. Layer3-Parameter */
#define ISDN_CMD_GETL3 13 /* Get B-Chan. Layer3-Parameter */
// #define ISDN_CMD_LOCK 14 /* Signal usage by upper levels */
// #define ISDN_CMD_UNLOCK 15 /* Release usage-lock */
#define ISDN_CMD_SUSPEND 16 /* Suspend connection */
#define ISDN_CMD_RESUME 17 /* Resume connection */
#define ISDN_CMD_PROCEED 18 /* Proceed with call establishment */
#define ISDN_CMD_ALERT 19 /* Alert after Proceeding */
#define ISDN_CMD_REDIR 20 /* Redir a incoming call */
#define ISDN_CMD_PROT_IO 21 /* Protocol specific commands */
#define CAPI_PUT_MESSAGE 22 /* CAPI message send down or up */
#define ISDN_CMD_FAXCMD 23 /* FAX commands to HL-driver */
#define ISDN_CMD_AUDIO 24 /* DSP, DTMF, ... settings */
/*
* Status-Values delivered from lowlevel to linklevel via
* statcallb().
*
*/
#define ISDN_STAT_STAVAIL 256 /* Raw status-data available */
#define ISDN_STAT_ICALL 257 /* Incoming call detected */
#define ISDN_STAT_RUN 258 /* Signal protocol-code is running */
#define ISDN_STAT_STOP 259 /* Signal halt of protocol-code */
#define ISDN_STAT_DCONN 260 /* Signal D-Channel connect */
#define ISDN_STAT_BCONN 261 /* Signal B-Channel connect */
#define ISDN_STAT_DHUP 262 /* Signal D-Channel disconnect */
#define ISDN_STAT_BHUP 263 /* Signal B-Channel disconnect */
#define ISDN_STAT_CINF 264 /* Charge-Info */
#define ISDN_STAT_LOAD 265 /* Signal new lowlevel-driver is loaded */
#define ISDN_STAT_UNLOAD 266 /* Signal unload of lowlevel-driver */
#define ISDN_STAT_BSENT 267 /* Signal packet sent */
#define ISDN_STAT_NODCH 268 /* Signal no D-Channel */
#define ISDN_STAT_ADDCH 269 /* Add more Channels */
#define ISDN_STAT_CAUSE 270 /* Cause-Message */
#define ISDN_STAT_ICALLW 271 /* Incoming call without B-chan waiting */
#define ISDN_STAT_REDIR 272 /* Redir result */
#define ISDN_STAT_PROT 273 /* protocol IO specific callback */
#define ISDN_STAT_DISPLAY 274 /* deliver a received display message */
#define ISDN_STAT_L1ERR 275 /* Signal Layer-1 Error */
#define ISDN_STAT_FAXIND 276 /* FAX indications from HL-driver */
#define ISDN_STAT_AUDIO 277 /* DTMF, DSP indications */
#define ISDN_STAT_DISCH 278 /* Disable/Enable channel usage */
/*
* Audio commands
*/
#define ISDN_AUDIO_SETDD 0 /* Set DTMF detection */
#define ISDN_AUDIO_DTMF 1 /* Rx/Tx DTMF */
/*
* Values for errcode field
*/
#define ISDN_STAT_L1ERR_SEND 1
#define ISDN_STAT_L1ERR_RECV 2
/*
* Values for feature-field of interface-struct.
*/
/* Layer 2 */
#define ISDN_FEATURE_L2_X75I (0x0001 << ISDN_PROTO_L2_X75I)
#define ISDN_FEATURE_L2_X75UI (0x0001 << ISDN_PROTO_L2_X75UI)
#define ISDN_FEATURE_L2_X75BUI (0x0001 << ISDN_PROTO_L2_X75BUI)
#define ISDN_FEATURE_L2_HDLC (0x0001 << ISDN_PROTO_L2_HDLC)
#define ISDN_FEATURE_L2_TRANS (0x0001 << ISDN_PROTO_L2_TRANS)
#define ISDN_FEATURE_L2_X25DTE (0x0001 << ISDN_PROTO_L2_X25DTE)
#define ISDN_FEATURE_L2_X25DCE (0x0001 << ISDN_PROTO_L2_X25DCE)
#define ISDN_FEATURE_L2_V11096 (0x0001 << ISDN_PROTO_L2_V11096)
#define ISDN_FEATURE_L2_V11019 (0x0001 << ISDN_PROTO_L2_V11019)
#define ISDN_FEATURE_L2_V11038 (0x0001 << ISDN_PROTO_L2_V11038)
#define ISDN_FEATURE_L2_MODEM (0x0001 << ISDN_PROTO_L2_MODEM)
#define ISDN_FEATURE_L2_FAX (0x0001 << ISDN_PROTO_L2_FAX)
#define ISDN_FEATURE_L2_HDLC_56K (0x0001 << ISDN_PROTO_L2_HDLC_56K)
#define ISDN_FEATURE_L2_MASK (0x0FFFF) /* Max. 16 protocols */
#define ISDN_FEATURE_L2_SHIFT (0)
/* Layer 3 */
#define ISDN_FEATURE_L3_TRANS (0x10000 << ISDN_PROTO_L3_TRANS)
#define ISDN_FEATURE_L3_TRANSDSP (0x10000 << ISDN_PROTO_L3_TRANSDSP)
#define ISDN_FEATURE_L3_FCLASS2 (0x10000 << ISDN_PROTO_L3_FCLASS2)
#define ISDN_FEATURE_L3_FCLASS1 (0x10000 << ISDN_PROTO_L3_FCLASS1)
#define ISDN_FEATURE_L3_MASK (0x0FF0000) /* Max. 8 Protocols */
#define ISDN_FEATURE_L3_SHIFT (16)
/* Signaling */
#define ISDN_FEATURE_P_UNKNOWN (0x1000000 << ISDN_PTYPE_UNKNOWN)
#define ISDN_FEATURE_P_1TR6 (0x1000000 << ISDN_PTYPE_1TR6)
#define ISDN_FEATURE_P_EURO (0x1000000 << ISDN_PTYPE_EURO)
#define ISDN_FEATURE_P_NI1 (0x1000000 << ISDN_PTYPE_NI1)
#define ISDN_FEATURE_P_MASK (0x0FF000000) /* Max. 8 Protocols */
#define ISDN_FEATURE_P_SHIFT (24)
typedef struct setup_parm {
unsigned char phone[32]; /* Remote Phone-Number */
unsigned char eazmsn[32]; /* Local EAZ or MSN */
unsigned char si1; /* Service Indicator 1 */
unsigned char si2; /* Service Indicator 2 */
unsigned char plan; /* Numbering plan */
unsigned char screen; /* Screening info */
} setup_parm;
#ifdef CONFIG_ISDN_TTY_FAX
/* T.30 Fax G3 */
#define FAXIDLEN 21
typedef struct T30_s {
/* session parameters */
__u8 resolution;
__u8 rate;
__u8 width;
__u8 length;
__u8 compression;
__u8 ecm;
__u8 binary;
__u8 scantime;
__u8 id[FAXIDLEN];
/* additional parameters */
__u8 phase;
__u8 direction;
__u8 code;
__u8 badlin;
__u8 badmul;
__u8 bor;
__u8 fet;
__u8 pollid[FAXIDLEN];
__u8 cq;
__u8 cr;
__u8 ctcrty;
__u8 minsp;
__u8 phcto;
__u8 rel;
__u8 nbc;
/* remote station parameters */
__u8 r_resolution;
__u8 r_rate;
__u8 r_width;
__u8 r_length;
__u8 r_compression;
__u8 r_ecm;
__u8 r_binary;
__u8 r_scantime;
__u8 r_id[FAXIDLEN];
__u8 r_code;
} __packed T30_s;
#define ISDN_TTY_FAX_CONN_IN 0
#define ISDN_TTY_FAX_CONN_OUT 1
#define ISDN_TTY_FAX_FCON 0
#define ISDN_TTY_FAX_DIS 1
#define ISDN_TTY_FAX_FTT 2
#define ISDN_TTY_FAX_MCF 3
#define ISDN_TTY_FAX_DCS 4
#define ISDN_TTY_FAX_TRAIN_OK 5
#define ISDN_TTY_FAX_EOP 6
#define ISDN_TTY_FAX_EOM 7
#define ISDN_TTY_FAX_MPS 8
#define ISDN_TTY_FAX_DTC 9
#define ISDN_TTY_FAX_RID 10
#define ISDN_TTY_FAX_HNG 11
#define ISDN_TTY_FAX_DT 12
#define ISDN_TTY_FAX_FCON_I 13
#define ISDN_TTY_FAX_DR 14
#define ISDN_TTY_FAX_ET 15
#define ISDN_TTY_FAX_CFR 16
#define ISDN_TTY_FAX_PTS 17
#define ISDN_TTY_FAX_SENT 18
#define ISDN_FAX_PHASE_IDLE 0
#define ISDN_FAX_PHASE_A 1
#define ISDN_FAX_PHASE_B 2
#define ISDN_FAX_PHASE_C 3
#define ISDN_FAX_PHASE_D 4
#define ISDN_FAX_PHASE_E 5
#endif /* TTY_FAX */
#define ISDN_FAX_CLASS1_FAE 0
#define ISDN_FAX_CLASS1_FTS 1
#define ISDN_FAX_CLASS1_FRS 2
#define ISDN_FAX_CLASS1_FTM 3
#define ISDN_FAX_CLASS1_FRM 4
#define ISDN_FAX_CLASS1_FTH 5
#define ISDN_FAX_CLASS1_FRH 6
#define ISDN_FAX_CLASS1_CTRL 7
#define ISDN_FAX_CLASS1_OK 0
#define ISDN_FAX_CLASS1_CONNECT 1
#define ISDN_FAX_CLASS1_NOCARR 2
#define ISDN_FAX_CLASS1_ERROR 3
#define ISDN_FAX_CLASS1_FCERROR 4
#define ISDN_FAX_CLASS1_QUERY 5
typedef struct {
__u8 cmd;
__u8 subcmd;
__u8 para[50];
} aux_s;
#define AT_COMMAND 0
#define AT_EQ_VALUE 1
#define AT_QUERY 2
#define AT_EQ_QUERY 3
/* CAPI structs */
/* this is compatible to the old union size */
#define MAX_CAPI_PARA_LEN 50
typedef struct {
/* Header */
__u16 Length;
__u16 ApplId;
__u8 Command;
__u8 Subcommand;
__u16 Messagenumber;
/* Parameter */
union {
__u32 Controller;
__u32 PLCI;
__u32 NCCI;
} adr;
__u8 para[MAX_CAPI_PARA_LEN];
} capi_msg;
/*
* Structure for exchanging above infos
*
*/
typedef struct {
int driver; /* Lowlevel-Driver-ID */
int command; /* Command or Status (see above) */
ulong arg; /* Additional Data */
union {
ulong errcode; /* Type of error with STAT_L1ERR */
int length; /* Amount of bytes sent with STAT_BSENT */
u_char num[50]; /* Additional Data */
setup_parm setup;/* For SETUP msg */
capi_msg cmsg; /* For CAPI like messages */
char display[85];/* display message data */
isdn_cmd_stat isdn_io; /* ISDN IO-parameter/result */
aux_s aux; /* for modem commands/indications */
#ifdef CONFIG_ISDN_TTY_FAX
T30_s *fax; /* Pointer to ttys fax struct */
#endif
ulong userdata; /* User Data */
} parm;
} isdn_ctrl;
#define dss1_io isdn_io
#define ni1_io isdn_io
/*
* The interface-struct itself (initialized at load-time of lowlevel-driver)
*
* See Documentation/isdn/INTERFACE for a description, how the communication
* between the ISDN subsystem and its drivers is done.
*
*/
typedef struct {
struct module *owner;
/* Number of channels supported by this driver
*/
int channels;
/*
* Maximum Size of transmit/receive-buffer this driver supports.
*/
int maxbufsize;
/* Feature-Flags for this driver.
* See defines ISDN_FEATURE_... for Values
*/
unsigned long features;
/*
* Needed for calculating
* dev->hard_header_len = linklayer header + hl_hdrlen;
* Drivers, not supporting sk_buff's should set this to 0.
*/
unsigned short hl_hdrlen;
/*
* Receive-Callback using sk_buff's
* Parameters:
* int Driver-ID
* int local channel-number (0 ...)
* struct sk_buff *skb received Data
*/
void (*rcvcallb_skb)(int, int, struct sk_buff *);
/* Status-Callback
* Parameters:
* isdn_ctrl*
* driver = Driver ID.
* command = One of above ISDN_STAT_... constants.
* arg = depending on status-type.
* num = depending on status-type.
*/
int (*statcallb)(isdn_ctrl*);
/* Send command
* Parameters:
* isdn_ctrl*
* driver = Driver ID.
* command = One of above ISDN_CMD_... constants.
* arg = depending on command.
* num = depending on command.
*/
int (*command)(isdn_ctrl*);
/*
* Send data using sk_buff's
* Parameters:
* int driverId
* int local channel-number (0...)
* int Flag: Need ACK for this packet.
* struct sk_buff *skb Data to send
*/
int (*writebuf_skb) (int, int, int, struct sk_buff *);
/* Send raw D-Channel-Commands
* Parameters:
* u_char pointer data
* int length of data
* int driverId
* int local channel-number (0 ...)
*/
int (*writecmd)(const u_char __user *, int, int, int);
/* Read raw Status replies
* u_char pointer data (volatile)
* int length of buffer
* int driverId
* int local channel-number (0 ...)
*/
int (*readstat)(u_char __user *, int, int, int);
char id[20];
} isdn_if;
/*
* Function which must be called by lowlevel-driver at loadtime with
* the following fields of above struct set:
*
* channels Number of channels that will be supported.
* hl_hdrlen Space to preserve in sk_buff's when sending. Drivers, not
* supporting sk_buff's should set this to 0.
* command Address of Command-Handler.
* features Bitwise coded Features of this driver. (use ISDN_FEATURE_...)
* writebuf_skb Address of Skbuff-Send-Handler.
* writecmd " " D-Channel " which accepts raw D-Ch-Commands.
* readstat " " D-Channel " which delivers raw Status-Data.
*
* The linklevel-driver fills the following fields:
*
* channels Driver-ID assigned to this driver. (Must be used on all
* subsequent callbacks.
* rcvcallb_skb Address of handler for received Skbuff's.
* statcallb " " " for status-changes.
*
*/
extern int register_isdn(isdn_if*);
#include <linux/uaccess.h>
#endif /* __ISDNIF_H__ */

View File

@ -1,11 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* wanrouter.h Legacy declarations kept around until X25 is removed
*/
#ifndef _ROUTER_H
#define _ROUTER_H
#include <uapi/linux/wanrouter.h>
#endif /* _ROUTER_H */

View File

@ -1,144 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/* $Id: isdn.h,v 1.125.2.3 2004/02/10 01:07:14 keil Exp $
*
* Main header for the Linux ISDN subsystem (linklevel).
*
* Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de)
* Copyright 1995,96 by Thinking Objects Software GmbH Wuerzburg
* Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#ifndef _UAPI__ISDN_H__
#define _UAPI__ISDN_H__
#include <linux/ioctl.h>
#include <linux/tty.h>
#define ISDN_MAX_DRIVERS 32
#define ISDN_MAX_CHANNELS 64
/* New ioctl-codes */
#define IIOCNETAIF _IO('I',1)
#define IIOCNETDIF _IO('I',2)
#define IIOCNETSCF _IO('I',3)
#define IIOCNETGCF _IO('I',4)
#define IIOCNETANM _IO('I',5)
#define IIOCNETDNM _IO('I',6)
#define IIOCNETGNM _IO('I',7)
#define IIOCGETSET _IO('I',8) /* no longer supported */
#define IIOCSETSET _IO('I',9) /* no longer supported */
#define IIOCSETVER _IO('I',10)
#define IIOCNETHUP _IO('I',11)
#define IIOCSETGST _IO('I',12)
#define IIOCSETBRJ _IO('I',13)
#define IIOCSIGPRF _IO('I',14)
#define IIOCGETPRF _IO('I',15)
#define IIOCSETPRF _IO('I',16)
#define IIOCGETMAP _IO('I',17)
#define IIOCSETMAP _IO('I',18)
#define IIOCNETASL _IO('I',19)
#define IIOCNETDIL _IO('I',20)
#define IIOCGETCPS _IO('I',21)
#define IIOCGETDVR _IO('I',22)
#define IIOCNETLCR _IO('I',23) /* dwabc ioctl for LCR from isdnlog */
#define IIOCNETDWRSET _IO('I',24) /* dwabc ioctl to reset abc-values to default on a net-interface */
#define IIOCNETALN _IO('I',32)
#define IIOCNETDLN _IO('I',33)
#define IIOCNETGPN _IO('I',34)
#define IIOCDBGVAR _IO('I',127)
#define IIOCDRVCTL _IO('I',128)
/* cisco hdlck device private ioctls */
#define SIOCGKEEPPERIOD (SIOCDEVPRIVATE + 0)
#define SIOCSKEEPPERIOD (SIOCDEVPRIVATE + 1)
#define SIOCGDEBSERINT (SIOCDEVPRIVATE + 2)
#define SIOCSDEBSERINT (SIOCDEVPRIVATE + 3)
/* Packet encapsulations for net-interfaces */
#define ISDN_NET_ENCAP_ETHER 0
#define ISDN_NET_ENCAP_RAWIP 1
#define ISDN_NET_ENCAP_IPTYP 2
#define ISDN_NET_ENCAP_CISCOHDLC 3 /* Without SLARP and keepalive */
#define ISDN_NET_ENCAP_SYNCPPP 4
#define ISDN_NET_ENCAP_UIHDLC 5
#define ISDN_NET_ENCAP_CISCOHDLCK 6 /* With SLARP and keepalive */
#define ISDN_NET_ENCAP_X25IFACE 7 /* Documentation/networking/x25-iface.txt */
#define ISDN_NET_ENCAP_MAX_ENCAP ISDN_NET_ENCAP_X25IFACE
/* Facility which currently uses an ISDN-channel */
#define ISDN_USAGE_NONE 0
#define ISDN_USAGE_RAW 1
#define ISDN_USAGE_MODEM 2
#define ISDN_USAGE_NET 3
#define ISDN_USAGE_VOICE 4
#define ISDN_USAGE_FAX 5
#define ISDN_USAGE_MASK 7 /* Mask to get plain usage */
#define ISDN_USAGE_DISABLED 32 /* This bit is set, if channel is disabled */
#define ISDN_USAGE_EXCLUSIVE 64 /* This bit is set, if channel is exclusive */
#define ISDN_USAGE_OUTGOING 128 /* This bit is set, if channel is outgoing */
#define ISDN_MODEM_NUMREG 24 /* Number of Modem-Registers */
#define ISDN_LMSNLEN 255 /* Length of tty's Listen-MSN string */
#define ISDN_CMSGLEN 50 /* Length of CONNECT-Message to add for Modem */
#define ISDN_MSNLEN 32
#define NET_DV 0x06 /* Data version for isdn_net_ioctl_cfg */
#define TTY_DV 0x06 /* Data version for iprofd etc. */
#define INF_DV 0x01 /* Data version for /dev/isdninfo */
typedef struct {
char drvid[25];
unsigned long arg;
} isdn_ioctl_struct;
typedef struct {
char name[10];
char phone[ISDN_MSNLEN];
int outgoing;
} isdn_net_ioctl_phone;
typedef struct {
char name[10]; /* Name of interface */
char master[10]; /* Name of Master for Bundling */
char slave[10]; /* Name of Slave for Bundling */
char eaz[256]; /* EAZ/MSN */
char drvid[25]; /* DriverId for Bindings */
int onhtime; /* Hangup-Timeout */
int charge; /* Charge-Units */
int l2_proto; /* Layer-2 protocol */
int l3_proto; /* Layer-3 protocol */
int p_encap; /* Encapsulation */
int exclusive; /* Channel, if bound exclusive */
int dialmax; /* Dial Retry-Counter */
int slavedelay; /* Delay until slave starts up */
int cbdelay; /* Delay before Callback */
int chargehup; /* Flag: Charge-Hangup */
int ihup; /* Flag: Hangup-Timeout on incoming line */
int secure; /* Flag: Secure */
int callback; /* Flag: Callback */
int cbhup; /* Flag: Reject Call before Callback */
int pppbind; /* ippp device for bindings */
int chargeint; /* Use fixed charge interval length */
int triggercps; /* BogoCPS needed for triggering slave */
int dialtimeout; /* Dial-Timeout */
int dialwait; /* Time to wait after failed dial */
int dialmode; /* Flag: off / on / auto */
} isdn_net_ioctl_cfg;
#define ISDN_NET_DIALMODE_MASK 0xC0 /* bits for status */
#define ISDN_NET_DM_OFF 0x00 /* this interface is stopped */
#define ISDN_NET_DM_MANUAL 0x40 /* this interface is on (manual) */
#define ISDN_NET_DM_AUTO 0x80 /* this interface is autodial */
#define ISDN_NET_DIALMODE(x) ((&(x))->flags & ISDN_NET_DIALMODE_MASK)
#endif /* _UAPI__ISDN_H__ */

View File

@ -1,31 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/* $Id: isdn_divertif.h,v 1.4.6.1 2001/09/23 22:25:05 kai Exp $
*
* Header for the diversion supplementary interface for i4l.
*
* Author Werner Cornelius (werner@titro.de)
* Copyright by Werner Cornelius (werner@titro.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#ifndef _UAPI_LINUX_ISDN_DIVERTIF_H
#define _UAPI_LINUX_ISDN_DIVERTIF_H
/***********************************************************/
/* magic value is also used to control version information */
/***********************************************************/
#define DIVERT_IF_MAGIC 0x25873401
#define DIVERT_CMD_REG 0x00 /* register command */
#define DIVERT_CMD_REL 0x01 /* release command */
#define DIVERT_NO_ERR 0x00 /* return value no error */
#define DIVERT_CMD_ERR 0x01 /* invalid cmd */
#define DIVERT_VER_ERR 0x02 /* magic/version invalid */
#define DIVERT_REG_ERR 0x03 /* module already registered */
#define DIVERT_REL_ERR 0x04 /* module not registered */
#define DIVERT_REG_NAME isdn_register_divert
#endif /* _UAPI_LINUX_ISDN_DIVERTIF_H */

View File

@ -1,68 +0,0 @@
/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */
/* Linux ISDN subsystem, sync PPP, interface to ipppd
*
* Copyright 1994-1999 by Fritz Elfert (fritz@isdn4linux.de)
* Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg
* Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de)
* Copyright 2000-2002 by Kai Germaschewski (kai@germaschewski.name)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#ifndef _UAPI_LINUX_ISDN_PPP_H
#define _UAPI_LINUX_ISDN_PPP_H
#define CALLTYPE_INCOMING 0x1
#define CALLTYPE_OUTGOING 0x2
#define CALLTYPE_CALLBACK 0x4
#define IPPP_VERSION "2.2.0"
struct pppcallinfo
{
int calltype;
unsigned char local_num[64];
unsigned char remote_num[64];
int charge_units;
};
#define PPPIOCGCALLINFO _IOWR('t',128,struct pppcallinfo)
#define PPPIOCBUNDLE _IOW('t',129,int)
#define PPPIOCGMPFLAGS _IOR('t',130,int)
#define PPPIOCSMPFLAGS _IOW('t',131,int)
#define PPPIOCSMPMTU _IOW('t',132,int)
#define PPPIOCSMPMRU _IOW('t',133,int)
#define PPPIOCGCOMPRESSORS _IOR('t',134,unsigned long [8])
#define PPPIOCSCOMPRESSOR _IOW('t',135,int)
#define PPPIOCGIFNAME _IOR('t',136, char [IFNAMSIZ] )
#define SC_MP_PROT 0x00000200
#define SC_REJ_MP_PROT 0x00000400
#define SC_OUT_SHORT_SEQ 0x00000800
#define SC_IN_SHORT_SEQ 0x00004000
#define SC_DECOMP_ON 0x01
#define SC_COMP_ON 0x02
#define SC_DECOMP_DISCARD 0x04
#define SC_COMP_DISCARD 0x08
#define SC_LINK_DECOMP_ON 0x10
#define SC_LINK_COMP_ON 0x20
#define SC_LINK_DECOMP_DISCARD 0x40
#define SC_LINK_COMP_DISCARD 0x80
#define ISDN_PPP_COMP_MAX_OPTIONS 16
#define IPPP_COMP_FLAG_XMIT 0x1
#define IPPP_COMP_FLAG_LINK 0x2
struct isdn_ppp_comp_data {
int num;
unsigned char options[ISDN_PPP_COMP_MAX_OPTIONS];
int optlen;
int flags;
};
#endif /* _UAPI_LINUX_ISDN_PPP_H */

View File

@ -1,57 +0,0 @@
/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */
/* $Id: isdnif.h,v 1.43.2.2 2004/01/12 23:08:35 keil Exp $
*
* Linux ISDN subsystem
* Definition of the interface between the subsystem and its low-level drivers.
*
* Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de)
* Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#ifndef _UAPI__ISDNIF_H__
#define _UAPI__ISDNIF_H__
/*
* Values for general protocol-selection
*/
#define ISDN_PTYPE_UNKNOWN 0 /* Protocol undefined */
#define ISDN_PTYPE_1TR6 1 /* german 1TR6-protocol */
#define ISDN_PTYPE_EURO 2 /* EDSS1-protocol */
#define ISDN_PTYPE_LEASED 3 /* for leased lines */
#define ISDN_PTYPE_NI1 4 /* US NI-1 protocol */
#define ISDN_PTYPE_MAX 7 /* Max. 8 Protocols */
/*
* Values for Layer-2-protocol-selection
*/
#define ISDN_PROTO_L2_X75I 0 /* X75/LAPB with I-Frames */
#define ISDN_PROTO_L2_X75UI 1 /* X75/LAPB with UI-Frames */
#define ISDN_PROTO_L2_X75BUI 2 /* X75/LAPB with UI-Frames */
#define ISDN_PROTO_L2_HDLC 3 /* HDLC */
#define ISDN_PROTO_L2_TRANS 4 /* Transparent (Voice) */
#define ISDN_PROTO_L2_X25DTE 5 /* X25/LAPB DTE mode */
#define ISDN_PROTO_L2_X25DCE 6 /* X25/LAPB DCE mode */
#define ISDN_PROTO_L2_V11096 7 /* V.110 bitrate adaption 9600 Baud */
#define ISDN_PROTO_L2_V11019 8 /* V.110 bitrate adaption 19200 Baud */
#define ISDN_PROTO_L2_V11038 9 /* V.110 bitrate adaption 38400 Baud */
#define ISDN_PROTO_L2_MODEM 10 /* Analog Modem on Board */
#define ISDN_PROTO_L2_FAX 11 /* Fax Group 2/3 */
#define ISDN_PROTO_L2_HDLC_56K 12 /* HDLC 56k */
#define ISDN_PROTO_L2_MAX 15 /* Max. 16 Protocols */
/*
* Values for Layer-3-protocol-selection
*/
#define ISDN_PROTO_L3_TRANS 0 /* Transparent */
#define ISDN_PROTO_L3_TRANSDSP 1 /* Transparent with DSP */
#define ISDN_PROTO_L3_FCLASS2 2 /* Fax Group 2/3 CLASS 2 */
#define ISDN_PROTO_L3_FCLASS1 3 /* Fax Group 2/3 CLASS 1 */
#define ISDN_PROTO_L3_MAX 7 /* Max. 8 Protocols */
#endif /* _UAPI__ISDNIF_H__ */

View File

@ -1,18 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* wanrouter.h Legacy declarations kept around until X25 is removed
*/
#ifndef _UAPI_ROUTER_H
#define _UAPI_ROUTER_H
/* 'state' defines */
enum wan_states
{
WAN_UNCONFIGURED, /* link/channel is not configured */
WAN_DISCONNECTED, /* link/channel is disconnected */
WAN_CONNECTING, /* connection is in progress */
WAN_CONNECTED /* link/channel is operational */
};
#endif /* _UAPI_ROUTER_H */