home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / answers / uucp-internals < prev    next >
Internet Message Format  |  1993-12-27  |  66KB

  1. Path: bloom-beacon.mit.edu!cambridge-news.cygnus.com!comton.airs.com!ian
  2. From: ian@airs.com (Ian Lance Taylor)
  3. Newsgroups: comp.mail.uucp,comp.answers,news.answers
  4. Subject: UUCP Internals Frequently Asked Questions
  5. Keywords: UUCP, protocol, FAQ
  6. Message-ID: <uucp-internals_756984601@airs.com>
  7. Date: 27 Dec 93 09:30:02 GMT
  8. Expires: 7 Feb 94 09:30:01 GMT
  9. Reply-To: ian@airs.com (Ian Lance Taylor)
  10. Followup-To: comp.mail.uucp
  11. Organization: Infinity Development, Waltham, MA
  12. Lines: 1420
  13. Approved: news-answers-request@MIT.Edu
  14. Supersedes: <uucp-internals_754565401@airs.com>
  15. Xref: bloom-beacon.mit.edu comp.mail.uucp:3039 comp.answers:3184 news.answers:13388
  16.  
  17. Archive-name: uucp-internals
  18. Version: $Revision: 1.21 $
  19. Last-modified: $Date: 1993/12/22 03:39:10 $
  20.  
  21.  This article was written by Ian Lance Taylor <ian@airs.com> and I may
  22.  even update it periodically.  Please send me mail about suggestions
  23.  or inaccuracies.
  24.  
  25.  This article describes how the various UUCP protocols work, and
  26.  discusses some other internal UUCP issues.  It does not describe how
  27.  to configure UUCP, nor how to solve UUCP connection problems, nor how
  28.  to deal with UUCP mail.  There are currently no FAQ postings on any
  29.  of these topics, and I do not plan to write any.
  30.  
  31.  If you haven't read the news.announce.newusers articles, read them.
  32.  
  33.  This article is in digest format.  Some newsreaders will be able to
  34.  break it apart into separate articles.  Please don't ask me how to do
  35.  this, though.
  36.  
  37.  This article answers the following questions.  If one of these
  38.  questions is posted to comp.mail.uucp, please send mail to the poster
  39.  referring her or him to this FAQ.  There is no reason to post a
  40.  followup, as most of us know the answer already.
  41.  
  42. Sources
  43. What does "alarm" mean in debugging output?
  44. What are UUCP grades?
  45. What is the format of a UUCP lock file?
  46. What is the format of a UUCP X.* file?
  47. What is the UUCP protocol?
  48. What is the 'g' protocol?
  49. What is the 'f' protocol?
  50. What is the 't' protocol?
  51. What is the 'e' protocol?
  52. What is the 'G' protocol?
  53. What is the 'i' protocol?
  54. What is the 'x' protocol?
  55. What is the 'd' protocol?
  56. What is the 'h' protocol?
  57. What is the 'v' protocol?
  58. Thanks
  59.  
  60. ----------------------------------------------------------------------
  61.  
  62. From: Sources
  63. Subject: Sources
  64.  
  65. I took a lot of the information from Jamie E. Hanrahan's paper in the
  66. Fall 1990 DECUS Symposium, and from Managing UUCP and Usenet by Tim
  67. O'Reilly and Grace Todino (with contributions by several other
  68. people).  The latter includes most of the former, and is published by
  69.         O'Reilly & Associates, Inc.
  70.         103 Morris Street, Suite A
  71.         Sebastopol, CA 95472
  72. It is currently in its tenth edition.  The ISBN number is
  73. 0-937175-93-5.
  74.  
  75. Some information is originally due to a Usenet article by Chuck
  76. Wegrzyn.  The information on execution files comes partially from
  77. Peter Honeyman.  The information on the 'g' protocol comes partially
  78. from a paper by G.L. Chesson of Bell Laboratories, partially from
  79. Jamie E. Hanrahan's paper, and partially from source code by John
  80. Gilmore.  The information on the 'f' protocol comes from the source
  81. code by Piet Berteema.  The information on the 't' protocol comes from
  82. the source code by Rick Adams.  The information on the 'e' protocol
  83. comes from a Usenet article by Matthias Urlichs.  The information on
  84. the 'd' protocol comes from Jonathan Clark, who also supplied
  85. information about QFT.  The FSUUCP information comes straight from
  86. Christopher J. Ambler; it applies to version 1.4 and up.
  87.  
  88. Although there are few books about UUCP, there are many about networks
  89. and protocols in general.  I recommend two non-technical books which
  90. describe the sorts of things that are available on the network: ``The
  91. Whole Internet,'' by Ed Krol, and ``Zen and the Art of the Internet,''
  92. by Brendan P. Kehoe.  Good technical discussions of networking issues
  93. can be found in ``Internetworking with TCP/IP,'' by Douglas E. Comer
  94. and David L. Stevens and in ``Design and Validation of Computer
  95. Protocols'' by Gerard J. Holzmann.
  96.  
  97. ------------------------------
  98.  
  99. From: alarm
  100. Subject: What does "alarm" mean in debugging output?
  101.  
  102. The debugging output of many versions of UUCP (but not Taylor UUCP)
  103. will include messages like
  104.     alarm 1
  105. or
  106.     pkcget: alarm 1
  107.  
  108. This message means that the UUCP package has timed out while waiting
  109. for some sort of response from the remote system.  This normally
  110. indicates some sort of connection problem.  For example, the modems
  111. might have lost their connection, or perhaps one of the modems will
  112. not transmit the XON and XOFF characters, or perhaps one side or the
  113. other is dropping characters.  It can also mean that the packages
  114. disagree about some aspect of the UUCP protocol, although this is less
  115. common.
  116.  
  117. Using the information in the rest of this posting, you should be able
  118. to figure out what type of data your UUCP was expecting to receive.
  119. This may give some indication as to exactly what the problem is.  It
  120. is difficult to be more specific, since there are many possiblities.
  121.  
  122. ------------------------------
  123.  
  124. From: UUCP-grades
  125. Subject: What are UUCP grades?
  126.  
  127. Modern UUCP packages support grades for each command.  The grades
  128. generally range from 'A' (the highest) to 'Z' followed by 'a' to 'z'.
  129. Some UUCP packages also support '0' to '9' before 'A'.  Some UUCP
  130. packages may permit any ASCII character as a grade.
  131.  
  132. On Unix, these grades are encoded in the name of the command file.  A
  133. command file name generally has the form
  134.     C.nnnngssss
  135. where nnnn is the remote system name for which the command is queued,
  136. g is a single character grade, and ssss is a four character sequence
  137. number.  For example, a command file created for the system ``airs''
  138. at grade 'Z' might be named
  139.     C.airsZ2551
  140.  
  141. The remote system name will be truncated to seven characters, to
  142. ensure that the command file name will fit in the 14 character file
  143. name limit of the traditional Unix file system.  UUCP packages which
  144. have no other means of distinguishing which command files are intended
  145. for which systems thus require all systems they connect to to have
  146. names that are unique in the first seven characters.  Some UUCP
  147. packages use a variant of this format which truncates the system name
  148. to six characters.  HDB and Taylor UUCP use a different spool
  149. directory format, which allows up to fourteen characters to be used
  150. for each system name.
  151.  
  152. The sequence number in the command file name may be a decimal integer,
  153. or it may be a hexadecimal integer, or it may contain any alphanumeric
  154. character.  Different UUCP packages are different.
  155.  
  156. FSUUCP (a DOS based UUCP and news package) uses up to 8 characters for
  157. file names in the spool (this is a DOS file name limitation; actually,
  158. with the extension, 11 characters are available, but FSUUCP reserves
  159. that for future use).  FSUUCP defaults mail to grade D, and news to
  160. grade N, except that when the grade of incoming mail can be
  161. determined, that grade is preserved if the mail is forwarded to
  162. another system.  Mail and news are currently the only 2 types of
  163. transfers supported.  The default grades may be changed by editing
  164. the MAIL.RC file for mail, or the FSUUCP.CFG file for news.
  165.  
  166. UUPC/extended for DOS, OS/2 and Windows NT handles mail at grade 'C',
  167. news at grade 'd', and file transfers at grade 'n'.  The UUPC/extended
  168. UUCP command accepts grades to override the default, the others do
  169. not.
  170.  
  171. I do not know how command grades are handled in other non-Unix UUCP
  172. packages.
  173.  
  174. Modern UUCP packages allow you to restrict file transfer by grade
  175. depending on the time of day.  Typically this is done with a line in
  176. the Systems (or L.sys) file like this:
  177.     airs Any/Z,Any2305-0855 ...
  178. This allows grades 'Z' and above to be transferred at any time.  Lower
  179. grades may only be transferred at night.  I believe that this grade
  180. restriction applies to local commands as well as to remote commands,
  181. but I am not sure.  It may only apply if the UUCP package places the
  182. call, not if it is called by the remote system.
  183.  
  184. Taylor UUCP can use the ``timegrade'' and ``call-timegrade'' commands
  185. to achieve the same effect (and supports the above format when reading
  186. Systems or L.sys).
  187.  
  188. UUPC/extended provides the symmetricgrades option to announce the
  189. current grade in effect when calling the remote system.
  190.  
  191. This sort of grade restriction is most useful if you know what grades
  192. are being used at the remote site.  The default grades used depend on
  193. the UUCP package.  Generally uucp and uux have different defaults.  A
  194. particular grade can be specified with the -g option to uucp or uux.
  195. For example, to request execution of rnews on airs with grade 'd', you
  196. might use something like
  197.     uux -gd - airs!rnews <article
  198.  
  199. Uunet queues up mail at grade 'C', but increases the grade based on
  200. the size.  News is queued at grade 'd', and file transfers at grade
  201. 'n'.  The example above would allow mail (below some large size) to be
  202. received at any time, but would only permit news to be transferred at
  203. night.
  204.  
  205. ------------------------------
  206.  
  207. From: UUCP-lock-file
  208. Subject: What is the format of a UUCP lock file?
  209.  
  210. This discussion applies only to Unix.  I have no idea how UUCP locks
  211. ports on other systems.
  212.  
  213. UUCP creates files to lock serial ports and systems.  On most if not
  214. all systems these same lock files are also used by cu to coordinate
  215. access to serial ports.  On some systems getty also uses these lock
  216. files, often under the name uugetty.
  217.  
  218. The lock file normally contains the process ID of the locking process.
  219. This makes it easy to determine whether a lock is still valid.  The
  220. algorithm is to create a temporary file and then link it to the name
  221. that must be locked.  If the link fails because a file with that name
  222. already exists, the existing file is read to get the process ID.  If
  223. the process still exists, the lock attempt fails.  Otherwise the lock
  224. file is deleted and the locking algorithm is retried.
  225.  
  226. Older UUCP packages put the lock files in the main UUCP spool
  227. directory, /usr/spool/uucp.  HDB UUCP generally puts the lock files in
  228. a directory of their own, usually /usr/spool/locks or /etc/locks.
  229.  
  230. The original UUCP lock file format encodes the process ID as a four
  231. byte binary number.  The order of the bytes is host-dependent.  HDB
  232. UUCP stores the process ID as a ten byte ASCII decimal number, with a
  233. trailing newline.  For example, if process 1570 holds a lock file, it
  234. would contain the eleven characters space, space, space, space, space,
  235. space, one, five, seven, zero, newline.  Some versions of UUCP add a
  236. second line indicating which program created the lock (uucp, cu, or
  237. getty/uugetty).  I have also seen a third type of UUCP lock file which
  238. does not contain the process ID at all.
  239.  
  240. The name of the lock file is traditionally "LCK.." followed by the
  241. base name of the device.  For example, to lock /dev/ttyd0 the file
  242. LCK..ttyd0 would be created.  On SCO Unix, the lock file name is
  243. always forced to lower case even if the device name has upper case
  244. letters.
  245.  
  246. System V Release 4 UUCP names the lock file using the major and minor
  247. device numbers rather than the device name.  The file is named
  248. LK.XXX.YYY.ZZZ, where XXX, YYY and ZZZ are all three digit decimal
  249. numbers.  XXX is the major device number of the device holding the
  250. directory holding the device file (e.g., /dev).  YYY is the major
  251. device number of the device file itself.  ZZZ is the minor device
  252. number of the device file itself.  If s holds the result of passing
  253. the device to the stat system call (e.g., stat ("/dev/ttyd0", &s)),
  254. the following line of C code will print out the corresponding lock
  255. file name:
  256.     printf ("LK.%03d.%03d.%03d", major (s.st_dev),
  257.             major (s.st_rdev), minor (s.st_rdev));
  258. The advantage of this system is that even if there are several links
  259. to the same device, they will all use the same lock file name.
  260.  
  261. ------------------------------
  262.  
  263. From: X-file
  264. Subject: What is the format of a UUCP X.* file?
  265.  
  266. UUCP X.* files control program execution.  They are created by uux.
  267. They are transferred between computers just like any other file.  The
  268. uuxqt daemon reads them to figure out how to execute the job requested
  269. by uux.
  270.  
  271. An X.* file is simply a text file.  The first character of each line
  272. is a command, and the remainder of the line supplies arguments.  The
  273. following commands are defined:
  274.     C command
  275.         This gives the command to execute, including the program and
  276.         all arguments.  For example,
  277.             C rmail ian@airs.com
  278.     U user system
  279.         This names the user who requested the command, and the system
  280.         from which the request came.
  281.     I standard-input
  282.         This names the file from which standard input is taken.  If no
  283.         standard input file is given, the standard input will probably
  284.         be attached to /dev/null.  If the standard input file is not
  285.         from the system on which the execution is to occur, it will
  286.         also appear in an F command.
  287.     O standard-output [ system ]
  288.         This names the standard output file.  The optional second
  289.         argument names the system to which the file should be sent.
  290.         If there is no second argument, the file should be created on
  291.         the executing system.
  292.     F required-file [ filename-to-use ]
  293.         The F command can appear multiple times.  Each F command names
  294.         a file which must exist before the execution can proceed.
  295.         This will usually be a file which is transferred from the
  296.         system on which uux was executed, but it can also be a file
  297.         from the local system or some other system.  If the file is
  298.         not from the local system, then the command will usually name
  299.         a file in the spool directory.  If the optional second
  300.         argument appears, then the file should be copied to the
  301.         execution directory under that name.  This is necessary for
  302.         any file other than the standard input file.  If the standard
  303.         input file is not from the local system, it will appear in
  304.         both an F command and an I command.
  305.     R requestor-address
  306.         This is the address to which mail about the job should be
  307.         sent.  It is relative to the system named in the U command.
  308.         If the R command does not appear, then mail is sent to the
  309.         user named in the U command.
  310.     Z
  311.         This command takes no arguments.  It means that a mail message
  312.         should be sent if the command failed.  This is the default
  313.         behaviour for most modern UUCP packages, and for them the Z
  314.         command does not actually do anything.
  315.     N
  316.         This command takes no arguments.  It means that no mail
  317.         message should be sent, even if the command failed.
  318.     n
  319.         This command takes no arguments.  It means that a mail message
  320.         should be sent if the command succeeded.  Normally a message
  321.         is sent only if the command failed.
  322.     B
  323.         This command takes no arguments.  It means that the standard
  324.         input should be returned with any error message.  This can be
  325.         useful in cases where the input would otherwise be lost.
  326.     e
  327.         This command takes no arguments.  It means that the command
  328.         should be processed with /bin/sh.  For some packages this is
  329.         the default anyhow.  Most packages will refuse to execute
  330.         complex commands or commands containing wildcards, because of
  331.         the security holes this opens.
  332.     E
  333.         This command takes no arguments.  It means that the command
  334.         should be processed with the execve system call.  For some
  335.         packages this is the default anyhow.
  336.     M status-file
  337.         This command means that instead of mailing a message, the
  338.         message should be copied to the named file on the system named
  339.         by the U command.
  340.     # comment
  341.         This command is ignored, as is any other unrecognized command.  
  342.  
  343. Here is an example.  Given the following command executed on system
  344. test1
  345.     uux - test2!cat - test2!~ian/bar !qux '>~/gorp'
  346. (this is only an example, as most UUCP systems will not permit the cat
  347. command to be executed) Taylor UUCP will produce the following X.
  348. file:
  349.     U ian test1
  350.     F D.test1N003r qux
  351.     O /usr/spool/uucppublic test1
  352.     F D.test1N003s
  353.     I D.test1N003s
  354.     C cat - ~ian/bar qux
  355. The standard input will be read into a file and then transferred to
  356. the file D.test1N003s on system test2, and the file qux will be
  357. transferred to D.test1N003r on system test2.  When the command is
  358. executed, the latter file will be copied to the execution directory
  359. under the name qux.  Note that since the file ~ian/bar is already on
  360. the execution system, no action need be taken for it.  The standard
  361. output will be collected in a file, then copied to the directory
  362. /usr/spool/uucppublic on the system test1.
  363.  
  364. ------------------------------
  365.  
  366. From: UUCP-protocol
  367. Subject: What is the UUCP protocol?
  368.  
  369. The UUCP protocol is a conversation between two UUCP packages.  A UUCP
  370. conversation consists of three parts: an initial handshake, a series
  371. of file transfer requests, and a final handshake.
  372.  
  373. Before the initial handshake, the caller will usually have logged in
  374. the called machine and somehow started the UUCP package there.  On
  375. Unix this is normally done by setting the shell of the login name used
  376. to /usr/lib/uucp/uucico.
  377.  
  378. All messages in the initial handshake begin with a ^P (a byte with the
  379. octal value \020) and end with a null byte (\000).  A few systems end
  380. these messages with a line feed character (\012) instead of a null
  381. byte; the examples below assume a null byte is being used.
  382.  
  383. Some options below are supported by QFT, which stands for Queued File
  384. Transfer, and is (or was) an internal Bell Labs version of UUCP.  Some
  385. are supported by FSUUCP, which is a DOS based UUCP and news package.
  386.  
  387. The initial handshake goes as follows.  It is begun by the called
  388. machine.
  389.  
  390. called: \020Shere=hostname\000
  391.     The hostname is the UUCP name of the called machine.  Older UUCP
  392.     packages do not output it, and simply send \020Shere\000.
  393.  
  394. caller: \020Shostname options\000
  395.     The hostname is the UUCP name of the calling machine.  The
  396.     following options may appear (or there may be none):
  397.         -QSEQ
  398.             Report sequence number for this conversation.  The
  399.             sequence number is stored at both sites, and incremented
  400.             after each call.  If there is a sequence number mismatch,
  401.             something has gone wrong (somebody may have broken
  402.             security by pretending to be one of the machines) and the
  403.             call is denied.  If the sequence number changes on one of
  404.             the machines, perhaps because of an attempted breakin or
  405.             because a disk backup was restored, the sequence numbers
  406.             on the two machines must be reconciled manually.  This is
  407.             not supported by FSUUCP.
  408.         -xLEVEL
  409.             Requests the called system to set its debugging level to
  410.             the specified value.  This is not supported by all
  411.             systems.
  412.         -pGRADE
  413.         -vgrade=GRADE
  414.             Requests the called system to only transfer files of the
  415.             specified grade or higher.  This is not supported by all
  416.             systems.  Some systems support -p, some support -vgrade=.
  417.         -R
  418.             Indicates that the calling UUCP understands how to restart
  419.             failed file transmissions.  Supported only by System V
  420.             Release 4 UUCP and QFT.
  421.         -ULIMIT
  422.             Reports the ulimit value of the calling UUCP.  The limit
  423.             is specified as a base 16 number in C notation (e.g.,
  424.             -U0x1000000).  This number is the number of 512 byte
  425.             blocks in the largest file which the calling UUCP can
  426.             create.  The called UUCP may not transfer a file larger
  427.             than this.  Supported only by System V Release 4 UUCP, QFT
  428.             and FSUUCP.  FSUUCP reports the lesser of the
  429.             available disk space on the spool directory drive and the
  430.             ulimit variable in FSUUCP.CFG.
  431.         -N
  432.             Indicates that the calling UUCP understands the Taylor
  433.             UUCP size limiting extensions.  Supported only by Taylor
  434.             UUCP and FSUUCP.
  435.  
  436. called: \020ROK\000
  437.     There are actually several possible responses.
  438.         ROK
  439.             The calling UUCP is acceptable, and the handshake proceeds
  440.             to the protocol negotiation.  Some options may also
  441.             appear; see below.
  442.         ROKN
  443.             The calling UUCP is acceptable, it specified -N, and the
  444.             called UUCP also understands the Taylor UUCP size limiting
  445.             extensions.  Supported only by Taylor UUCP and FSUUCP.
  446.         RLCK
  447.             The called UUCP already has a lock for the calling UUCP,
  448.             which normally indicates the two machines are already
  449.             communicating.
  450.         RCB
  451.             The called UUCP will call back.  This may be used to avoid
  452.             impostors (but only one machine out of each pair should
  453.             call back, or no conversation will ever begin).
  454.         RBADSEQ
  455.             The call sequence number is wrong (see the -Q discussion
  456.             above). 
  457.         RLOGIN
  458.             The calling UUCP is using the wrong login name.
  459.         RYou are unknown to me
  460.             The calling UUCP is not known to the called UUCP, and the
  461.             called UUCP does not permit connections from unknown
  462.             systems.  Some versions of UUCP just drop the line rather
  463.             than sending this message.
  464.  
  465.     If the response is ROK, the following options are supported by
  466.     System V Release 4 UUCP and QFT.
  467.         -R
  468.             The called UUCP knows how to restart failed file
  469.             transmissions.
  470.         -ULIMIT
  471.             Reports the ulimit value of the called UUCP.  The limit is
  472.             specified as a base 16 number in C notation.  This number
  473.             is the number of 512 byte blocks in the largest file which
  474.             the called UUCP can create.  The calling UUCP may not send
  475.             a file larger than this.  Also supported by FSUUCP.
  476.         -xLEVEL
  477.             I'm not sure just what this means.  It may request the
  478.             calling UUCP to set its debugging level to the specified
  479.             value.
  480.     If the response is not ROK (or ROKN) both sides hang up the phone,
  481.     abandoning the call.
  482.  
  483. called: \020Pprotocols\000
  484.     Note that the called UUCP outputs two strings in a row.  The
  485.     protocols string is a list of UUCP protocols supported by the
  486.     caller.  Each UUCP protocol has a single character name.  These
  487.     protocols are discussed in more detail later in this document.
  488.     For example, the called UUCP might send \020Pgf\000.
  489.  
  490. caller: \020Uprotocol\000
  491.     The calling UUCP selects which protocol to use out of the
  492.     protocols offered by the called UUCP.  If there are no mutually
  493.     supported protocols, the calling UUCP sends \020UN\000 and both
  494.     sides hang up the phone.  Otherwise the calling UUCP sends
  495.     something like \020Ug\000.
  496.  
  497. Most UUCP packages will consider each locally supported protocol in
  498. turn and select the first one supported by the called UUCP.  With some
  499. versions of HDB UUCP, this can be modified by giving a list of
  500. protocols after the device name in the Devices file or the Systems
  501. file.  For example, to select the 'e' protocol in Systems,
  502.     airs Any ACU,e ...
  503. or in Devices,
  504.     ACU,e ttyXX ...
  505. Taylor UUCP provides the ``protocol'' command which may be used either
  506. for a system or a port.
  507.  
  508. After the protocol has been selected and the initial handshake has been
  509. completed, both sides turn on the selected protocol.  For some
  510. protocols (notably 'g') a further handshake is done at this point.
  511.  
  512. Each protocol supports a method for sending a command to the remote
  513. system.  This method is used to transmit a series of commands between
  514. the two UUCP packages.  At all times, one package is the master and
  515. the other is the slave.  Initially, the calling UUCP is the master.
  516.  
  517. If a protocol error occurs during the exchange of commands, both sides
  518. move immediately to the final handshake.
  519.  
  520. The master will send one of four commands: S, R, X or H.
  521.  
  522. Any file name referred to below is either an absolute pathname
  523. beginning with "/", a public directory pathname beginning with "~/", a
  524. pathname relative to a user's home directory beginning with "~USER/",
  525. or a spool directory file name.  File names in the spool directory are
  526. not pathnames, but instead are converted to pathnames within the spool
  527. directory by UUCP.  They always begin with "C." (for a command file
  528. created by uucp or uux), "D." (for a data file created by uucp, uux or
  529. by an execution, or received from another system for an execution), or
  530. "X." (for an execution file created by uux or received from another
  531. system).
  532.  
  533. master: S FROM TO USER -OPTIONS TEMP MODE NOTIFY SIZE
  534.     The S and the - are literal characters.  This is a request by the
  535.     master to send a file to the slave.
  536.         FROM
  537.             The name of the file to send.  If the C option does not
  538.             appear in OPTIONS, the master will actually open and send
  539.             this file.  Otherwise the file has been copied to the
  540.             spool directory, where it is named TEMP.  The slave
  541.             ignores this field unless TO is a directory, in which case
  542.             the basename of FROM will be used as the file name.  If
  543.             FROM is a spool directory filename, it must be a data file
  544.             created for or by an execution, and must begin with "D.".
  545.         TO
  546.             The name to give the file on the slave.  If this field
  547.             names a directory the file is placed within that directory
  548.             with the basename of FROM.  A name ending in `/' is taken
  549.             to be a directory even if one does not already exist with
  550.             that name.  If TO begins with `X.', an execution file will
  551.             be created on the slave.  Otherwise, if TO begins with
  552.             `D.' it names a data file to be used by some execution
  553.             file.  Otherwise, TO should not be in the spool directory.
  554.         USER
  555.             The name of the user who requested the transfer.
  556.         OPTIONS
  557.             A list of options to control the transfer.  The following
  558.             options are defined (all options are single characters):
  559.                 C
  560.                     The file has been copied to the spool directory
  561.                     (the master should use TEMP rather than FROM).
  562.                 c
  563.                     The file has not been copied to the spool
  564.                     directory (this is the default).
  565.                 d
  566.                     The slave should create directories as necessary
  567.                     (this is the default).
  568.                 f
  569.                     The slave should not create directories if
  570.                     necessary, but should fail the transfer instead.
  571.                 m
  572.                     The master should send mail to USER when the
  573.                     transfer is complete (not supported by FSUUCP).
  574.                 n
  575.                     The slave should send mail to NOTIFY when the
  576.                     transfer is complete (not supported by FSUUCP).
  577.         TEMP
  578.             If the C option appears in OPTIONS, this names the file to
  579.             be sent.  Otherwise if FROM is in the spool directory,
  580.             TEMP is the same as FROM.  Otherwise TEMP may be a dummy
  581.             string, such as "D.0".  After the transfer has been
  582.             succesfully completed, the master will delete the file
  583.             TEMP.
  584.         MODE
  585.             This is an octal number giving the mode of the file on
  586.             MASTER.  If the file is not in the spool directory, the
  587.             slave will always create it with mode 0666, except that if
  588.             (MODE & 0111) is not zero (the file is executable), the
  589.             slave will create the file with mode 0777.  If the file is
  590.             in the spool directory, some UUCP packages will use the
  591.             algorithm above and some will always create the file with
  592.             mode 0600.  This field is not used by FSUUCP, since it is
  593.             meaningless on DOS.
  594.         NOTIFY
  595.             This field may not be present, and in any case is only
  596.             meaningful if the n option appears in OPTIONS.  If the n
  597.             option appears, then when the transfer is successfully
  598.             completed, the slave will send mail to NOTIFY, which must
  599.             be a legal mailing address on the slave.  If a SIZE field
  600.             will appear but the n option does not appear, NOTIFY will
  601.             always be present, typically as the string "dummy" or
  602.             simply a pair of double quotes.
  603.         SIZE
  604.             This field is only present when doing size negotiation,
  605.             with Taylor UUCP, SVR4 UUCP, QFT or FSUUCP.  It is the
  606.             size of the file in bytes.  SVR4 UUCP, QFT and FSUUCP send
  607.             the size in base 16 as 0x.... while Taylor UUCP sends the
  608.             size as a decimal integer (a later version of Taylor UUCP
  609.             will probably change to the SVR4 behaviour).
  610.  
  611.     The slave then responds with an S command response.
  612.         SY START
  613.             The slave is willing to accept the file, and file transfer
  614.             begins.  The START field will only be present when using
  615.             file restart.  It specifies the byte offset into the file
  616.             at which to start sending.  If this is a new file, START
  617.             will be 0x0.
  618.         SN2
  619.             The slave denies permission to transfer the file.  This
  620.             can mean that the destination directory may not be
  621.             accessed, or that no requests are permitted.  It implies
  622.             that the file transfer will never succeed.
  623.         SN4
  624.             The slave is unable to create the necessary temporary
  625.             file.  This implies that the file transfer might succeed
  626.             later.
  627.         SN6
  628.             This is only used by Taylor UUCP and FSUUCP size
  629.             negotiation.  It means that the slave considers the file
  630.             too large to transfer at the moment, but it may be
  631.             possible to transfer it at some other time.
  632.         SN7
  633.             This is only used by Taylor UUCP and FSUUCP size
  634.             negotiation.  It means that the slave considers the file
  635.             too large to ever transfer.
  636.         SN8
  637.             This is only used by Taylor UUCP.  It means that the file
  638.             was already received in a previous conversation.  This can
  639.             happen if the receive acknowledgement was lost after it
  640.             was sent by the receiver but before it was received by the
  641.             sender.
  642.     SN9
  643.         This is only used by Taylor UUCP (versions 1.05 and up)
  644.         and FSUUCP (versions 1.5 and up).  It means that the
  645.         remote system was unable to open another channel (see the
  646.         discussion of the 'i' protocol for more information about
  647.         channels).  This implies that the file transfer might
  648.         succeed later.
  649.  
  650.     If the slave responds with SY, a file transfer begins.  When the
  651.     file transfer is complete, the slave sends a C command response.
  652.         CY
  653.             The file transfer was successful.
  654.         CYM
  655.             The file transfer was successful, and the slave wishes to
  656.             become the master; the master should send an H command,
  657.             described below.
  658.         CN5
  659.             The temporary file could not be moved into the final
  660.             location.  This implies that the file transfer will never
  661.             succeed.
  662.  
  663.     After the C command response has been received (in the SY case) or
  664.     immediately (in an SN case) the master will send another command.
  665.  
  666. master: R FROM TO USER -OPTIONS SIZE
  667.     The R and the - are literal characters.  This is a request by the
  668.     master to receive a file from the slave.  I do not know how SVR4
  669.     UUCP or QFT implement file transfer restart in this case.
  670.         FROM
  671.             This is the name of the file on the slave which the master
  672.             wishes to receive.  It must not be in the spool directory,
  673.             and it may not contain any wildcards.
  674.         TO
  675.             This is the name of the file to create on the master.  I
  676.             do not believe that it can be a directory.  It may only be
  677.             in the spool directory if this file is being requested to
  678.             support an execution either on the master or on some
  679.             system other than the slave.
  680.         USER
  681.             The name of the user who requested the transfer.
  682.         OPTIONS
  683.             A list of options to control the transfer.  The following
  684.             options are defined (all options are single characters):
  685.                 d
  686.                     The master should create directories as necessary
  687.                     (this is the default).
  688.                 f
  689.                     The master should not create directories if
  690.                     necessary, but should fail the transfer instead.
  691.                 m
  692.                     The master should send mail to USER when the
  693.                     transfer is complete.
  694.         SIZE
  695.             This only appears if Taylor UUCP or FSUUCP size
  696.             negotiation is being used.  It specifies the largest file
  697.             which the master is prepared to accept (when using SVR4
  698.             UUCP or QFT, this was specified in the -U option during
  699.             the initial handshake).
  700.  
  701.     The slave then responds with an R command response.  FSUUCP does
  702.     not support R requests, and always responds with RN2.
  703.         RY MODE [ SIZE ]
  704.             The slave is willing to send the file, and file transfer
  705.             begins.  MODE is the octal mode of the file on the slave.
  706.             The master treats this just as the slave does the MODE
  707.             argument in the send command, q.v.  I am told that SVR4
  708.             UUCP sends a trailing SIZE argument.  For some versions of
  709.             BSD UUCP, the MODE argument may have a trailing M
  710.             character (e.g., RY 0666M).  This means that the slave
  711.             wishes to become the master.
  712.         RN2
  713.             The slave is not willing to send the file, either because
  714.             it is not permitted or because the file does not exist.
  715.             This implies that the file request will never succeed.
  716.         RN6
  717.             This is only used by Taylor UUCP size negotiation.  It
  718.             means that the file is too large to send, either because
  719.             of the size limit specifies by the master or because the
  720.             slave considers it too large.  The file transfer might
  721.             succeed later, or it might not (this will be cleared up in
  722.             a later release of Taylor UUCP).
  723.     RN9
  724.         This is only used by Taylor UUCP (versions 1.05 and up)
  725.         and FSUUCP (versions 1.5 and up).  It means that the
  726.         remote system was unable to open another channel (see the
  727.         discussion of the 'i' protocol for more information about
  728.         channels).  This implies that the file transfer might
  729.         succeed later.
  730.  
  731.     If the slave responds with RY, a file transfer begins.  When the
  732.     file transfer is complete, the master sends a C command.  The
  733.     slave pretty much ignores this, although it may log it.
  734.         CY
  735.             The file transfer was successful.
  736.         CN5
  737.             The temporary file could not be moved into the final
  738.             location.
  739.  
  740.     After the C command response has been sent (in the RY case) or
  741.     immediately (in an RN case) the master will send another command.
  742.  
  743. master: X FROM TO USER -OPTIONS
  744.     The X and the - are literal characters.  This is a request by the
  745.     master to, in essence, execute uucp on the slave.  The slave
  746.     should execute "uucp FROM TO".
  747.         FROM
  748.             This is the name of the file or files on the slave which
  749.             the master wishes to transfer.  Any wildcards are expanded
  750.             on the slave.  If the master is requesting that the files
  751.             be transferred to itself, the request would normally
  752.             contain wildcard characters, since otherwise an `R'
  753.             command would suffice.  The master can also use this
  754.             command to request that the slave transfer files to a
  755.             third system.
  756.         TO
  757.             This is the name of the file or directory to which the
  758.             files should be transferred.  This will normally use a
  759.             UUCP name.  For example, if the master wishes to receive
  760.             the files itself, it would use "master!path".
  761.         USER
  762.             The name of the user who requested the transfer.
  763.         OPTIONS
  764.             A list of options to control the transfer.  It is not
  765.             clear which, if any, options are supported by most UUCP
  766.             packages.
  767.  
  768.     The slave then responds with an X command response.  FSUUCP does
  769.     not support X requests, and always responds with XN.
  770.         XY
  771.             The request was accepted, and the appropriate file
  772.             transfer commands have been queued up for later
  773.             processing.
  774.         XN
  775.             The request was denied.  No particular reason is given.
  776.  
  777.     In either case, the master will then send another command.
  778.  
  779. master: H
  780.     This is used by the master to hang up the connection.  The slave
  781.     will respond with an H command response.
  782.         HY
  783.             The slave agrees to hang up the connection.  In this case
  784.             the master sends another HY command.  In some UUCP
  785.             packages the slave will then send a third HY command.  At
  786.             this point the protocol is shut down, and the final
  787.             handshake is begun.
  788.         HN
  789.             The slave does not agree to hang up.  In this case the
  790.             master and the slave exchange roles.  The next command
  791.             will be sent by the former slave, which is the new master.
  792.             The roles may be reversed several times during a single
  793.             connection.
  794.  
  795. After the protocol has been shut down, the final handshake is
  796. performed.  This handshake has no real purpose, and some UUCP packages
  797. simply drop the connection rather than do it (in fact, some will drop
  798. the connection immediately after both sides agree to hangup, without
  799. even closing down the protocol).
  800.  
  801. caller: \020OOOOOO\000
  802. called: \020OOOOOOO\000
  803.  
  804. That is, the calling UUCP sends six O's and the called UUCP replies
  805. with seven O's.  Some UUCP packages always send six O's.
  806.  
  807. ------------------------------
  808.  
  809. From: UUCP-g
  810. Subject: What is the 'g' protocol?
  811.  
  812. The 'g' protocol is a packet based flow controlled error correcting
  813. protocol that requires an eight bit clear connection.  It is the
  814. original UUCP protocol, and is supported by all UUCP implementations.
  815. Many implementations of it are only able to support small window and
  816. packet sizes, specifically a window size of 3 and a packet size of 64
  817. bytes, but the protocol itself can support up to a window size of 7
  818. and a packet size of 4096 bytes.  Complaints about the inefficiency of
  819. the 'g' protocol generally refer to specific implementations, rather
  820. than to the correctly implemented protocol.
  821.  
  822. The 'g' protocol was originally designed for general packet drivers,
  823. and thus contains some features that are not used by UUCP, including
  824. an alternate data channel and the ability to renegotiate packet and
  825. window sizes during the communication session.
  826.  
  827. The 'g' protocol is spoofed by many Telebit modems.  When spoofing is
  828. in effect, each Telebit modem uses the 'g' protocol to communicate
  829. with the attached computer, but the data between the modems is sent
  830. using a Telebit proprietary error correcting protocol.  This allows
  831. for very high throughput over the Telebit connection, which, because
  832. it is half-duplex, would not normally be able to handle the 'g'
  833. protocol very well at all.  When a Telebit is spoofing the 'g'
  834. protocol, it forces the packet size to be 64 bytes and the window size
  835. to be 3.
  836.  
  837. This discussion of the 'g' protocol explains how it works, but does
  838. not discuss useful error handling techniques.  Some discussion of this
  839. can be found in Jamie E. Hanrahan's paper, cited above.
  840.  
  841. All 'g' protocol communication is done with packets.  Each packet
  842. begins with a six byte header.  Control packets consist only of the
  843. header.  Data packets contain additional data.
  844.  
  845. The header is as follows:
  846.  
  847.     \020
  848.         Every packet begins with a ^P.
  849.     k (1 <= k <= 9)
  850.         The k value is always 9 for a control packet.  For a data
  851.         packet, the k value indicates how much data follows the six
  852.         byte header.  The amount of data is 2 ** (k + 4), where **
  853.         indicates exponentiation.  Thus a k value of 1 means 32 data
  854.         bytes and a k value of 8 means 4096 data bytes.  The k value
  855.         for a data packet must be between 1 and 8 inclusive.
  856.     checksum low byte
  857.     checksum high byte
  858.         The checksum value is described below.
  859.     control byte
  860.         The control byte indicates the type of packet, and is
  861.         described below.
  862.     xor byte
  863.         This byte is the xor of k, the checksum low byte, the checksum
  864.         high byte and the control byte (i.e., the second, third,
  865.         fourth and fifth header bytes).  It is used to ensure that the
  866.         header data is valid.
  867.  
  868. The control byte in the header is composed of three bit fields,
  869. referred to here as TT (two bits), XXX (three bits) and YYY (three
  870. bits).  The control is TTXXXYYY, or (TT << 6) + (XXX << 3) + YYY.
  871.  
  872. The TT field takes on the following values:
  873.     0
  874.         This is a control packet.  In this case the k byte in the
  875.         header must be 9.  The XXX field indicates the type of control
  876.         packet; these types are described below.
  877.     1
  878.         This is an alternate data channel packet.  This is not used by
  879.         UUCP.
  880.     2
  881.         This is a data packet, and the entire contents of the attached
  882.         data field (whose length is given by the k byte in the header)
  883.         are valid.  The XXX and YYY fields are described below.
  884.     3
  885.         This is a short data packet.  Let the length of the data field
  886.         (as given by the k byte in the header) be L.  Let the first
  887.         byte in the data field be B1.  If B1 is less than 128 (if the
  888.         most significant bit of B1 is 0), then there are L - B1 valid
  889.         bytes of data in the data field, beginning with the second
  890.         byte.  If B1 >= 128, let B2 be the second byte in the data
  891.         field.  Then there are L - ((B1 & 0x7f) + (B2 << 7)) valid
  892.         bytes of data in the data field, beginning with the third
  893.         byte.  In all cases L bytes of data are sent (and all data
  894.         bytes participate in the checksum calculation) but some of the
  895.         trailing bytes may be dropped by the receiver.   The XXX and
  896.         YYY fields are described below.
  897.  
  898. In a data packet (short or not) the XXX field gives the sequence
  899. number of the packet.  Thus sequence numbers can range from 0 to 7,
  900. inclusive.  The YYY field gives the sequence number of the last
  901. correctly received packet.
  902.  
  903. Each communication direction uses a window which indicates how many
  904. unacknowledged packets may be transmitted before waiting for an
  905. acknowledgement.  The window may range from 1 to 7, and may be
  906. different in each direction. For example, if the window is 3 and the
  907. last packet acknowledged was packet number 6, packet numbers 7, 0 and
  908. 1 may be sent but the sender must wait for an acknowledgement before
  909. sending packet number 2.  This acknowledgement could come as the YYY
  910. field of a data packet or as the YYY field of a RJ or RR control
  911. packet (described below).
  912.  
  913. Each packet must be transmitted in order (the sender may not skip
  914. sequence numbers).  Each packet must be acknowledged, and each packet
  915. must be acknowledged in order.
  916.  
  917. In a control packet, the XXX field takes on the following values:
  918.     1 CLOSE
  919.         The connection should be closed immediately.  This is
  920.         typically sent when one side has seen too many errors and
  921.         wants to give up.  It is also sent when shutting down the
  922.         protocol.  If an unexpected CLOSE packet is received, a CLOSE
  923.         packet should be sent in reply and the 'g' protocol should
  924.         halt, causing UUCP to enter the final handshake.
  925.     2 RJ or NAK
  926.         The last packet was not received correctly.  The YYY field
  927.         contains the sequence number of the last correctly received
  928.         packet.
  929.     3 SRJ
  930.         Selective reject.  The YYY field contains the sequence number
  931.         of a packet that was not received correctly, and should be
  932.         retransmitted.  This is not used by UUCP, and most
  933.         implementations will not recognize it.
  934.     4 RR or ACK
  935.         Packet acknowledgement.  The YYY field contains the sequence
  936.         number of the last correctly received packet.
  937.     5 INITC
  938.         Third initialization packet.  The YYY field contains the
  939.         maximum window size to use.
  940.     6 INITB
  941.         Second initialization packet.  The YYY field contains the
  942.         packet size to use.  It requests a size of 2 ** (YYY + 5).
  943.         Note that this is not the same coding used for the k byte in
  944.         the packet header (it is 1 less).  Most UUCP implementations
  945.         that request a packet size larger than 64 bytes can handle any
  946.         packet size up to that specified.
  947.     7 INITA
  948.         First initialization packet.  The YYY field contains the
  949.         maximum window size to use.
  950.  
  951. The checksum of a control packet is simply 0xaaaa - the control byte.
  952.  
  953. The checksum of a data packet is 0xaaaa - (CHECK ^ the control byte),
  954. where ^ denotes exclusive or, and CHECK is the result of the following
  955. routine as run on the contents of the data field (every byte in the
  956. data field participates in the checksum, even for a short data
  957. packet).  Below is the routine used by Taylor UUCP; it is a slightly
  958. modified version of a routine which John Gilmore patched from G.L.
  959. Chesson's original paper.  The z argument points to the data and the c
  960. argument indicates how much data there is.
  961.  
  962. int
  963. igchecksum (z, c)
  964.      register const char *z;
  965.      register int c;
  966. {
  967.   register unsigned int ichk1, ichk2;
  968.  
  969.   ichk1 = 0xffff;
  970.   ichk2 = 0;
  971.  
  972.   do
  973.     {
  974.       register unsigned int b;
  975.  
  976.       /* Rotate ichk1 left.  */
  977.       if ((ichk1 & 0x8000) == 0)
  978.         ichk1 <<= 1;
  979.       else
  980.         {
  981.           ichk1 <<= 1;
  982.           ++ichk1;
  983.         }
  984.  
  985.       /* Add the next character to ichk1.  */
  986.       b = *z++ & 0xff;
  987.       ichk1 += b;
  988.  
  989.       /* Add ichk1 xor the character position in the buffer counting from
  990.          the back to ichk2.  */
  991.       ichk2 += ichk1 ^ c;
  992.  
  993.       /* If the character was zero, or adding it to ichk1 caused an
  994.          overflow, xor ichk2 to ichk1.  */
  995.       if (b == 0 || (ichk1 & 0xffff) < b)
  996.         ichk1 ^= ichk2;
  997.     }
  998.   while (--c > 0);
  999.  
  1000.   return ichk1 & 0xffff;
  1001. }
  1002.  
  1003. When the 'g' protocol is started, the calling UUCP sends an INITA
  1004. control packet with the window size it wishes the called UUCP to use.
  1005. The called UUCP responds with an INITA packet with the window size it
  1006. wishes the calling UUCP to use.  Pairs of INITB and INITC packets are
  1007. then similarly exchanged.  When these exchanges are completed, the
  1008. protocol is considered to have been started.
  1009.  
  1010. Note that the window and packet sizes are not a negotiation.  Each
  1011. system announces the window and packet size which the other system
  1012. should use.  It is possible that different window and packet sizes
  1013. will be used in each direction.  The protocol works this way on the
  1014. theory that each system knows how much data it can accept without
  1015. getting overrun.  Therefore, each system tells the other how much data
  1016. to send before waiting for an acknowledgement.
  1017.  
  1018. When a UUCP package transmits a command, it sends one or more data
  1019. packets.  All the data packets will normally be complete, although
  1020. some UUCP packages may send the last one as a short packet.  The
  1021. command string is sent with a trailing null byte, to let the receiving
  1022. package know when the command is finished.  Some UUCP packages require
  1023. the last byte of the last packet sent to be null, even if the command
  1024. ends earlier in the packet.  Some packages may require all the
  1025. trailing bytes in the last packet to be null, but I have not confirmed
  1026. this.
  1027.  
  1028. When a UUCP package sends a file, it will send a sequence of data
  1029. packets.  The end of the file is signalled by a short data packet
  1030. containing zero valid bytes (it will normally be preceeded by a short
  1031. data packet containing the last few bytes in the file).
  1032.  
  1033. Note that the sequence numbers cover the entire communication session,
  1034. including both command and file data.
  1035.  
  1036. When the protocol is shut down, each UUCP package sends a CLOSE
  1037. control packet.
  1038.  
  1039. ------------------------------
  1040.  
  1041. From: UUCP-f
  1042. Subject: What is the 'f' protocol?
  1043.  
  1044. The 'f' protocol is a seven bit protocol which checksums an entire
  1045. file at a time.  It only uses the characters between \040 and \176
  1046. (ASCII space and ~) inclusive as well as the carriage return
  1047. character.  It can be very efficient for transferring text only data,
  1048. but it is very inefficient at transferring eight bit data (such as
  1049. compressed news).  It is not flow controlled, and the checksum is
  1050. fairly insecure over large files, so using it over a serial connection
  1051. requires handshaking (XON/XOFF can be used) and error correcting
  1052. modems.  Some people think it should not be used even under those
  1053. circumstances.
  1054.  
  1055. I believe the 'f' protocol originated in BSD versions of UUCP.  It was
  1056. originally intended for transmission over X.25 PAD links.
  1057.  
  1058. The 'f' protocol has no startup or finish protocol.  However, both
  1059. sides typically sleep for a couple of seconds before starting up,
  1060. because they switch the terminal into XON/XOFF mode and want to allow
  1061. the changes to settle before beginning transmission.
  1062.  
  1063. When a UUCP package transmits a command, it simply sends a string
  1064. terminated by a carriage return.
  1065.  
  1066. When a UUCP package transmits a file, each byte b of the file is
  1067. translated according to the following table:
  1068.  
  1069.        0 <= b <=  037: 0172, b + 0100 (0100 to 0137)
  1070.      040 <= b <= 0171:       b        ( 040 to 0171)
  1071.     0172 <= b <= 0177: 0173, b - 0100 ( 072 to  077)
  1072.     0200 <= b <= 0237: 0174, b - 0100 (0100 to 0137)
  1073.     0240 <= b <= 0371: 0175, b - 0200 ( 040 to 0171)
  1074.     0372 <= b <= 0377: 0176, b - 0300 ( 072 to  077)
  1075.  
  1076. That is, a byte between \040 and \171 inclusive is transmitted as is,
  1077. and all other bytes are prefixed and modified as shown.
  1078.  
  1079. When all the file data is sent, a seven byte sequence is sent: two
  1080. bytes of \176 followed by four ASCII bytes of the checksum as printed
  1081. in base 16 followed by a carriage return.  For example, if the
  1082. checksum was 0x1234, this would be sent: "\176\1761234\r".
  1083.  
  1084. The checksum is initialized to 0xffff.  For each byte that is sent it
  1085. is modified as follows (where b is the byte before it has been
  1086. transformed as described above):
  1087.  
  1088.       /* Rotate the checksum left.  */
  1089.       if ((ichk & 0x8000) == 0)
  1090.         ichk <<= 1;
  1091.       else
  1092.         {
  1093.           ichk <<= 1;
  1094.           ++ichk;
  1095.         }
  1096.  
  1097.       /* Add the next byte into the checksum.  */
  1098.       ichk += b;
  1099.  
  1100. When the receiving UUCP sees the checksum, it compares it against its
  1101. own calculated checksum and replies with a single character followed
  1102. by a carriage return.
  1103.     G
  1104.         The file was received correctly.
  1105.     R
  1106.         The checksum did not match, and the file should be resent from
  1107.         the beginning.
  1108.     Q
  1109.         The checksum did not match, but too many retries have occurred
  1110.         and the communication session should be abandoned.
  1111.  
  1112. The sending UUCP checks the returned character and acts accordingly.
  1113.  
  1114. ------------------------------
  1115.  
  1116. From: UUCP-t
  1117. Subject: What is the 't' protocol?
  1118.  
  1119. The 't' protocol is intended for use on links which provide reliable
  1120. end-to-end connections, such as TCP.  It does no error checking or
  1121. flow control, and requires an eight bit clear channel.
  1122.  
  1123. I believe the 't' protocol originated in BSD versions of UUCP.
  1124.  
  1125. When a UUCP package transmits a command, it first gets the length of
  1126. the command string, C.  It then sends ((C / 512) + 1) * 512 bytes (the
  1127. smallest multiple of 512 which can hold C bytes plus a null byte)
  1128. consisting of the command string itself followed by trailing null
  1129. bytes.
  1130.  
  1131. When a UUCP package sends a file, it sends it in blocks.  Each block
  1132. contains at most 1024 bytes of data.  Each block consists of four
  1133. bytes containing the amount of data in binary (most significant byte
  1134. first, the same format as used by the Unix function htonl) followed by
  1135. that amount of data.  The end of the file is signalled by a block
  1136. containing zero bytes of data.
  1137.  
  1138. ------------------------------
  1139.  
  1140. From: UUCP-e
  1141. Subject: What is the 'e' protocol?
  1142.  
  1143. The 'e' protocol is similar to the 't' protocol.  It does no flow
  1144. control or error checking and is intended for use over networks
  1145. providing reliable end-to-end connections, such as TCP.
  1146.  
  1147. The 'e' protocol originated in versions of HDB UUCP.
  1148.  
  1149. When a UUCP package transmits a command, it simply sends the command
  1150. as an ASCII string terminated by a null byte.
  1151.  
  1152. When a UUCP package transmits a file, it sends the complete size of
  1153. the file as an ASCII decimal number.  The ASCII string is padded out
  1154. to 20 bytes with null bytes (i.e. if the file is 1000 bytes long, it
  1155. sends "1000\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0").  It then sends the
  1156. entire file.
  1157.  
  1158. ------------------------------
  1159.  
  1160. From: UUCP-G
  1161. Subject: What is the 'G' protocol?
  1162.  
  1163. The 'G' protocol is used by SVR4 UUCP.  It is identical to the 'g'
  1164. protocol, except that it is possible to modify the window and packet
  1165. sizes.  The SVR4 implementation of the 'g' protocol reportedly is
  1166. fixed at a packet size of 64 and a window size of 7.  Supposedly SVR4
  1167. chose to implement a new protocol using a new letter to avoid any
  1168. potential incompatibilities when using different packet or window
  1169. sizes.
  1170.  
  1171. Most implementations of the 'g' protocol that accept packets larger
  1172. than 64 bytes will also accept packets smaller than whatever they
  1173. requested in the INITB packet.  The SVR4 'G' implementation is an
  1174. exception; it will only accept packets of precisely the size it
  1175. requests in the INITB packet.
  1176.  
  1177. ------------------------------
  1178.  
  1179. From: UUCP-i
  1180. Subject: What is the 'i' protocol?
  1181.  
  1182. The 'i' protocol was written by Ian Lance Taylor (who also wrote this
  1183. FAQ).  It is used by Taylor UUCP version 1.04.
  1184.  
  1185. It is a sliding window packet protocol, like the 'g' protocol, but it
  1186. supports bidirectional transfers (i.e., file transfers in both
  1187. directions simultaneously).  It requires an eight bit clear
  1188. connection.  Several ideas for the protocol were taken from the paper
  1189. ``A High-Throughput Message Transport System'' by P. Lauder.  I don't
  1190. know where the paper was published, but the author's e-mail address is
  1191. piers@cs.su.oz.au.  The 'i' protocol does not adopt his main idea,
  1192. which is to dispense with windows entirely.  This is because some
  1193. links still do require flow control and, more importantly, because
  1194. using windows sets a limit to the amount of data which the protocol
  1195. must be able to resend upon request.  To reduce the costs of window
  1196. acknowledgements, the protocol uses a large window and only requires
  1197. an ack at the halfway point.
  1198.  
  1199. Each packet starts with a six byte header, optionally followed by data
  1200. bytes with a four byte checksum.  There are currently five defined
  1201. packet types (DATA, SYNC, ACK, NAK, SPOS, CLOSE) which are described
  1202. below.  Although any packet type may include data, any data provided
  1203. with an ACK, NAK or CLOSE packet is ignored.
  1204.  
  1205. Every DATA, SPOS and CLOSE packet has a sequence number.  The sequence
  1206. numbers are independent for each side.  The first packet sent by each
  1207. side is always number 1.  Each packet is numbered one greater than the
  1208. previous packet, modulo 32.
  1209.  
  1210. Every packet has a local channel number and a remote channel number.
  1211. For all packets at least one channel number is zero.  When a UUCP
  1212. command is sent to the remote system, it is assigned a non-zero local
  1213. channel number.  All packets associated with that UUCP command sent by
  1214. the local system are given the selected local channel number.  All
  1215. associated packets sent by the remote system are given the selected
  1216. number as the remote channel number.  This permits each UUCP command
  1217. to be uniquely identified by the channel number on the originating
  1218. system, and therefore each UUCP package can associate all file data
  1219. and UUCP command responses with the appropriate command.  This is a
  1220. requirement for bidirectional UUCP transfers.
  1221.  
  1222. The protocol maintains a single global file position, which starts at
  1223. 0.  For each incoming packet, any associated data is considered to
  1224. occur at the current file position, and the file position is
  1225. incremented by the amount of data contained.  The exception is a
  1226. packet of type SPOS, which is used to change the file position.
  1227. The reason for keeping track of the file position is described below.
  1228.  
  1229. The header is as follows:
  1230.  
  1231.     \007
  1232.     Every packet begins with ^G.
  1233.     (PACKET << 3) + LOCCHAN
  1234.     The five bit packet number combined with the three bit local
  1235.     channel number.  DATA, SPOS and CLOSE packets use the packet
  1236.     sequence number for the PACKET field.  NAK packet types use
  1237.     the PACKET field for the sequence number to be resent.  ACK
  1238.     and SYNC do not use the PACKET field, and generally leave it
  1239.     set to 0.  Packets which are not associated with a UUCP
  1240.     command from the local system use a local channel number of 0.
  1241.     (ACK << 3) + REMCHAN
  1242.     The five bit packet acknowledgement combined with the three
  1243.     bit remote channel number.  The packet acknowledgement is the
  1244.     number of the last packet successfully received; it is used by
  1245.     all packet types.  Packets which are not sent in response to a
  1246.     UUCP command from the remote system use a remote channel
  1247.     number of 0.
  1248.     (TYPE << 5) + (CALLER << 4) + LEN1
  1249.     The three bit packet type combined with the one bit packet
  1250.     direction combined with the upper four bits of the data
  1251.     length.  The packet direction bit is always 1 for packets sent
  1252.     by the calling UUCP, and 0 for packets sent by the called
  1253.     UUCP.  This prevents confusion caused by echoed packets.
  1254.     LEN2
  1255.     The lower eight bits of the data length.  The twelve bits of
  1256.     data length permit packets ranging in size from 0 to 4095
  1257.     bytes.
  1258.     CHECK
  1259.     The exclusive or of the second through fifth bytes of the
  1260.     header.  This provides an additional check that the header is
  1261.     valid.
  1262.  
  1263. If the data length is non-zero, the packet is immediately followed by
  1264. the specified number of data bytes.  The data bytes are followed by a
  1265. four byte CRC 32 checksum, with the most significant byte first.  The
  1266. CRC is calculated over the contents of the data field.
  1267.  
  1268. The defined packet types are as follows:
  1269.  
  1270.     0 (DATA)
  1271.     This is a plain data packet.
  1272.     1 (SYNC)
  1273.     SYNC packets are exchanged when the protocol is initialized,
  1274.     and are described further below.  SYNC packets do not carry
  1275.     sequence numbers (that is, the PACKET field is ignored).
  1276.     2 (ACK)
  1277.     This is an acknowledgement packet.  Since DATA packets also
  1278.     carry packet acknowledgements, ACK packets are only used when
  1279.     one side has no data to send.  ACK packets do not carry
  1280.     sequence numbers.
  1281.     3 (NAK)
  1282.     This is a negative acknowledgement.  This is sent when a
  1283.     packet is received incorrectly, and means that the packet
  1284.     number appearing in the PACKET field must be resent.  NAK
  1285.     packets do not carry sequence numbers (the PACKET field is
  1286.     already used).
  1287.     4 (SPOS)
  1288.     This packet changes the file position.  The packet contains
  1289.     four bytes of data holding the file position, most significant
  1290.     byte first.  The next packet received will be considered to be
  1291.     at the named file position.
  1292.     5 (CLOSE)
  1293.     When the protocol is shut down, each side sends a CLOSE
  1294.     packet.     This packet does have a sequence number, which could
  1295.     be used to ensure that all packets were correctly received
  1296.     (this is not needed by UUCP, however, which uses the higher
  1297.     level H command with an HY response).
  1298.  
  1299. When the protocol starts up, both systems send a SYNC packet.  The
  1300. SYNC packet includes at least three bytes of data.  The first two
  1301. bytes are the maximum packet size the remote system should send, most
  1302. significant byte first.  The third byte is the window size the remote
  1303. system should use.  The remote system may send packets of any size up
  1304. to the maximum.  If there is a fourth byte, it is the number of
  1305. channels the remote system may use (this must be between 1 and 7,
  1306. inclusive).  Additional data bytes may be defined in the future.
  1307.  
  1308. The window size is the number of packets that may be sent before a
  1309. packet is acknowledged.  There is no requirement that every packet be
  1310. acknowledged; any acknowledgement is considered to acknowledge all
  1311. packets through the number given.  In the current implementation, if
  1312. one side has no data to send, it sends an ACK when half the window is
  1313. received.
  1314.  
  1315. Note that the NAK packet corresponds to the unused 'g' protocol SRJ
  1316. packet type, rather than to the RJ packet type.  When a NAK is
  1317. received, only the named packet should be resent, not any subsequent
  1318. packets.
  1319.  
  1320. Note that if both sides have data to send, but a packet is lost, it is
  1321. perfectly reasonable for one side to continue sending packets, all of
  1322. which will acknowledge the last packet correctly received, while the
  1323. system whose packet was lost will be unable to send a new packet
  1324. because the send window will be full.  In this circumstance, neither
  1325. side will time out and one side of the communication will be
  1326. effectively shut down for a while.  Therefore, any system with
  1327. outstanding unacknowledged packets should arrange to time out and
  1328. resend a packet even if data is being received.
  1329.  
  1330. Commands are sent as a sequence of data packets with a non-zero local
  1331. channel number.  The last data packet for a command includes a
  1332. trailing null byte (normally a command will fit in a single data
  1333. packet).  Files are sent as a sequence of data packets ending with one
  1334. of length zero.
  1335.  
  1336. The channel numbers permit a more efficient implementation of the UUCP
  1337. file send command.  Rather than send the command and then wait for the
  1338. SY response before sending the file, the file data is sent beginning
  1339. immediately after the S command is sent.  If an SN response is
  1340. received, the file send is aborted, and a final data packet of length
  1341. zero is sent to indicate that the channel number may be reused.  If an
  1342. SY reponse with a file position indicator is received, the file send
  1343. adjusts to the file position; this is why the protocol maintains a
  1344. global file position.
  1345.  
  1346. Note that the use of channel numbers means that each UUCP system may
  1347. send commands and file data simultaneously.  Moreover, each UUCP
  1348. system may send multiple files at the same time, using the channel
  1349. number to disambiguate the data.  Sending a file before receiving an
  1350. acknowledgement for the previous file helps to eliminate the round
  1351. trip delays inherent in other UUCP protocols.
  1352.  
  1353. ------------------------------
  1354.  
  1355. From: UUCP-x
  1356. Subject: What is the 'x' protocol?
  1357.  
  1358. The 'x' protocol is used in Europe (and probably elsewhere) with
  1359. machines that contain an builtin X.25 card and can send eight bit data
  1360. transparently across X.25 circuits, without interference from the X.28
  1361. or X.29 layers.  The protocol sends packets of 512 bytes, and relies
  1362. on a write of zero bytes being read as zero bytes without stopping
  1363. communication.  It first appeared in the original System V UUCP
  1364. implementation.
  1365.  
  1366. ------------------------------
  1367.  
  1368. From: UUCP-d
  1369. Subject: What is the 'd' protocol?
  1370.  
  1371. This is apparently used for DataKit muxhost (not RS-232) connections.
  1372. No file size is sent.  When a file has been completely transferred, a
  1373. write of zero bytes is done; this must be read as zero bytes on the
  1374. other end.
  1375.  
  1376. ------------------------------
  1377.  
  1378. From: UUCP-h
  1379. Subject: What is the 'h' protocol?
  1380.  
  1381. This is apparently used in some places with HST modems.  It does no
  1382. error checking, and is not that different from the 't' protocol.  I
  1383. don't know the details.
  1384.  
  1385. ------------------------------
  1386.  
  1387. From: UUCP-v
  1388. Subject: What is the 'v' protocol?
  1389.  
  1390. The 'v' protocol is used by UUPC/extended, a DOS UUCP program.  It is
  1391. simply a version of the 'g' protocol which supports packets of any
  1392. size, and also supports sending packets of different sizes during the
  1393. same conversation.  There are many 'g' protocol implementations which
  1394. support both, but there are also many which do not.  Using 'v' ensures
  1395. that everything is supported.
  1396.  
  1397. ------------------------------
  1398.  
  1399. From: Thanks
  1400. Subject: Thanks
  1401.  
  1402. Besides the papers and information acknowledged at the top of this
  1403. article, the following people have contributed help, advice,
  1404. suggestions and information:
  1405.     Earle Ake 513-429-6500 <ake@Dayton.SAIC.COM>
  1406.     cambler@nike.calpoly.edu (Christopher J. Ambler)
  1407.     jhc@iscp.bellcore.com (Jonathan Clark)
  1408.     celit!billd@UCSD.EDU (Bill Davidson)
  1409.     "Drew Derbyshire" <ahd@kew.com>
  1410.     erik@pdnfido.fidonet.org
  1411.     Matthew Farwell <dylan@ibmpcug.co.uk>
  1412.     kherron@ms.uky.edu (Kenneth Herron)
  1413.     Romain Kang <romain@pyramid.com>
  1414.     "Jonathan I. Kamens" <jik@GZA.COM>
  1415.     "David J. MacKenzie" <djm@eng.umd.edu>
  1416.     jum@helios.de (Jens-Uwe Mager)
  1417.     peter@xpoint.ruessel.sub.org (Peter Mandrella)
  1418.     david nugent <david@csource.oz.au>
  1419.     Stephen.Page@prg.oxford.ac.uk
  1420.     joey@tessi.UUCP (Joey Pruett)
  1421.     James Revell <revell@uunet.uu.net>
  1422.     Larry Rosenman <ler@lerami.lerctr.org>
  1423.     Rich Salz <rsalz@bbn.com>
  1424.     kls@ditka.Chicago.COM (Karl Swartz)
  1425.     Dima Volodin <dvv@hq.demos.su>
  1426.     jon@console.ais.org (Jon Zeeff)
  1427.     Eric Ziegast <ziegast@uunet.uu.net>
  1428.  
  1429. ------------------------------
  1430.  
  1431. End of UUCP Internals Frequently Asked Questions
  1432. ******************************
  1433. -- 
  1434. Ian Taylor | ian@airs.com | First to identify quote wins free e-mail message:
  1435. ``We are great fools.  `He has spent his life in idleness,' we say; `I have
  1436.   done nothing today.'  What, have you not lived?''
  1437.