Building a Uucp System
9.4 Uudco - Copy In, Copy Out
The uuc;coprogram will perform the following major functions:
Scanthe spool directory for wort.
Place aeaD to a rcmote system.
Negotiate a line protocOl to be used.
ExccuteaD rc:que~s from both systems.
Log work requests and WCI't completions.
Uuc;co may be started by a system daemon. by one of the uucp, uux ,uuxqt , OIl UUC;CO
programs, by the user (this is usually for testing), or by a remote system. (The uucico program should be specified as the sheD field in the letclpasswd file fa the uucp Iogins.)
When started by method a daemon, a program. OIl the user, the program is considered to be in MASTER mode. In this mode. a connection will be made to a remote system. If
9-5
started by a remote system. the program is consic:kredtobe inStA VEmodc.
The MASTER mode will operate in one of two ways. If no system name is specified (the -5 oplion not specified)tbe program will scanthc spool directory forsystcms tocaU. If a system name is specified, lhal sySlem will be called. aud
wort
wiD only be done for that system.The WU";co program is generally SWtcdby aDOlhCl" program. There arc scvcraloptions used for execution:
-rl Swt the program in MASTER mode. 1biJ is used when IlllCico is Slar1cd bya program orcronsbeD.
-s.sys Do wort only for system sys. If - I is specified. a caU to the specified system wiU be made even if there is DO woik for system sys in the spool directory. This is useful for POllin& systems which do DOt have the hardWlRtoinitiate ac:onDCC:tioa.
The foUowing opcrionsare used primarily fordebugging:
-ddir -xnum
Uscdirectcry dirforthe spool directcry.
Usc num as the Icvelof debup&output.
The next pan of this secUoa wiD describe the ~steps within the IIUC;COprogram.
9.4.1
Scaunla& F.
WorkThe names of the wortrelatcd files in the spoOl diredcry have formal type • system-name grade 1rI4mbe,
where type may be "C" fOl'copyc:OIlIID.IDI file, "D" fordara file, "X" forexec:ute file, syslem-1IDme is the remote system. g1Cllle iI a characta'. and nu:nbe, iI a four digit. padded sequence number.
The file
C.res4SnOO3J
is a work file for a filetransferbctweenthe Ioc:almachine and tberes4S machine.
The scan for woat is done by looting through the spool directory for
wert
files (files with prefix C.). A list is made of aU systems to be called. Uucico wiD then c:alI each system and proc:essaU WOItfiJeI.9.4.1 CaDiDa • Remote System
The caU is made using information from sevenl files which reside in the uucpprogram directory. At the start of the call process. a lock is set to forbid multiple con\'Crsations bctweenthe samctwosystema.
The system name is fOUDd in the L.sys tile. The informationoomained for each system is;
9-6
ill
System name121
Timestocalilhe system (days-of -wectand timcs-of-day)[31
DcviceordevicctypetobeuscdforcaDr41
line speedr
51
phone number if fieldr 31
is •• ACU ,. or the device name (same as fieWr 31>
ifnot
r61
Login information (multiple fields)Thetime6cldischeckedagainstthepreSCDltimetosceiflhecallsbouldbcmadc.
The phoM number may coraain abbreviations (e.g. mho py. boston) which get translated intodiaJ scqucnccsusingtbeL-dialcodesfile.
The L -de ,ice s file is scanned using dcvicetype and line speed fields from the L . .sys file to fim an available device for the call. The program wiD try aU devices whicb satisfy these fields until the caD is made, or no more devices can be tried. If a device is successfully opened, a lock file is created so that another copy of uuc;co will n<t try to use it. If the caD is complete, the login informatioo n the last field of L.sys is used to login.
The conversation between the two uucico programs begins with a handshake started by the SLAVE system. The SLAVE sends a message to let the MASTERkDow it isrcady to receive lhe system idellification and con\'Cl'Salion sequence mmber. The response from the MASTER is verified by the SLAVE and if acceptable. protocol selection begins. The SLAVE can also reply with i caU-back required message in which case.
the CUITent convcnationislmDinaled.
9.4.3 ScJectiDa LiDe Protocol The rcmOle system sends a message
Pproto-list
where proto-listisa suing of characters. each representing a line protocol.
The calling p:-ogram checks the protocol list for a letter corresponding to an available line protocol and rewms a use protocol message . The message has lhe form
Ucock
where cock is either a one character prttocolletter or "N" which means there is no COIDmOnprotocoi.
9.4.4 ProcessiDg Work
The initial role of MASTER orSLA VE forthe work processing i~ lhe mode in which each program starts. (The MASTER bas been specified by the - rl cption.) The MASTER program does a work search similar to the one used in the section "Scanning For Work"abovc.
9-7
There are five messages used during the work processing, each specified by the first characlerofthemessage. They are;
S Send a file R Receive a file C Copy complete X Execute armcpcommand
H Hangup
The MASTER wiD send R, S. or X messages until aD wort frma the spool directory is complete. at which point an II messaae is scrl. The Sl.A VE will reply with the first leuerofthe requesuDd either the Ietter"Y" or"N" for yes or no. f«example.lhe message' 'SY" indicates that it isobytoseuda file.
The send and receiw replies are based on permission to access the requested filddirectory usins the USERFIlE. and read/write permissioDl of the fileldirectwy.
After each file is copied into the spool directory of the receiving ~stem. a copy-complete message is sent by the receiVCl' of the file. The message "CY" wiD be scn& if the file bas successfuDy been moved from the temporary spool file to the actual destination. Otherwise. a "CN" message is scltt. (In the case of "CN", the transfmed file will be in the spool directory with a name beginning willa ·'TM' .) The
re~eSlsandresuhsareloggcdonbodlsystcms.
The hangup response is determined by the Sl.A VE program by a wort scan of the spool directory. If
wort
for the remote system exists in the Sl.A VEt s spool directOl)'. an"HN" message is scltt and the programs switch roiCl. If no wort exists. an ··H y., response is seltt.
9.4.5
TermlDatiDa.
CoaversatfoDWhen a "HY" messaae is received by the MASTER it is echoed back to the SL.A VE and the protocols are turned off. Each program sends a final "00" message to the <mer.
The original SLAVE propam will clean up and terminate. The MASTER wiD aroceed to call other systems and process