Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

UUCP Internals Frequently Asked Questions
Section - UUCP Protocol

( Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Business Photos and Profiles ]


Top Document: UUCP Internals Frequently Asked Questions
Previous Document: Execution File Format
Next Document: UUCP `g' Protocol
See reader questions & answers on this topic! - Help others by sharing your knowledge
UUCP Protocol
=============

The UUCP protocol is a conversation between two UUCP packages.  A UUCP
conversation consists of three parts: an initial handshake, a series of
file transfer requests, and a final handshake.

The Initial Handshake
---------------------

Before the initial handshake, the caller will usually have logged in the
called machine and somehow started the UUCP package there.  On Unix this
is normally done by setting the shell of the login name used to
`/usr/lib/uucp/uucico'.

All messages in the initial handshake begin with a `^P' (a byte with
the octal value `\020') and end with a null byte (`\000').  A few
systems end these messages with a line feed character (`\012') instead
of a null byte; the examples below assume a null byte is being used.

Some options below are supported by QFT, which stands for Queued File
Transfer, and is (or was) an internal Bell Labs version of UUCP.

Taylor UUCP size negotiation was introduced by Taylor UUCP, and is also
supported by DOS based UUPlus and Amiga based wUUCP and UUCP-1.17.

The initial handshake goes as follows.  It is begun by the called
machine.

called: `\020Shere=hostname\000'
     The hostname is the UUCP name of the called machine.  Older UUCP
     packages do not output it, and simply send `\020Shere\000'.

caller: `\020Shostname options\000'
     The hostname is the UUCP name of the calling machine.  The
     following options may appear (or there may be none):

    `-QSEQ'
          Report sequence number for this conversation.  The sequence
          number is stored at both sites, and incremented after each
          call.  If there is a sequence number mismatch, something has
          gone wrong (somebody may have broken security by pretending
          to be one of the machines) and the call is denied.  If the
          sequence number changes on one of the machines, perhaps
          because of an attempted breakin or because a disk backup was
          restored, the sequence numbers on the two machines must be
          reconciled manually.

    `-xLEVEL'
          Requests the called system to set its debugging level to the
          specified value.  This is not supported by all systems.

    `-pGRADE'
    `-vgrade=GRADE'
          Requests the called system to only transfer files of the
          specified grade or higher.  This is not supported by all
          systems.  Some systems support `-p', some support `-vgrade='.
          UUPlus allows either `-p' or `-v' to be specified on a
          per-system basis in the `SYSTEMS' file (`gradechar' option).

    `-R'
          Indicates that the calling UUCP understands how to restart
          failed file transmissions.  Supported only by System V
          Release 4 UUCP, QFT, and Taylor UUCP.

    `-ULIMIT'
          Reports the ulimit value of the calling UUCP.  The limit is
          specified as a base 16 number in C notation (e.g.,
          `-U0x1000000').  This number is the number of 512 byte blocks
          in the largest file which the calling UUCP can create.  The
          called UUCP may not transfer a file larger than this.
          Supported only by System V Release 4 UUCP, QFT and UUPlus.
          UUPlus reports the lesser of the available disk space on the
          spool directory drive and the ulimit variable in
          `UUPLUS.CFG'.  Taylor UUCP understands this option, but does
          not generate it.

    `-N[NUMBER]'
          Indicates that the calling UUCP understands the Taylor UUCP
          size negotiation extension.  Not supported by traditional
          UUCP packages.  Supported by UUPlus.  The optional number is
          a bitmask of features supported by the calling UUCP, and is
          described below.

called: `\020ROK\000'
     There are actually several possible responses.
    `ROK'
          The calling UUCP is acceptable, and the handshake proceeds to
          the protocol negotiation.  Some options may also appear; see
          below.

    `ROKN[NUMBER]'
          The calling UUCP is acceptable, it specified `-N', and the
          called UUCP also understands the Taylor UUCP size limiting
          extensions.  The optional number is a bitmask of features
          supported by the called UUCP, and is described below.

    `RLCK'
          The called UUCP already has a lock for the calling UUCP,
          which normally indicates the two machines are already
          communicating.

    `RCB'
          The called UUCP will call back.  This may be used to avoid
          impostors (but only one machine out of each pair should call
          back, or no conversation will ever begin).

    `RBADSEQ'
          The call sequence number is wrong (see the `-Q' discussion
          above).

    `RLOGIN'
          The calling UUCP is using the wrong login name.

    `RYou are unknown to me'
          The calling UUCP is not known to the called UUCP, and the
          called UUCP does not permit connections from unknown systems.
          Some versions of UUCP just drop the line rather than sending
          this message.

     If the response is `ROK', the following options are supported by
     System V Release 4 UUCP and QFT.
    `-R'
          The called UUCP knows how to restart failed file
          transmissions.

    `-ULIMIT'
          Reports the ulimit value of the called UUCP.  The limit is
          specified as a base 16 number in C notation.  This number is
          the number of 512 byte blocks in the largest file which the
          called UUCP can create.  The calling UUCP may not send a file
          larger than this.  Also supported by UUPlus.  Taylor UUCP
          understands this option, but does not generate it.

    `-xLEVEL'
          I'm not sure just what this means.  It may request the
          calling UUCP to set its debugging level to the specified
          value.

     If the response is not `ROK' (or `ROKN') both sides hang up the
     phone, abandoning the call.

called: `\020Pprotocols\000'
     Note that the called UUCP outputs two strings in a row.  The
     protocols string is a list of UUCP protocols supported by the
     caller.  Each UUCP protocol has a single character name.  These
     protocols are discussed in more detail later in this document.
     For example, the called UUCP might send `\020Pgf\000'.

caller: `\020Uprotocol\000'
     The calling UUCP selects which protocol to use out of the protocols
     offered by the called UUCP.  If there are no mutually supported
     protocols, the calling UUCP sends `\020UN\000' and both sides hang
     up the phone.  Otherwise the calling UUCP sends something like
     `\020Ug\000'.

Most UUCP packages will consider each locally supported protocol in turn
and select the first one supported by the called UUCP.  With some
versions of HDB UUCP, this can be modified by giving a list of protocols
after the device name in the `Devices' file or the `Systems' file.  For
example, to select the `e' protocol in `Systems',
         airs Any ACU,e ...
or in Devices,
         ACU,e ttyXX ...
Taylor UUCP provides the `protocol' command which may be used either
for a system or a port.  UUPlus allows specification of the protocol
string on a per-system basis in the `SYSTEMS' file.

The optional number following a `-N' sent by the calling system, or an
`ROKN' sent by the called system, is a bitmask of features supported by
the UUCP package.  The optional number was introduced in Taylor UUCP
version 1.04.  The number is sent as an octal number with a leading
zero.  The following bits are currently defined.  A missing number
should be taken as `011'.

`01'
     UUCP supports size negotiation.

`02'
     UUCP supports file restart.

`04'
     UUCP supports the `E' command.

`010'
     UUCP requires the file size in the `S' and `R' commands to be in
     base 10.  This bit is used by default if no number appears, but
     should not be explicitly sent.

`020'
     UUCP expects a dummy string between the notify field and the size
     field in an `S' command.  This is true of SVR4 UUCP.  This bit
     should not be used.

After the protocol has been selected and the initial handshake has been
completed, both sides turn on the selected protocol.  For some protocols
(notably `g') a further handshake is done at this point.

UUCP Protocol Commands
----------------------

Each protocol supports a method for sending a command to the remote
system.  This method is used to transmit a series of commands between
the two UUCP packages.  At all times, one package is the master and the
other is the slave.  Initially, the calling UUCP is the master.

If a protocol error occurs during the exchange of commands, both sides
move immediately to the final handshake.

The master will send one of five commands: `S', `R', `X', `E', or `H'.

Any file name referred to below is either an absolute file name
beginning with `/', a public directory file name beginning with `~/', a
file name relative to a user's home directory beginning with `~USER/',
or a spool directory file name.  File names in the spool directory are
not absolute, but instead are converted to file names within the spool
directory by UUCP.  They always begin with `C.' (for a command file
created by `uucp' or `uux'), `D.' (for a data file created by `uucp',
`uux' or by an execution, or received from another system for an
execution), or `X.' (for an execution file created by `uux' or received
from another system).

The S Command
.............

master: `S FROM TO USER -OPTIONS TEMP MODE NOTIFY SIZE'
     The `S' and the `-' are literal characters.  This is a request by
     the master to send a file to the slave.

    FROM
          The name of the file to send.  If the `C' option does not
          appear in OPTIONS, the master will actually open and send
          this file.  Otherwise the file has been copied to the spool
          directory, where it is named TEMP.  The slave ignores this
          field unless TO is a directory, in which case the basename of
          FROM will be used as the file name.  If FROM is a spool
          directory filename, it must be a data file created for or by
          an execution, and must begin with `D.'.

    TO
          The name to give the file on the slave.  If this field names
          a directory the file is placed within that directory with the
          basename of FROM.  A name ending in `/' is taken to be a
          directory even if one does not already exist with that name.
          If TO begins with `X.', an execution file will be created on
          the slave.  Otherwise, if TO begins with `D.' it names a data
          file to be used by some execution file.  Otherwise, TO should
          not be in the spool directory.

    USER
          The name of the user who requested the transfer.

    OPTIONS
          A list of options to control the transfer.  The following
          options are defined (all options are single characters):
         `C'
               The file has been copied to the spool directory (the
               master should use TEMP rather than FROM).

         `c'
               The file has not been copied to the spool directory
               (this is the default).

         `d'
               The slave should create directories as necessary (this
               is the default).

         `f'
               The slave should not create directories if necessary,
               but should fail the transfer instead.

         `m'
               The master should send mail to USER when the transfer is
               complete.

         `n'
               The slave should send mail to NOTIFY when the transfer is
               complete.

    TEMP
          If the `C' option appears in OPTIONS, this names the file to
          be sent.  Otherwise if FROM is in the spool directory, TEMP
          is the same as FROM.  Otherwise TEMP may be a dummy string,
          such as `D.0'.  After the transfer has been succesfully
          completed, the master will delete the file TEMP.

    MODE
          This is an octal number giving the mode of the file on the
          master.  If the file is not in the spool directory, the slave
          will always create it with mode 0666, except that if (MODE &
          0111) is not zero (the file is executable), the slave will
          create the file with mode 0777.  If the file is in the spool
          directory, some UUCP packages will use the algorithm above
          and some will always create the file with mode 0600.  This
          field is ignored by UUPlus, since it is meaningless on DOS;
          UUPlus uses 0666 for outgoing files.

    NOTIFY
          This field may not be present, and in any case is only
          meaningful if the `n' option appears in OPTIONS.  If the `n'
          option appears, then, when the transfer is successfully
          completed, the slave will send mail to NOTIFY, which must be
          a legal mailing address on the slave.  If a SIZE field will
          appear but the `n' option does not appear, NOTIFY will always
          be present, typically as the string `dummy' or simply a pair
          of double quotes.

    SIZE
          This field is only present when doing Taylor UUCP or SVR4
          UUCP size negotiation.  It is the size of the file in bytes.
          Taylor UUCP version 1.03 sends the size as a decimal integer,
          while versions 1.04 and up, and all other UUCP packages that
          support size negotiation, send the size in base 16 with a
          leading 0x.

     The slave then responds with an `S' command response.

    `SY START'
          The slave is willing to accept the file, and file transfer
          begins.  The START field will only be present when using file
          restart.  It specifies the byte offset into the file at which
          to start sending.  If this is a new file, START will be 0x0.

    `SN2'
          The slave denies permission to transfer the file.  This can
          mean that the destination directory may not be accessed, or
          that no requests are permitted.  It implies that the file
          transfer will never succeed.

    `SN4'
          The slave is unable to create the necessary temporary file.
          This implies that the file transfer might succeed later.

    `SN6'
          This is only used by Taylor UUCP size negotiation.  It means
          that the slave considers the file too large to transfer at
          the moment, but it may be possible to transfer it at some
          other time.

    `SN7'
          This is only used by Taylor UUCP size negotiation.  It means
          that the slave considers the file too large to ever transfer.

    `SN8'
          This is only used by Taylor UUCP.  It means that the file was
          already received in a previous conversation.  This can happen
          if the receive acknowledgement was lost after it was sent by
          the receiver but before it was received by the sender.

    `SN9'
          This is only used by Taylor UUCP (versions 1.05 and up) and
          UUPlus (versions 2.0 and up).  It means that the remote
          system was unable to open another channel (see the discussion
          of the `i' protocol for more information about channels).
          This implies that the file transfer might succeed later.

    `SN10'
          This is reportedly used by SVR4 UUCP to mean that the file
          size is too large.

     If the slave responds with `SY', a file transfer begins.  When the
     file transfer is complete, the slave sends a `C' command response.

    `CY'
          The file transfer was successful.

    `CYM'
          The file transfer was successful, and the slave wishes to
          become the master; the master should send an `H' command,
          described below.

    `CN5'
          The temporary file could not be moved into the final
          location.  This implies that the file transfer will never
          succeed.

After the `C' command response has been received (in the `SY' case) or
immediately (in an `SN' case) the master will send another command.

The R Command
.............

master: `R FROM TO USER -OPTIONS SIZE'
     The `R' and the `-' are literal characters.  This is a request by
     the master to receive a file from the slave.  I do not know how
     SVR4 UUCP or QFT implement file transfer restart in this case.

    FROM
          This is the name of the file on the slave which the master
          wishes to receive.  It must not be in the spool directory,
          and it may not contain any wildcards.

    TO
          This is the name of the file to create on the master.  I do
          not believe that it can be a directory.  It may only be in
          the spool directory if this file is being requested to
          support an execution either on the master or on some system
          other than the slave.

    USER
          The name of the user who requested the transfer.

    OPTIONS
          A list of options to control the transfer.  The following
          options are defined (all options are single characters):
         `d'
               The master should create directories as necessary (this
               is the default).

         `f'
               The master should not create directories if necessary,
               but should fail the transfer instead.

         `m'
               The master should send mail to USER when the transfer is
               complete.

    SIZE
          This only appears if Taylor UUCP size negotiation is being
          used.  It specifies the largest file which the master is
          prepared to accept (when using SVR4 UUCP or QFT, this was
          specified in the `-U' option during the initial handshake).

     The slave then responds with an `R' command response.  UUPlus does
     not support `R' requests, and always responds with `RN2'.

    `RY MODE [SIZE]'
          The slave is willing to send the file, and file transfer
          begins.  The MODE argument is the octal mode of the file on
          the slave.  The master treats this just as the slave does the
          MODE argument in the send command, q.v.  I am told that SVR4
          UUCP sends a trailing SIZE argument.  For some versions of
          BSD UUCP, the MODE argument may have a trailing `M' character
          (e.g., `RY 0666M').  This means that the slave wishes to
          become the master.

    `RN2'
          The slave is not willing to send the file, either because it
          is not permitted or because the file does not exist.  This
          implies that the file request will never succeed.

    `RN6'
          This is only used by Taylor UUCP size negotiation.  It means
          that the file is too large to send, either because of the
          size limit specifies by the master or because the slave
          considers it too large.  The file transfer might succeed
          later, or it might not (this may be cleared up in a later
          release of Taylor UUCP).

    `RN9'
          This is only used by Taylor UUCP (versions 1.05 and up) and
          FSUUCP (versions 1.5 and up).  It means that the remote
          system was unable to open another channel (see the discussion
          of the `i' protocol for more information about channels).
          This implies that the file transfer might succeed later.

     If the slave responds with `RY', a file transfer begins.  When the
     file transfer is complete, the master sends a `C' command.  The
     slave pretty much ignores this, although it may log it.

    `CY'
          The file transfer was successful.

    `CN5'
          The temporary file could not be moved into the final location.

     After the `C' command response has been sent (in the `RY' case) or
     immediately (in an `RN' case) the master will send another command.

The X Command
.............

master: `X FROM TO USER -OPTIONS'
     The `X' and the `-' are literal characters.  This is a request by
     the master to, in essence, execute uucp on the slave.  The slave
     should execute `uucp FROM TO'.

    FROM
          This is the name of the file or files on the slave which the
          master wishes to transfer.  Any wildcards are expanded on the
          slave.  If the master is requesting that the files be
          transferred to itself, the request would normally contain
          wildcard characters, since otherwise an `R' command would
          suffice.  The master can also use this command to request
          that the slave transfer files to a third system.

    TO
          This is the name of the file or directory to which the files
          should be transferred.  This will normally use a UUCP name.
          For example, if the master wishes to receive the files
          itself, it would use `master!path'.

    USER
          The name of the user who requested the transfer.

    OPTIONS
          A list of options to control the transfer.  It is not clear
          which, if any, options are supported by most UUCP packages.

     The slave then responds with an `X' command response.  FSUUCP does
     not support `X' requests, and always responds with `XN'.

    `XY'
          The request was accepted, and the appropriate file transfer
          commands have been queued up for later processing.

    `XN'
          The request was denied.  No particular reason is given.

     In either case, the master will then send another command.

The E Command
.............

master: `E FROM TO USER -OPTIONS TEMP MODE NOTIFY SIZE COMMAND'
     The `E' command is only supported by Taylor UUCP 1.04 and up.  It
     is used to make an execution request without requiring a separate
     `X.*' file.  It is only used when the command to be executed
     requires a single input file which is passed to it as standard
     input.

     All the fields have the same meaning as they do for an `S' command,
     except for OPTIONS and COMMAND.

    OPTIONS
          A list of options to control the transfer.  The following
          options are defined (all options are single characters):
         `C'
               The file has been copied to the spool directory (the
               master should use TEMP rather than FROM).

         `c'
               The file has not been copied to the spool directory
               (this is the default).

         `N'
               No mail message should be sent, even if the command
               fails.  This is the equivalent of the `N' command in an
               `X.*' file.

         `Z'
               A mail message should be sent if the command fails (this
               is generally the default in any case).  This is the
               equivalent of the `Z' command in an `X.*' file.

         `R'
               Mail messages about the execution should be sent to the
               address in the NOTIFY field.  This is the equivalent of
               the `R' command in an `X.*' file.

         `e'
               The execution should be done with `/bin/sh'.  This is the
               equivalent of the `e' command in an `X.*' file.

    COMMAND
          The command which should be executed.  This is the equivalent
          of the `C' command in an `X.*' file.

     The slave then responds with an `E' command response.  These are
     the same as the `S' command responses, but the initial character is
     `E' rather than `S'.

     If the slave responds with `EY', the file transfer begins.  When
     the file transfer is complete, the slave sends a `C' command
     response, just as for the `S' command.  After a successful file
     transfer, the slave is responsible for arranging for the command
     to be executed.  The transferred file is passed as standard input,
     as though it were named in the `I' and `F' commands of an `X.*'
     file.

     After the `C' command response has been received (in the `EY'
     case) or immediately (in an `EN' case) the master will send another
     command.

The H Command
.............

master: `H'
     This is used by the master to hang up the connection.  The slave
     will respond with an `H' command response.

    `HY'
          The slave agrees to hang up the connection.  In this case the
          master sends another `HY' command.  In some UUCP packages the
          slave will then send a third `HY' command.  At this point the
          protocol is shut down, and the final handshake is begun.

    `HN'
          The slave does not agree to hang up.  In this case the master
          and the slave exchange roles.  The next command will be sent
          by the former slave, which is the new master.  The roles may
          be reversed several times during a single connection.

The Final Handshake
-------------------

After the protocol has been shut down, the final handshake is performed.
This handshake has no real purpose, and some UUCP packages simply drop
the connection rather than do it (in fact, some will drop the connection
immediately after both sides agree to hangup, without even closing down
the protocol).

caller: `\020OOOOOO\000'
called: `\020OOOOOOO\000'
That is, the calling UUCP sends six `O' characters and the called UUCP
replies with seven `O' characters.  Some UUCP packages always send six
`O' characters.

User Contributions:

Comment about this article, ask questions, or add new information about this topic:

CAPTCHA




Top Document: UUCP Internals Frequently Asked Questions
Previous Document: Execution File Format
Next Document: UUCP `g' Protocol

Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
ian@airs.com (Ian Lance Taylor)





Last Update March 27 2014 @ 02:12 PM