home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / upc12bad.zip / uucpfaq.inf < prev    next >
Text File  |  1993-05-22  |  64KB  |  1,373 lines

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