3.  Processing

      The user has two commands which set up communications, uucp to set up file copying, and uux to set up command execution where some of the required resources (system and/or files) are not on the local machine. Each of these commands will put work and data files into the spool directory for execution by uucp daemons. Figure 1 shows the major blocks of the file transfer process.

File Copy

      The uucico program is used to perform all communications between the two systems. It performs the following functions:

-
Scan the spool directory for work.
-
Place a call to a remote system.
-
Negotiate a line protocol to be used.
-
Start program uucico on the remote system.
-
Execute all requests from both systems.
-
Log work requests and work completions.

Uucico may be started in several ways;

a)
by a system daemon,
b)
by one of the uucp or uux programs,
c)
by a remote system.

Scan For Work

      The file names in the spool directory are constructed to allow the daemon programs (uucico, uuxqt) to determine the files they should look at, the remote machines they should call and the order in which the files for a particular remote machine should be processed.

Call Remote System

      The call is made using information from several files which reside in the uucp program directory. At the start of the call process, a lock is set on the system being called so that another call will not be attempted at the same time.

      The system name is found in a ``systems'' file. The information contained for each system is:

[1]
system name,
[2]
times to call the system (days-of-week and times-of-day),
[3]
device or device type to be used for call,
[4]
line speed,
[5]
phone number,
[6]
login information (multiple fields).

      The time field is checked against the present time to see if the call should be made. The phone number may contain abbreviations (e.g. ``nyc'', ``boston'') which get translated into dial sequences using a ``dial-codes'' file. This permits the same ``phone number'' to be stored at every site, despite local variations in telephone services and dialing conventions.

      A ``devices'' file is scanned using fields [3] and [4] from the ``systems'' file to find an available device for the connection. The program will try all devices which satisfy [3] and [4] until a connection is made, or no more devices can be tried. If a non-multiplexable device is successfully opened, a lock file is created so that another copy of uucico will not try to use it. If the connection is complete, the login information is used to log into the remote system. Then a command is sent to the remote system to start the uucico program. The conversation between the two uucico programs begins with a handshake started by the called, SLAVE, system. The SLAVE sends a message to let the MASTER know it is ready to receive the system identification and conversation sequence number. The response from the MASTER is verified by the SLAVE and if acceptable, protocol selection begins.

Line Protocol Selection

      The remote system sends a message

Pproto-list

where proto-list is a string of characters, each representing a line protocol. The calling program checks the proto-list for a letter corresponding to an available line protocol and returns a use-protocol message. The use-protocol message is

Ucode

where code is either a one character protocol letter or a N which means there is no common protocol.

      Greg Chesson designed and implemented the standard line protocol used by the uucp transmission program. Other protocols may be added by individual installations.

Work Processing

      During processing, one program is the MASTER and the other is SLAVE. Initially, the calling program is the MASTER. These roles may switch one or more times during the conversation.

      There are four messages used during the work processing, each specified by the first character of the message. They are

		       S   send a file,
		       R   receive a file,
		       C   copy complete,
		       H   hangup.

The MASTER will send R or S messages until all work from the spool directory is complete, at which point an H message will be sent. The SLAVE will reply with SY, SN, RY, RN, HY, HN, corresponding to yes or no for each request.

      The send and receive replies are based on permission to access the requested file/directory. After each file is copied into the spool directory of the receiving system, a copy-complete message is sent by the receiver of the file. The message CY will be sent if the UNIXcp command, used to copy from the spool directory, is successful. Otherwise, a CN message is sent. The requests and results are logged on both systems, and, if requested, mail is sent to the user reporting completion (or the user can request status information from the log program at any time).

      The hangup response is determined by the SLAVE program by a work scan of the spool directory. If work for the remote system exists in the SLAVE's spool directory, a HN message is sent and the programs switch roles. If no work exists, an HY response is sent.

      A sample conversation is shown in Figure 2.

Conversation Termination

      When a HY message is received by the MASTER it is echoed back to the SLAVE and the protocols are turned off. Each program sends a final "OO" message to the other.