ipdial (Sat Oct 25 2014 01:31:01)

ipdial

IPDIAL sends files to a remote destination via modem, ISDN or x25. 
 
It reads files from a queue - normally spool/2dial - determines the phone
number to call, calls, optionally logs on, sets up the transmission, sends the
file(s), logs off and drops the connection. 
 
For several files in one queue, it will attempt to send all files for a single
destintion first before cutting the call and starting on subsequent
transmissions. 
 
If the number is busy or the call does not complete, the number is retried
after 10 minutes. This can be modified by the 'interval' parameter.
 
Once connected and ready for sending, each file can be sent plain Ascii,
x/y/zmodem or kermit.
 
For Dutch users, the program can also be used to send between newspapers using
the VC protocol.

A parameter files is used to describe (amongst others) : 
	- how to logon and setup the link   
	- how to start each file transmission
	- how to end each file
	- how to send subsequent files in the same transmission
	- how to logoff 
	- how to disconnect 

The DZ FipHd field is read which should contain the tph number to dial unless
the -n switch is ON for ignore dialno if not there.

The contents of the file are not altered.

The modem setup, dial strings plus the remote computer's logon/off strings are
held in a parameter file. The Syntax of this file are :

	; comment
	setup:		(setup string)
	dial:		(dial and connect string)
	logon:		(logon and file setup string)
	filestart:	(start a file string)
	nextfile:	(start a subsequent file string)
	fileend:	(finish a file string)
	logoff:		(logoff and kill comms string)
	disconn:	(disconnect string)

The strings are in uucp-like format where the syntax is :

	(send1string) (space) (receive1string) (spc) (s2) (spc) (r2) etc
ie you send1, wait 5secs for r1, send s2 wait 5secs for r2 etc.

To send a space, use s or dbl quote that string.
To wait a second - send a tilde (or redefine to your Wait chr)
All keywords - setup, logon etc -  are optional - if one does not exist, it is
ignored.
Embedded spaces may be specified by enclosing within double quotes.

Null fields can be specified by two consequetive double quotes - "". If a wait
is required howver ALWAYS SPECIFY BEFORE the dbl quotes eg: ~~~"" for a 3
second wait with nothing returned.

The sections are done in the following order :
stage 1-	setup
stage 2-		dial
stage 3-			logon
stage 4-				file start
stage 5-				file end
stage 4/5 continued			(other file starts/end if required)
						if next file is specified, it is used otherwise file start
stage 6-			logoff
stage 7-		disconn

Note that when using Zmodem or Kermit transfers, 'fileend' is ignored.

In the parameter file several other options are :

	waitchr:176	wait one sec chr		default: tilde (0176)
	dialchr:174	'insert the dialno here' chr	default: pipe  (0174)
	syschr:$	system precedent chr		default: dollar (0044)
			This is used for Filename '$f' in filestart parameter.
			or $g for 6chr filename or '$s' for sequence number.
		NOTE you will need to move the SYSCHR out of the way if you
		want to use the $Z for seqno etc. ie syschr:%
	timeout:10	timeout wait is 10 secs		default: 5 secs
	bits:7		No of databits 			default: 8
	parity:even/none/odd/space/mark			default: none
		Use this to force all the data transmitted to this parity
		type. eg if the client wants a 7 bit odd parity transmission
		but the channel is opened as an 8 bit no parity pipe.
			parity:even
			bits:7
		Note the data is ONLY parity-ised for talking to the remote
		ie	setup/dial/disconn are NOT changed
			logon/filestart/nextfile/filend/logoff ARE changed
	speed:1200	the transmission speed		default: none
			If you are using modems which cannot flow control and
			are not using kermit or zmodem, often pacing the line
			at a speed lower than the CONNECT eg speed:1100 for 
			a 1200 bps line.
	commerror:NOsCARRIER	break in comms		default: none
			This is advisable for large files sent without a
			protocol (ie no kermit or zmodem). If the remote system
			sends/echos copy back then this will also release
			the buffers.
	interval:	Interval between attempts to send.  default: 600secs (10 mins)
	errdest:	Destination to send file to if it can NOT be sent
							default: none
	msgerr:		Destination to send a message if file can NOT be sent
							default: none
	msgok:		Destination to send a message if file can NOT be sent
							default: none
	sendprog:	Sending program string if not vanilla ascii
	nocomplain:	Do not complain if files do NOT exist in the input queue
	kermit:		Send the text using Kermit Protocol
	xmodem:		Send the text using Xmodem Protocol
	ymodem:		Send the text using Ymodem Protocol
	zmodem:		Send the text using Zmodem Protocol
	remname:	to change the filename on the remote system eg:	remname:$g.xy
	forcename:u/l to force the remote name upper or lower case.
	max-take-size:	Split the outgoing file into takes with this maximum.
			default is Do NOT split.
	take-end:	Text (in FipSeq) to add at the end of a take
			but NOT the end of file.	default: none
			Note that FipHdr D1 holds the take number.
	take-start:	Text (in FipSeq) to add at the begining of a take
			but NOT the first file.		default: none
	maxattempts:	There is the limit on the number of attempts. File are
		sent to woops if this is exceeded. Default is 5 goes.
		Set to zero for NO limit.
		The biggest maxattempts is 100 - use 0 for no limit.
	disconnect-attempts: Sometimes some modems do NOT disconnect the firsttime
		Use this to specify the number of attempts at disconnecting	- default:1
	error-queue: Folder for files which have tried 'maxattampts' times
			The default is 'woops'
	zap-on-error: Just delete the file if we have tried 'maxattempts' times.
			Default is that the file is moved to 'woops' or the 'error-queue'
	onefile:	Send a single file then cut the call and redial
		Normally ipdial scans its queue for all files for that phone no.
	waitque:	Wait period after the queue is empty before disconnecting
			in case a new file arrives.	default: 0 secs
			The maximum wait is 100 seconds.
	endwait:	Wait period before disconnection after all
			data has been sent. default 1 sec for PSTN, 5 for x25
			The maximum wait is 100 seconds.
	logfile:(dest)	Send to this destination the log of what happened during
			transmission. This destination defaults to LOGDIAL (uppercase).
			It must be an entry in tables/sys/USERS.
			If the log is to be sent to another destination, specify
			as the parameter to 'logfile:'
			eg logfile:nytdone	sends the file to Dest 'nytdone'
			default: no log created.
	logeachfile:(dest) Send a Success/failed msg to this destination for each
