In this directory you find the sources for papi:

PAPI is a Packet driver for the isdn common API. 
It is a MSDOS terminate and stay resident program.
Compiled with tcc and tasm.

The Common ISDN API (ISDN-CAPI) is an interface defined by german telecom
and german ISDN Cards manufacturer.
The ISDN-CAPI supported is version 1.1, Profile A of 7.Sep.90

The packet interface implemented is version 1.09.
The implemented class is slip.

This version:
VERSION 0.17 02.Sep.1993
is for tests only. It is an intermediate version. I will try to make a version
0.2 available end of September 93.
It is still a prototype.

The newest version will always be available through ftp.germany.eu.net.
If you do not have access to ftp use their mail server:
send mail to <archive-server@Germany.EU.net> and place the keyword "help" 
in the body of the mail.

History - Why I wrote it:
I use a small 286 MSDOS box as a router to the Internet (EUNET).
The box is equipped with an ISDN card and an ethernet card.
It connects my small network to the EUNET-POP via ISDN.
The packet driver which came with the first ISDN board was not very
stable.

I found a not too expensive ISDN board from teles Berlin.
Their software interface is the ISDN-CAPI. The board is very simple
(only two chips from Siemens). It is not intelligent (i.e. it does
not have a processor on board).

I use ka9q and pc-route as routers.
The only part missing was a piece of software interfacing ISDN-CAPI
and ka9q. ka9q supports the packet driver interface very well.
papi is the missing link.

Restrictions:
	- only 1 application registered per program.
	- only 1 controller supported per computer.
	- only 1 papi packet driver per computer
	- only 1 ISDN destination and the destination is fixed at the time
	  the driver is invoked.
	- a tcp/ip packet has to be <= 2K
	- only X75 and HDLC-UI frames as supported level 2 protocols.
	- only tested with ka9q

It works now with Dr. Neuhaus Niccy 3008 and Niccy 1000 cards.
With AVM-A1 and Teles S0 Boards.
I did not arrive to make the packet driver work stable with the Diehl
implementation of the CAPI. It might be the problem of my packet driver.
It is working in a heavily interrupt driven environment.

Todo:
A lot of stuff in the code is constant what should be variable.
A lot of constants are numeric and not defined in include files.
There is still a lot of code which helped me to understand and debug.
There are some error states which are not handled.
The "state machine" in apiintr.c will be rewritten as soon as I have
nothing better to do.
I will write an interface to pcroute as soon as possible.
Test and debug with different ISDN-Cards and their implementations of
ISDN-CAPI.

How to use it:

First install the CAPI Interface you get with the ISDN-Card.
Then install papi. It is a Terminate and Stay Resident (TSR) program.
Then install the application you want to use i.e. ka9q.

Installation of papi:

	papi [-v] [-x] [-u] [-o eaz] -n telno [ -N telno1 ]
	     [-p PacketIntNo] [-c CAPIIntNo] [-w Timeout] [-s BufSize]
	     [ -S BufSize1 ]

-v	The packet driver is verbose when installing.
-V	The packet driver is writing a status line in upper line of the
	display. You should only use it to debug the driver. It degrades
	performance heavily.
-x	Layer 2 protocol X75
-u	Layer 2 protocol UI-HDLC Frames (default)
-c INT	Soft interrupt of ISDN-CAPI (default 0xF1)
-p INT	Soft interrupt of papi (default 0x60)
-o eaz	The digit which selects calls to your card. (default 2). Has to be
	between 1 and 8.
-n ISDN# The ISDN number of the host you want to connect to. This is the
	only host which might call back. If you do not give a number papi
	is not installed. If the host is not identifying himself with
	his number when calling the call is not accepted!
-N ISDN# The ISDN number of the host as it is given from the network.
	Under certain conditions the number coming from the network is
	different from the number you have to dial. The packet driver is
	using this number as a sort of password.
	The ISDN number is not checked. It is passed directly to the capi.
-i	ignore. Do not check the incoming caller id.
-w n	The line is disconnected when idle for n seconds. (default 10)
-s bytes maximal size for ip packets ( default and maximum 2048).
	The actual maximum for NICCY 3008 is 1024.
-S bytes size used for b2 protocol size.
-P	The driver is working in a sort of polling mode. I.e. instead of
	handling the incoming message in the interrupt only a mark is set
	and the message is handled later in a timer interrupt.
	The AVM-A1 Board is only working with this option.

Examples:

	# start the capi for your card:
	START_S0
	# start the packet driver:
	c:\capi\papi -v -n 12345678 -o 3 -w 240 -u -c 0xF1 -p 0x60 -s 2048
	# start your application (i.e. ka9q):
	c:\nett\net -d c:\nett c:\nett\autoexec.net

More reasonable is:
	c:\capi\papi -n 123456 -w 240

What else should you know:

Copyright: see file copy.

Acknowledgement:
slfp.c, a C-language driver for 8250 slip written by
Glenn H McGregor, and William A Simpson, served as a
skeleton for papi.c. The printf is adapted from the 386BSD
stand alone printf.
The slightly changed getopt.c is coming with Turbo-C.
Many thanks to Dr. Neuhaus, Hamburg for their support.

Comments, Questions, Error Reports, Support, Consulting ...:
capi@friede.de
Dietmar Friede, Friede Consulting,
Westendstr. 117, D-8 Muenchen 2, Germany. Please write do not call.

Registration:
If you use capi, please fill out the file REGISTER and send it to
capi@friede.de

Dietmar Friede
