Samsons offers: _____ _ _ | __ \(_) | | | | | |_ __ _| |_ _ _ __ | | | | |/ _` | | | | | '_ \ | |__| | | (_| | | |_| | |_) | |_____/|_|\__,_|_|\__,_| .__/ | | Version 3.01 |_| ------------ PLEASE READ THE DOCS, DIALUP IP IS NO EASY THING! PLEASE TRY THE OPTION 'TEST', IT IS INCREDIBLY HELPFUL. YOU CAN TEST EVERYTHING LOCALLY WITHOUT WASTING ANY MONEY ON PHONECALLS. ITS NOT PUBLIC DOMAIN, ITS NO SHAREWARE, NO FREEWARE, GIFTWARE OR CARDWARE AND HAS NO COPYLEFT OR -RIGHT. ITS SIMPLY A PROGRAMM TO USE, IF YOU LIKE. AND EVEN BETTER: IT NOW COMES WITH SOURCES! P U R P O S E: -------------- This programm is intended to establish a dialup IP connection (SLIP or PPP) to another computer. It is assumed that a modem or a similiar device is connected to a serial line of your amiga. (An ISDNMASTER with approriate device does work, too) R E Q U I R E M E N T S: ------------------------ - Installed and *tested* AmiTCP or AS225 - appropriate Sana2 Driver for your intended connection - min. OS 2.04 H O W T O B E G I N: ------------------------ To start, you should do the dialup manualy, first. If you have figured out the commands for the modem and its results, and the questions of the remote site and the expected answers, you can use dialup with the appropriate options: LOGINPROMPT, LOGINNAME, PASSWORDPROMPT, PASSWORD, CONNECTSTRING, etc.. A few of them are required, but most of them are optional and only neccesary, if you have a strange modem or remotesite. To make small steps from the manual to the automatic dialup, you can save your modem settings together with the phonenumber in the modem. If you do this, you can already use the defaults for MODEMSETTINGSCONNECT=MSC (ATZ1) and PHONENUMBER=PN (ATDS1). The modemcommands for saving config and phonenumbers are: AT&Z1=xxxx and AT&W1 If you have configured dialup correctly (SANADEVICE=SAD and SANAUNIT=SAU), the ONLINE and OFFLINE CLI-commands of the SANA-device are obsolete, cause dialup handles this by itself. N O T E S: --------- The program is residentable (pure with the help of cres.o) HINT: To test the program, use the option TEST. This performs a modem ==== internal loopback instead of a real CONNECT. You can see what will go on during CONNECT, HANGUP, etc.. With SLIP you can even ping yourself or ftp, etc.. THIS WORKS WITH AMITCP, TOO, IF YOU REMOVE THE ROUTE FOR 'OWNHOST' TO THE LOOPBACKINTERFACE. USE: 'route delete ' or see the script at the end of the docs! S A V I N G C O N F I G U R A T I O N: ---------------------------------------- It is possible to set any option in ENV:Dialup (Setenv Dialup "PASSWORD=ItsMe") BEWARE: ONLY the FIRST LINE gets parsed! To check the settings (from ENV:Dialup) and its parsing, use: 'dialup DEfaults ALL' D E S C R I P T I O N O F P A R A M E T E R S: ================================================== The template is: Dialup [COMMAND] [OPTIONS] WARNING: ======== Please note, that COMMAND is optional, too. This means, that if you accept the default command (TOGGLE), any misspelled option gets the COMMAND instead of the default one and probably pops up the usage requester. Every other wrong option (or even the first, when you specified a COMMAND, gets a PHONENUMBER. This is not my fault, this is the documented behaviour of dos.library/ReadArgs() on /M paramters. COMMAND=CMD =========== The default is TOGGLE. The command can be specified without keyword. The first word of the commandline, which is not a keyword or switch of the template, is taken as the command. Possible commands: CONNECT=CO Try to build a modem connection. Basically this performs: ATZ1 ATDS1 sana online If you want to be sure, that the connection is established, when you start ftp or some other networking stuff, write a script which calls Dialup CONNECT QUIET before the net application. QUIET suppress' the warning, if you are already connected. Result: 1 if success, 5 if modem is already online HANGUP=HA Break a connection. This even works during full data transfer. (Cause it sucks :-) the serial line) Basically this performs: +++ ATZ1 sana offline If you have a feed, which calls you when packets arrive, you will be called back. To make the modem take the call by itself, the NORECONNECT option must not be set. Result: 0 if success TOGGLE=TO Toggles between CONNECT and HANGUP, depending on carrier Result: see CONNECT/HANGUP TAKE=TA Sends a ATA\r (MODEMOFFHOOKCMD=MOH) to the modem after RINGS=RGS\K\N rings (MODEMRING=MRG\K) are detected and makes sana device online. If a carrier is detected on startup, only the sana device is made online. Result: 3 if success QUERY=QU Querys the modem for some information, even when connected. This will work only with the NODTRIGNORE switch not set (or you configured the modem to ignore DTR anyway). Basically this performs: sana offline +++ ATI2 ATO sana online See MODEMQUERYCMD for the type of information gathered from modem. To get a nice status report from modem you could use: > dialup QUery RePortFile "CON:100/100/400/200/.. ..Dialup Query/CLOSE/INACTIVE/WAIT" Result: 2 if success OFFLINE=OF sana offline Result: 0 if success ONLINE=ON sana online Result: 0 if success CARRIERDETECT=CD sana offline, if no carrier and online if carrier. Meaningfull options: AUTOANSWER=AA and if this is set RINGS=RGS and MODEMSETTINGSCONNECT=MSC Result: 0 if offline, 5 if online CHECK=CH Possible at any time! It only sets a returncode: Result: 0 if no carrier, 5 if carrier Note: For checking the serial line without hitting the hardware directly, it is neccessary to offline/online the slip device to open the serial.device. This normaly doesn't disturb an ongoing transmission. DEFAULT=DE Query any option for its default. Helpfull to see what will be sent to modem, and chated with your remote site. Use GIVEALLSETTINGS=ALL if you want to see all the default parameters (including ENV:DIALUP) or name a specific. 1> setenv DIALUP "MSC=ATsomething" 1> Dialup DEFAULT MODEMSETTINGSCONNECT MODEMSETTINGSCONNECT=MSC/K: ATsomething or 1> Dialup DEFAULT GIVEALLSETTTINGS CONNECTSTRING=CS/F: 19200/V42b SANAUNIT=SAU/K/N: 0 SANADEVICE=SAD/K: Networks/rhcslip.device NORECONNECT=NRC/S: OFF [ .. ] RINGS=RGS/K/N: 1 MODEMCONNECTTIME=MCT/K/N: 40 REDIALDELAY=RDD/K/N: 60 PHONENUMBER=PN/K/M: ATDS1 MODEMSETTINGSCONNECT=MSC/K: ATZ1 O P T I O N S: ============== General notes on paramters: - All options can be kept set for any of the above commands, but not all have a meaning to a specific command. - To send special chars, use \n for LF, \r for CR and \t for TAB. To send a single \ use \\. - For any expected string you can use patterns: Pattern Matches ------- ------- ? any single character c* zero or more occurrences of character c c+ one or more occurrences of character c \? a question mark (?) \* an asterisk (*) \+ a plus sign (+) Any other character must match exactly. The following table lists some examples: Pattern Matches ------- ------- abc only abc ab*c ac, abc, or abbc ab+c abc, abbc, or abbbc ab?*c a string starting with ab and ending in c, for example, abxyzc ab\*c only ab*c - Multiple matching strings: If there is more than one possible string you can specify all of them, sparated by '|'. To specify '|' use '?'. Example: MOK="OK|DONE" or MODEMLINEBUSY="NO CARRIER|BUSY" I thoght a long time about implementing the pattern matching through dos calls, but the parsing and specifying of parameters would have been a pain: (#?BUSY\n#?)|(#?NO CARRIER\n#?)|(#?CONNECT#?19200#?\n)|etc. Write me a mail, if you really would like to have it. B A S I C O P T I O N S: --------------------------- PHONENUMBER=PN/K/M The phonenumber(s!) to dial. If the parameter has a leading 'AT' or '!' no ATD is sent before the number. ('!' will be stripped) Default: S1 -> ATDS1 Example: 1234 -> ATD1234 ATDP1234 -> ATDP1234 !foobar -> foobar pn S1 pn=S1 pn ATDP1234\ -> ATDS1 ATDS1 ATDP1234 If the call fails with BUSY, it would wait the REDIALDELAY and try again. If this fails, too, it immediately trys 1234. Warning: Everything what cannot be identifyed as an option ======= or a COMMAND will get a phonenumber. This is not my fault, this is the documented behaviour of dos.library/ReadArgs() on /M paramters. SANADEVICE=SAD/K, Sana device to use. You have to specify 'Networks/yoursana.device', if it is in DEVS:Networks. Default: "NetWorks/rhcslip.device" SANAUNIT=SAU/K/N, Sana unit to use. Default: 0 SANACONFIGFILE=SCF/K, Config file of the sana device. It must match: "SERNAME/A,SERUNIT/A/N,SERBAUD/A/N,IPSTR/A,.. ..CD=CARRIERDETECT/S,7WIRE/S,EOFMODE/S,MTU/K/N,THEREST/F Examples: ppp%d.config, ppp0.config, sys:devs/myconfig Default: "ENV:SANA2/slip0.config" (This file gets read by *any* slip device) REDIALDELAY=RDD/K/N Seconds to wait after a BUSY (MLB\K) before calling the *same* number(s) again. If you specify 0 it will NOT retry on BUSY. Default: 180 RINGS=RGS/K/N Number of rings to wait before the modem should take an icomming call. This takes effect only after a HANGUP or CARRIERDETECT with AUTOANSWER! With the TAKE command this in the number of RINGs to receive from the modem, before takeing the call. For TAKE it is possible to specify 0. Default: 1 O P E R A T I N G M O D E S: ------------------------------ AUTOANSWER=AA/S Take any incomming call after HANGUP, sana stays online. The parameter RINGS tells the modem how many rings it should wait before offhook. Default: OFF NODTRIGNORE=NDI/S Disable the sending of AT&D0 to the modem before a CONNECT and AT&D2 after HANGUP. Normaly AT&D0 is necessary, to not drop the line befor makeing sana online. Default: OFF NOSERINIT=NSI/S, To avoid initialisation of serial line with the parameters from 'ENV:SANA/slip0.config' (in fact SANACONFIGFILE=SCF/K; it is read anyway, to get the device(name) to open) Default: OFF NORECONNECT=NRC/S, No autoanswer during CONNECT (e. g. carrier lost, remote site calls back). Modem takes phone after first ring until you do a HANGUP without AutoAnswer. Default: OFF R E P O R T A N D D E B U G O P T I O N S: ------------------------------------------------ CONNECTSTRING=CS/K This string is expectd as the connectstring from the modem. If its not found, a requester pops up, telling you the actual connect message. If you specify CONNECT you will never see a requester(If your modem gives at leas this answer for a connect). With this parameter it is possible to use patterns. See top note for information on patterns. Default: "CONNECT*?19200/V42b" REPORTFILE=RPF/K Where to put the report of the serial communication. Note: I've never observed that dialup looses *ANY* character. If you have troubles with the serial communication, it is sometimes helpfull to send the output to a file and view it with: 1> type hex Another good use is to specify a window like RPF="CON:100/100/400/200/Dialup/CLOSE/INACTIVE" When you press the (toolmanager) hotkey to start dialup, you can see whats going on. If there is no error, it is closed after successful connection. If an error occours, and you started it with '< NIL:' somehow, a requester pops up, telling you the failure. But during this time the RPF window keeps open and you can examine every detail of the report. I realy like this! Default: stdout QUIET/S Be quiet to stdout and suppress all non fatal messages. Default: OFF STDEER/S No requesters anymore. Errors and warnings are sent to '*' (console) as long as '*' could be opened and even if there is an interactive inputstream (e.g. shell) for the program. Default: OFF VERBOSE/S Reports all internal function calls with strings sent to serial line and all expected returns. To avoid intermixing these messages with the serial communication itself, a console widow gets the default for RPF. Default: OFF TEST/S This is a very helpfull option. Instead of dialing a number, it does AT&T1. This is a modem internal loopback mode. This enables you to do a ping to yourself *over* the modem. You can even do a ftp to your machine and check the max. transmission speed. After this you can QUERY the modem and look for any errors. This is true for AmiTCP, too. See script at the end. The tcp-test (ping, etc.) is not possible with ppp, however, cause it uses a more complicated transmission concept and doesn't accept this simple loopback. Default: OFF GIVEALLSETTIGNS=ALL/S This switch is only valid with the DEFAULT command! It shows all current defaults. ENV:Dialup takes effect! C H A T O P T I O N O S: -------------------------- WAKEUPSTRING=WUS/K String is sent after connect, before 'ogin:' (LIP) is expected. Remember: Use \n for LF, \r for CR and \t for TAB. To send a single \ use \\. No default. LOGINPROMPT=LIP/K Prompt of the remote site to enter your name. To skip login and password communication use LIP="". Default: "ogin:" LOGINNAME=LIN/K Name to send after receiving the LOGINPROMPT. If not specified, it will be taken from the environment variable HOSTNAME. No default. (or ${HOSTNAME}) LOGINTIMEOUT/K/N Seconds to wait for the loginprompt of the remote site. Default: 3 PASSWORDPROMPT=PWP/K Prompt of the remotesite to enter your password. With this parameter it is possible to use patterns, too. See LOGINPROMPT=LIP To skip password communication use PWP="". Default: "assword:" PASSWORD=PW/K String to send after the PASSWORDPROMPT is received. No default. SNDLOGINNAME=SLIN/K This gets sent, if specified at all, after receiving what is set for (no default) SNDLOGINPROMPT=SLIP/K Default: ogin: SNDPASSWORD=SPW/K This gets sent, if specified at all, after receiving what is set for: (no default) SNDPASSWORDPROMPT=SPWP/K Default: "assword:" LOGINOK=LOK/K, Message of the remote site after succesfull login. Use LOK "" to skip this check. Default: "Packet mode enabled" LOGINOKTIMEOUT=LOT/K/N The timeout (in seconds) for the answer (LOK) to a successfull login. Default: 3 M O D E M A D J U S T M E N T: ------------------------------- MODEMSETTINGSCONNECT=MSC/K Command string to send to the modem before any attempt to connect. If you don't want to send something use MSC "" Default: ATZ1 MODEMCONNECTTIME=MCT/K/N The time in seconds, the modem needs to dial and handshake with the remote site. Default: 61 MODEMSETTINGHANGUP=MSH/K Command string to send to modem after HANGUP. To avoid this completely use MSH "". Default: ATZ1 MODEMQUERYCMD=MQC/K Hayes commands to query modem. This command is sent to the Modem to query the modemstatus ( or anything else you want to know ). You even can change the configuration of the modem, during it is online. Default: AT&VI2 MODEMREADYCMD=MRC/K Command, the modem answers with MODEMCMDOK=MOK/K (OK) Default: AT MODEMHANGUPCMD=MHC/K Command to make the modem drop line. Default: ATH0 MODEMNOCARRIER=MNC/K Answer of modem on failed CONNECT Default: NO CARRIER MODEMLINEBUSY=MLB/K Message of modem when line busy. Default: BUSY MODEMLINEDEAD=MLD/K Message of modem when it doesn't get a dialtone. Default: NO DIALTONE MODEMRING=MRG/K Message of modem when a call comes in. Default: RING MODEMANYCONNECT=MAC/K Message of modem if a connection of any kind has been established. Default: 'CONNECT?*' (see LOGINPROMPT) MODEMCMDOK=MOK/K Answer from Modem if command is ok. Default: OK MODEMAACMD=MAAC/K Make modem take phonecall after RINGS=RGS/K/N Default: ATS0=%d MODEMOFFLINECMD=MOC/K Make modem accept commands again (offline) Default: +++ MODEMONLINECMD=MLC/K Bring modem online again Default: ATO MODEMTESTCMD=MTC/K modem to internal loop-back mode Default: AT&T1 MODEMOFFHOOKCMD=MOH/K make modem off hook and answer the call. Default: ATA MODEMTESTOFFCMD=MTO/K switch of modem loopback Default: AT&T0 MODEMCMDOK=MOK/K Answer from Modem if command is OK Default: OK A d d i t i o n a l n o t e s: -------------------------------- The stackusage is about than 3000 Bytes and the memoryusage is less than 30K Bytes. As long as dialup is started from a console (input not NIL:), the messages are sent to it. If you start it without console, but don't want to see any requester, use option STDERR. If you use VERBOSE, a default window is opened for the serial communication. You can override this by specifying RPF CON:////dialup.. The best use for this program is to make it startable with a hotkey. (e.g. ToolManager) Commandline: 'Dialup REPORTFILE T:dialup.report'. Think about making it resident, if you can afford the memory. To stop the program at ANY time press ^C in the shell or start it a second time. If you start the program a second time ( e.g. after a BUSY, waiting for the REDIALDELAY ) it sends a ^C to its first occurence. So, if you have the programm bound to a hotkey, just press it again to stop the (re)dialing. To reset the modem I use: 'Dialup HANGUP NODTRIGNORE MODEMSETTINGSHANGUP ATZ' or short: 'Dialup ha ndi msh atz' To get a system, taking incomming calls after every reboot, add 'Dialup CARRIERDETECT AUTOANSWER QUIET RINGS=n' to your user-startup. But this only works if no programm is causing slip packets beeing sent to the modem, otherwise the modem connect could get disturbed. I always load the whole network sw in user startup: AS225: ------ 8<------------------------------------------ INET:c/config > ENV:HOSTNAME HOSTNAME INET:c/config > ENV:USER USER INET:c/ifconfig lo0 127.1 INET:c/ifconfig s0 $hostname -trailers INET:c/Route add default 0 Dialup CARRIERDETECT IF WARN Ping IF NOT WARN Say "Connected to Intearnet" EndIF EndIF 8<------------------------------------------ AmiTCP: ------- 8<------------------------------------------ Run < NIL: > NIL: AmiTCP:AmiTCP WaitForPort AMITCP Wait 2 secs RX "ADDRESS AMITCP;'SET CON NIL:'" ; stops this 'slip.device online/offline' messages. AmiTCP:bin/ifconfig lo/0 localhost AmiTCP:bin/ifconfig Devs:Networks/rhcslip.device/0 xxx.yyy.zz.uuu aaa.bbb.ccc.ddd netmask 255.255.255.0 ;AmiTCP:bin/route add troja.mppmu.mpg.de localhost ; remove to enable ping over modem! AmiTCP:bin/route add default 134.107.2.51 AmiTCP:bin/route add 134.107.2.6 Run < NIL: > NIL: AmiTCP:bin/inetd Mount TCP: Dialup CARRIERDETECT IF WARN Ping IF NOT WARN Say "Connected to Intearnet" EndIF EndIF 8<------------------------------------------ Then simply start dialup anytime later and you get connected. Have fun! Questions and bugreports (?? :-) to: Thomas Kobler Libellenstr. 29 80939 München Germany kobler@mpiw13.mppmu.mpg.de +49 89 3241329 (and +49 89 32308311 at work) try to 'talk' to me at samson@troja.mppmu.mpg.de or (kobler@pctok.mppmu.mpg.de at work) After all the time I spent on this stuff, I feel that it would be nice if you send me something: ranging from an email over nice gifts to some financial donations. Its up to you.