Short: SLIP dialer; stdin/out terminal program Author: jochen.wiedmann@zdv.uni-tuebingen.de Uploader: jochen.wiedmann@zdv.uni-tuebingen.de Type: comm/tcp IPDial - serial device communication program ============================================ IPDial is designed especially for creating a SLIP connection via the modem to a remote host: It can dial the remote hosts number, login into the host and initilize a SLIP connection. Configuring IPDial is rather easy, as it reads its command from a textfile. IPDial is best used from AmiTCP's startnet and stopnet scripts. This allows you to completely connect or disconnect by just typing the words "startnet" or "stopnet", respectively. 1.) Disclaimer: Copyrights, (No) Warranty ----------------------------------------- This program is Copyright (C) 1994 Jochen Wiedmann Am Eisteich 9 72555 Metzingen Germany Phone: (0049) +7123 / 14881 Mail: jochen.wiedmann@uni-tuebingen.de Permission is granted to make and distribute either verbatim and modified copies of this documentation and the program IPDial provided the copyright notice and this permission notice are preserved on all copies and the "GNU General Public License" (in the file COPYING) is distributed as well. The author gives ABSOLUTELY NO warranty that the program described in this documentation and the results produced by them are correct. The author cannot be held responsible for ANY damage resulting from the use of this software. 2.) Installation ---------------- Rather simple. Just copy the program to a place in your path and edit the two files "login.script" and "hangup.script". (See Script file syntax below for details.) You might want to enter the line IPDial login.script at the beginning of AmiTCP's startnet script. Thus you get a SLIP connection by simply typing startnet. Similar you could add the line IPDial hangup.script at the bottom of the stopnet script. 3.) Invocation -------------- IPDial is started like this: IPDial SCRIPT,ECHO/S,VERBOSE/S,TERMINAL/S,DEVICE/K,PROTOCOL/K,UNIT/K/N What IPDial does, depends on the TERMINAL switch: If this is active, the arguments DEVICE, UNIT and PROTOCOL are used to open the serial.device. Once it is opened, the program acts as a very simple terminal program. If TERMINAL is omitted, the given SCRIPT is read and the commands of the script are executed line by line. (See below) The argument ECHO instructs IPDial to print the modems replies to stdout, while VERBOSE is used to show what the program's doing. 4.) Script file syntax ---------------------- - Any line of the script file may contain only one command. In general command arguments are parsed with ReadArgs(), thus they may look like CLI command line arguments: The characters "" may surround a string which contains blanks. - Empty lines or lines beginning with a semicolon are assumed to be comments and thus ignored. - Lines may begin with a label, an alphanumeric word followed by a colon. Labels are ignored, except that they may be used as destinations for "goto" instructions. (Anyone said BASIC? Yes, it is. :-) Labels are case-sensitive. - This is the list of possible commands: DEVICE NAME/A,PROTOCOL,UNIT/K/N Opens the given device NAME with unit UNIT (Default 0). This must be compatible to the serial.device. PROTOCOL may be one of XONXOFF, RTSCTS, 7WIRE (Synonym for RTSCTS) or NONE. Note that explicitly requesting a protocol overwrites the defaults set by the Derial preferences program. The DEVICE command should in general be the first command of each script. SET BAUD/N/K,DATABITS/N/K,STOPBITS/N/K,BUFSIZE/N/K,PARITY/K This command is used to modify the serial.device parameters. Note, that these overwrite the Serial preferences. Possible parameters are: BAUD baud rate DATABITS number of databits STOPBITS number of stopbits BUFSIZE read buffer size PARITY one of ODD, EVEN or NONE SHOWPARMS Writes the current serial.device settings to stdout. ECHO ARGS/M This will write the given ARGS to stdout. Note, that these strings may contain patterns like \r (Carriage Return), \n (Line Feed) and \\ (Backslash :-) The arguments are separated by blanks, when they are printed. Note that ECHO does not write any Line Feeds or Carriage Returns unless you explicitly request it with the respective patterns. SEND ARGS/M This command sends the given strings to the serial.device using DoIO(). These strings may contain the same patterns as described with the ECHO command. Unlike ECHO the arguments aren't separeted by blanks. The words given with ARGS may contain patterns like $HOST or ${HOST}: These are replaced by the respective environment variable. (Empty string, if the variable doesn't exist.) $$ represents the $ character itself. DELAY SECS/A Delays the given number of seconds. WAIT TIMEOUT/K/N/A,ARGS/M This command waits until either one of the given strings is read from the serial.device or the number of seconds given by TIMEOUT has gone. A variable called STATUS indicates what happened: It contains either -1 for timeout or the number of the string that was read, beginning with 0. This variable may be used by the ON statement. ON STATUS GOTO LABELS/M There's currently only one version of the ON command. An ON command must follow a WAIT command. ON reads the value of the STATUS variable and jumps to the first one, if STATUS is -1, to the second, if STATUS is 0 and so on. A typical use of WAIT/ON looks like this: WAIT TIMEOUT=10 "Login:" "Busy" ON STATUS GOTO TimeOut Login Busy TimeOut: ECHO "Timeout happened, aborting.\n" EXIT 10 Busy: ECHO "Remote busy, delaying...\n" DELAY 25 ECHO "Trying again.\n" GOTO DialAgain Login: ; Execute the login procedure You do not need to supply a label for any wait string: This will suppress jumping and instead continue on the next line. GOTO LABEL/A Jumps to the given label TERMINAL Enters terminal mode: What you enter at the keyboard will be sent to the serial.device and likewise the program will display any input from the serial.device to you. The TERMINAL command will be finished, if you enter EOF (Ctrl-\). EXIT RESULT Terminates the program, returns the given RESULT. (Defaults to 0.) Commands are case-insensitive. See the scrips Login.IPDial and Hangup.IPDial as examples. ============================= Archive contents ============================= Original Packed Ratio Date Time Name -------- ------- ----- --------- -------- ------------- 5012 1997 60.1% 02-Mar-95 19:03:10 ipdial/Buffer.c 17982 6993 61.1% 02-Mar-95 19:03:10 ipdial/COPYING 4401 1674 61.9% 02-Mar-95 19:03:10 ipdial/DeviceIO.c 3549 1211 65.8% 15-Mar-95 09:55:26 ipdial/DMakefile 1618 713 55.9% 02-Mar-95 19:03:10 ipdial/Hangup.IPDial 32780 17802 45.6% 02-Mar-95 19:03:10 ipdial/IPDial 15811 4862 69.2% 02-Mar-95 19:03:10 ipdial/IPDial.c 2783 1137 59.1% 02-Mar-95 19:03:10 ipdial/IPDial.h 6505 2949 54.6% 02-Mar-95 19:03:10 ipdial/IPDial.readme 3817 1310 65.6% 02-Mar-95 19:03:10 ipdial/Login.IPDial 15396 4361 71.6% 02-Mar-95 19:03:10 ipdial/Serial.c 2022 1028 49.1% 02-Mar-95 19:03:10 ipdial/StrReadArgs.c -------- ------- ----- --------- -------- 111676 46037 58.7% 21-Mar-95 14:26:04 12 files