home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.mdf / Documents / FAQ / UUCP-internals-faq / UUCP-internals-faq < prev   
Encoding:
Internet Message Format  |  1993-08-08  |  62.0 KB

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