file.
			There is no default.
			This log file is just a FipHdr with the following extra fields :
				DR-File Sent OK		DR:ok or DR:error
				DG-Will Retry later	DG:retrying or DG:stopped
				DT-Some message text	DT:No connection
				DO-Number of last attempt	DO:5
				HT-Date and Time	HT:25 Nov 98 15:35:25
			default: no log created.
			The DR and DG messages can be changed by using :
				log-dr-ok:(FipSeq)
				log-dr-error:(FipSeq)
				log-dg-stop:(FipSeq)
				log-dg-retry:(FipSeq)
			eg: log-dr-ok:File VN sent to Remote Number DZ ($h:$n)
	msgeachfile:(FipSeq) Additional information to add to the FipHdr of the
'logeachfile'
			msg. This should be in FipHdr format and be in FipSeq. It can be
			used to pass FipHdr fields in the outgoing file into the log file.
			eg	msgeachfile:	DF:logdialnSS:SSn
			default: nothing added
	in-start:	Start of incoming file string in FipSeq
			use this with -I allow incoming files.
			default: none
			example		in-start:01
	in-end:		End of incoming file string in FipSeq
			use this with -I allow incoming files.
			default: none
			example		in-end:NNNNrn
	in-dest:	Fip Destination for incoming files.
			use this with -I allow incoming files
			This is the Fip Hdr 'DU' and there should be an entry
			in the tables/sys/USERS parameter file of the same name.
			default: dial_incoming
	in-source:	Source for incoming files.
			This is the Fip Hdr 'SU'.
			default: VC
	in-fiphdr:	Extra Fip Hdr fields to be added to any
			incoming file.			default: none
	in-before:	String (in FipSeq) to be placed at the top
			of any incoming file.		default: none
	in-after:	String (in FipSeq) to be placed at the end
			of any incoming file.		default: none
	in-no-archive:	Do NOT archive the incoming file in the daily archive
			Use this when the incoming file is being passed on to
			'ipdskwir' or another process which will also 
			set the archive flag.

Example :
	setup:rr~+++ OKr athr OKr ~at&fr OKr ~atf0%b9600r OKr
	dial:~atdt9|rn	CONNECT
	logon:lirn	LOGON
	filestart:~~~news$frn~~
	logoff:lorn LOGOFF lorn
	disconn:~~+++ OKr ~+++ OKr athr OKr 

That is for setup, we want to :
	send CR CR , wait a second, send +++
	wait for OK CR
	send ath CR
	wait for OK CR
	send at&f CR
	wait for OK CR
	send atf0%b9600 CR
	wait for OK CR

BEWARE ..
	1. If you have any spaces in the sting to send/receive, you MUST quote :
			filestart:~~"01ABC$Z PR CA $WrnDIrn02"
	2. If you are using FipSeq System Variables - $Z, $D etc, then you must
		move 'syschr' to another character as it defaults to a dollar !!
			syschr:^

One point to note if you are using the TTY ports is that they INVARIABLY need
to be setup using the STTY parameter file in tables/stty. Ths syntax of the
file is covered in the Unix manual pages. The name of the file in tables/stty
is :
		STTY_NAME_PORT	(all uppercase)
		where NAME is the name of the parameter table which will be ..
			either "DIAL" or the "-z" default or the contents of the DF field
		where PORT is the TTY name ie for ttya : TTYA; for ttyx16 : TTYX16
For tuning, start off with one of the existing tty files in tables/stty. Note
that stty for the SunOS4 loads a port using '(stty params) > /dev/ttya'.
However the arrow is reversed on Solaris, DEC OSF and rs6000 : '(stty params) <
/dev/tty4'.  On NT, the parameters are the same as for the 'mode' command.

For testing a new destination, it is rare to get it right first time!
There is a 'verbose' flag, -L, which will display the whole dialogue as it
happens. You can run the program manually from any terminal or window. eg
	ipdial -s black2 -p 1210 -L 
or to also save the results in a log file :
	ipdial -s black2 -p 1210 -L | tee LOGFILE
Be careful in the latter case, that you are in a personal queue and not a
tables or spool queue and that the name of the log file - LOGFILE in this case
does not exist.

For Dutch users, the program can also be used to send VC type traffic. The
editorial system which is sending VC traffic needs the status of each
transmission. To do this when a file is sent (or rejected) a status or update
file is sent back to the sender. Use 'logeachfile:' to send the status message
back, the actual messages can be translated using the 'log-dr-ok' etc keywords.
Remember to add input switch -I to allow incomings :
	ipdial -s tiptermserv -p 1015 -I -Y -z VC

Where sections of FipHdr fields are required or changes to the output style,
use
 keywords : fixed, partial, combie, optional, repeat, newdate and/or style.
(see The SysA
dmin manual for more information).

	They are normally specified :
		fixed:QZ	1234543
		partial:QT	ST,3,2,U,<,>
		combie:QY	ep|na,(0000000)a
		option:QE	ep,11,7,s
		repeat:QK	XK,-,3
	or	repeat:QP	PK,,4,#X
		style:QS	XN,%.03d

Input Parameters :
	Mandatory :
	-s : Spider name or TTY device name		default: none
	-p : Spider port number				default: none
	Optional :
	-n : do not look for nor check the tph number	default: DZ field is tph
	-z : default parameter table to setup comms if not overwritten by
		the 'DF' FIP header field.	default: tables/dial/DIAL
	-q : input queue to scan			default: spool/2dial
	-d : do NOT delete the files after sending	default: delete
	-D : disconnect from the port after each transmission	default: -
		While 'ipdial' always disconnects from the modem, this also
		drops any TCP connection too. So this will disconnect from the
		terminal server too.
	-I : allow incoming files			default: no
		there must be an 'in-start' and 'in-end' in the parameter file
	-l : do NOT log any files sent			default: log outgoings
	-L : Display all in/out for the session		default: no
		except text
	-O : done queue for sent files			default: none
		Normally files are deleted after sending.
	-t : inter-file wait when sending more than one file. default: 1 sec
	-T : log the trace of each transaction		default: do not
		This generates a one line log of each file sent is stored in
		log/remote_trace with a name of 'date_(DF)'.
	-w : file wait is seconds			default: 0 - no wait
		This is for files arriving over the network.
	-x : wakeup string for terminal server		default: none
	-X : Turn Telnet Transparency OFF		default: ON
		For terminal servers, is the port set to transparency ?
	-U : Raw or Telnet NO-escape mode		default: telnet transparency ON
		For terminal servers, is the port set to transparency ? 
	-y : Banner string to strip from terminal server.default: SpiderBanner
	-Y : There is no banner to strip		default: as above
	-V : old style VC traffic			default: no
	-1 : Single pass then stop			default: keep spooling
	-v : Print the version number and exit


TODO-how to setup VC
There should be a file called tables/route/('SU') to describe the routing for
this file.

Version Control
;026q	30nov99	added takes
	;b 29nov00 improved logeachmsg
	;c 04jan01 added parity:
	;d/e/f 22jan01 for failures - check maxAttempts before checking time
	;g 26feb01 enabled 'errdest'
	;h/i/j/k 20mar01 added ignore RecvError0 if in Disconnect
	;m 29oct01 added disconnect-attempts
	;n 14mar02 added remote-trace
	;o-q 01jan03 MACOSX
;025	17nov99	added redun_balance
;024	27aug99	added -D to Disconnect from Spider
;023	29mar99	LINUX - not tty

(copyright) 2014 and previous years FingerPost Ltd.