home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / etc / misc / uucp.pro < prev    next >
Encoding:
Text File  |  2003-06-11  |  31.8 KB  |  2,109 lines

  1.  
  2.  
  3. From: brian@sdcsvax.UCSD.EDU (Brian Kantor)
  4.  
  5. Newsgroups: comp.doc
  6.  
  7. Subject: UUCP Protocol Information Potpourri
  8.  
  9. Date: 20 Jan 88 02:04:02 GMT
  10.  
  11.  
  12.  
  13. The following is collection of stuff that John Gilmore posted to the net
  14.  
  15. some time ago; with renewed interest in making nearly everything under
  16.  
  17. the sun talk uucp, I figured it was time this document appeared somewhere 
  18.  
  19. that it would get archived for future inquiries.
  20.  
  21.  
  22.  
  23. From ucsdhub!hp-sdd!hplabs!decwrl!sun!hoptoad!gnu Tue Feb  3 13:10:08 PST 1987
  24.  
  25.  
  26.  
  27. [This information came from the Tanner Andrews's uucpinfo mailing list.
  28.  
  29. This is a collection of people interested in writing a version
  30.  
  31. of uucp in the public domain.  Contact ihnp4!akgua!ucf-cs!ki4pv!tanner
  32.  
  33. to be added to the mailing list.  There have only been three messages
  34.  
  35. sent to the list; all are below.
  36.  
  37.  
  38.  
  39.     John Gilmore, hoptoad!gnu]
  40.  
  41.  
  42.  
  43. -----
  44.  
  45.  
  46.  
  47. Subject: UUCP Protocol Information (issue #1)
  48.  
  49. Date: Tue Nov 19 22:04:56 1985
  50.  
  51.  
  52.  
  53. Greetings.  First order of business is the fact that I probably have
  54.  
  55. a lousy or a slow address for some of you all.  Please complain, and
  56.  
  57. things will be corrected.  Those of you not receiving this because your
  58.  
  59. names have been omitted will please inform me, giving a good address.
  60.  
  61. Those who provided replies but who are not interested in receiving
  62.  
  63. further information please warn me; maybe things won't cross in the
  64.  
  65. mail.
  66.  
  67.  
  68.  
  69. Now that we're over that, welcome to the first issue.  There will most
  70.  
  71. likely be more, as more information is received.  Anyone with comments,
  72.  
  73. information, or clean suggestions to be shared should please write to
  74.  
  75. me at the return address given below.  I'll keep the copy of this
  76.  
  77. mailing list around, and make required additions, deletions, &c.  This
  78.  
  79. issue is just a "welcome" and mailing-error-finder.  Sorry about the
  80.  
  81. delay between your "me-too" mailing and the actual goodstuff.
  82.  
  83.  
  84.  
  85. This is being issued as a mailing list because, while I have some of
  86.  
  87. the required information, there is still rather a shortage.  Research
  88.  
  89. is expected to improve the situation.
  90.  
  91.  
  92.  
  93. The second issue of this will be coming out almost immediately, and
  94.  
  95. will contain the bulk of the preliminary information which I have.
  96.  
  97. It will also include a summary which has been tempered by experience
  98.  
  99. on this system (type ~uucp_adm/uucico on my terminal, watch the fun
  100.  
  101. begin).
  102.  
  103.  
  104.  
  105. My address is:
  106.  
  107.     uucp:    ...{decvax|akgua}!ucf-cs!ki4pv!tanner
  108.  
  109.     csnet:    ki4pv!tanner@ucf-cs.csnet
  110.  
  111.     arpa:    ki4pv!tanner%ucf-cs.csnet@csnet-relay.arpa
  112.  
  113.  
  114.  
  115.                         Tanner Andrews, systems
  116.  
  117.                         CompuData South,
  118.  
  119.                         P.O.Box 3636,
  120.  
  121.                         DeLand, FLA   32723.
  122.  
  123.  
  124.  
  125. >From: ihnp4!akgua!ucf-cs!ki4pv!tanner
  126.  
  127. To: ucf-cs!ki4pv-uucpinfo2, ucf-cs!ki4pv-uucpinfo1
  128.  
  129. Subject: UUCP Information Issue #02
  130.  
  131. Date: Wed Dec 11 23:39:26 1985
  132.  
  133.  
  134.  
  135. This is the second issue; the information below is the start of
  136.  
  137. what has been collected here.  It is expected that more information
  138.  
  139. will be collected in the next few weeks, and that information will
  140.  
  141. be forwarded when/if it becomes available.
  142.  
  143.  
  144.  
  145.  =====================================================
  146.  
  147.  -- part 1
  148.  
  149.  =====================================================
  150.  
  151. This information came via several people, most of whom snet this
  152.  
  153. exact message (probably from their news archives from before we
  154.  
  155. joined the net):
  156.  
  157.  
  158.  
  159.     I am posting this over the network because I believe that
  160.  
  161.     others are interested in knowing the protocols of UUCP.
  162.  
  163.     Below is listed all the information that I have acquired
  164.  
  165.     to date. This includes the initial handshaking phase, though
  166.  
  167.     not the login phase. It also doesn't include information
  168.  
  169.     about the data transfer protocol for non-packet networks
  170.  
  171.     (the -G option left off the uucico command line). But, just
  172.  
  173.     hold on - I am working on that stuff.
  174.  
  175.  
  176.  
  177.     For a point of information : the slave is the UUCP site being
  178.  
  179.     dialed, and the master is the one doing the calling up. The
  180.  
  181.     protocols listed in the handshaking and termination phase are
  182.  
  183.     independent of any UUCP site : it is universal. The stuff in
  184.  
  185.     the work phase depends on the specific protocol chosen. The
  186.  
  187.     concepts in the work phase are independent of protocol, ie. the
  188.  
  189.     sequences are the same. It is just the lower level stuff that
  190.  
  191.     changes from protocol to protocol. I have access only to level
  192.  
  193.     g and will document it as I begin to understand it.
  194.  
  195.  
  196.  
  197.     Most of the stuff you see here is gotten from the debug phase
  198.  
  199.     of the current BSD UUCP system.
  200.  
  201.  
  202.  
  203.     I hope this is useful. Maybe this will get some of the real
  204.  
  205.     'brains' in UUCP to get off their duffs and provide some real
  206.  
  207.     detail. In any case, if you have any questions please feel
  208.  
  209.     free to contact me. I will post any questions and answers over
  210.  
  211.     the network.
  212.  
  213.  
  214.  
  215.  
  216.  
  217.                 Chuck Wegrzyn
  218.  
  219.                 {allegra,decvax,ihnp4}!encore!wegrzyn
  220.  
  221.  
  222.  
  223.                 (617) 237-1022
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.             UUCP Handshake Phase
  232.  
  233.             ====================
  234.  
  235.  
  236.  
  237. Master                            Slave
  238.  
  239. ------                            -----
  240.  
  241.  
  242.  
  243.                     <-----        \020Shere\0     (1)
  244.  
  245.  
  246.  
  247.  
  248.  
  249. (2)  \020S<mastername> <switches>\0    ----->
  250.  
  251.  
  252.  
  253.  
  254.  
  255.                     <-----        \020RLCK\0      (3)
  256.  
  257.                             \020RCB\0
  258.  
  259.                             \020ROK\0
  260.  
  261.                             \020RBADSEQ\0
  262.  
  263.  
  264.  
  265.                     <-----        \020P<protos>\0 (4)
  266.  
  267.  
  268.  
  269.  
  270.  
  271. (5) \020U<proto>\0            ----->
  272.  
  273.     \020UN\0
  274.  
  275.  
  276.  
  277.  
  278.  
  279. (6) ...
  280.  
  281.  
  282.  
  283.  
  284.  
  285. (0) This communication happens outside of the packet communication that
  286.  
  287.     is supported. If the -G flag is sent on the uucico line, all
  288.  
  289.     communications will occur without the use of the packet
  290.  
  291.     simulation software. The communication at this level is just
  292.  
  293.     the characters listed above.
  294.  
  295.  
  296.  
  297. (1) The slave sends the sequence indicated, while the master waits for
  298.  
  299.     the message.
  300.  
  301.  
  302.  
  303. (2) The slave waits for the master to send a response message. The message
  304.  
  305.     is composed of the master's name and some optional switches.
  306.  
  307.     The switch field can include the following
  308.  
  309.  
  310.  
  311.             -g        (set by the -G switch on the
  312.  
  313.                      master's uucico command line.
  314.  
  315.                      Indicates that communication
  316.  
  317.                      occurs over a packet switch net.)
  318.  
  319.             -xN        (set by the -x switch on the
  320.  
  321.                      master's uucico command line.
  322.  
  323.                      The number N is the debug level
  324.  
  325.                      desired.)
  326.  
  327.             -QM        (M is really a sequence number
  328.  
  329.                      for the communication.)
  330.  
  331.  
  332.  
  333.     Each switch is separated from the others by a 'blank' character.
  334.  
  335.  
  336.  
  337. (3) The slave will send one of the many responses. The meanings appear to
  338.  
  339.     be :
  340.  
  341.  
  342.  
  343.     RLCK
  344.  
  345.  
  346.  
  347.         This message implies that a 'lock' failure occurred:
  348.  
  349.         a file called LCK..mastername couldn't be created since
  350.  
  351.         one already exists. This seems to imply that the master
  352.  
  353.         is already in communication with the slave.
  354.  
  355.  
  356.  
  357.     RCB
  358.  
  359.  
  360.  
  361.         This message will be sent out if the slave requires a
  362.  
  363.         call back to the master - the slave will not accept a
  364.  
  365.         call from the master but will call the master instead.
  366.  
  367.  
  368.  
  369.     ROK
  370.  
  371.  
  372.  
  373.         This message will be returned if the sequence number that
  374.  
  375.         was sent in the message, attached to the -Q switch, from 
  376.  
  377.         the master is the same as that computed on the slave.
  378.  
  379.  
  380.  
  381.     RBADSEQ
  382.  
  383.  
  384.  
  385.         Happens if the sequence numbers do not match.
  386.  
  387.  
  388.  
  389.     (Notes on the sequence number - if a machine does not keep
  390.  
  391.      sequence numbers, the value is set to 0. If no -Q switch
  392.  
  393.      is given in the master's line, the sequence number is
  394.  
  395.      defaulted to 0.
  396.  
  397.  
  398.  
  399.      The sequence file, SQFILE, has the format
  400.  
  401.  
  402.  
  403.         <remotename> <number> <month>/<day>-<hour>:<min>
  404.  
  405.  
  406.  
  407.      where <remotename> is the name of a master and <number>
  408.  
  409.      is the previous sequence number. If the <number> field
  410.  
  411.      is not present, or if it is greater than 9998, it is
  412.  
  413.      set to 0. The <number> field is an ascii representation
  414.  
  415.      of the number. The stuff after the <number> is the time
  416.  
  417.      the sequence number was last changed, this information
  418.  
  419.      doesn't seem important.)
  420.  
  421.  
  422.  
  423. (4) The slave sends a message that identifies all the protocols that
  424.  
  425.     it supports. It seems that BSD supports 'g' as the normal case.
  426.  
  427.     Some sites, such as Allegra, support 'e' and 'g', and a few
  428.  
  429.     sites support 'f' as well. I have no information about these
  430.  
  431.     protocols. The exact message sent might look like
  432.  
  433.  
  434.  
  435.         \020Pefg\0
  436.  
  437.  
  438.  
  439.     where efg indicates that this slave supports the e,f and g 
  440.  
  441.     protocols.
  442.  
  443.  
  444.  
  445. (5) The slave waits for a response from the master with the chosen
  446.  
  447.     protocol. If the master has a protocol that is in common the
  448.  
  449.     master will send the message
  450.  
  451.  
  452.  
  453.         \020U<proto>\0
  454.  
  455.  
  456.  
  457.     where <proto> is the protocol (letter) chosen. If no protocol
  458.  
  459.     is in common, the master will send the message
  460.  
  461.  
  462.  
  463.         \020UN\0
  464.  
  465.  
  466.  
  467. (6) At this point both the slave and master agree to use the designated
  468.  
  469.     protocol. The first thing that now happens is that the master
  470.  
  471.     checks for work.
  472.  
  473.  
  474.  
  475. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  476.  
  477.  
  478.  
  479.             UUCP Work Phase
  480.  
  481.             ===============
  482.  
  483.  
  484.  
  485.  
  486.  
  487. Master                            Slave
  488.  
  489. ------                            -----
  490.  
  491.  
  492.  
  493. (a) Master has UUCP Work
  494.  
  495.  
  496.  
  497.     (1) X file1 file2     ----->
  498.  
  499.  
  500.  
  501.                     <-----        XN        (2)
  502.  
  503.                             XY
  504.  
  505.  
  506.  
  507.     When the master wants the slave to do a 'uux' command
  508.  
  509.     it sends the X message. If the slave can't or won't
  510.  
  511.     do it, the slave will send an XN message. Otherwise
  512.  
  513.     it will send an XY message.
  514.  
  515.  
  516.  
  517. (b) Master wants to send a file
  518.  
  519.  
  520.  
  521.     (1) S file1 file2 user options  ----->
  522.  
  523.  
  524.  
  525.                     <-----        SN2        (2)
  526.  
  527.                             SN4
  528.  
  529.                             SY
  530.  
  531.  
  532.  
  533.             <---- <data exchanged>---->            (3)
  534.  
  535.  
  536.  
  537.  
  538.  
  539.                     <-----        CY        (4)
  540.  
  541.                             CN5
  542.  
  543.  
  544.  
  545.     If the master wishes to send a file to the slave, it will
  546.  
  547.     send a S message to the slave. If the slave can or will do
  548.  
  549.     the transfer, it sends a SY message. If the slave has a
  550.  
  551.     problem creating work files, it sends a SN4 message. If
  552.  
  553.     the target file can't be created (because of priv's etc)
  554.  
  555.     it sends a SN2 message.
  556.  
  557.  
  558.  
  559.     The file1 argument is the source file, and file2 is the
  560.  
  561.     (almost) target filename. If file2 is a directory, then
  562.  
  563.     the target filename is composed of file2 concatenated
  564.  
  565.     with the "last" part of the file1 argument. Note, if the
  566.  
  567.     file2 argument begins with X, the request is targeted to
  568.  
  569.     UUX and not the normal send.
  570.  
  571.  
  572.  
  573.     The user argument indicates who, if anyone, is to be notified
  574.  
  575.     if the file has been copied. This user must be on the slave
  576.  
  577.     system.
  578.  
  579.  
  580.  
  581.     I am not sure what the options argument does.
  582.  
  583.  
  584.  
  585.     After the data has been exchanged the slave will send one of
  586.  
  587.     two messages to the master. A CY message indicates that every-
  588.  
  589.     thing is ok. The message CN5 indicates that the slave had
  590.  
  591.     some problem moving the file to it's permanent location. This
  592.  
  593.     is not the same as a problem during the exchange of data : this
  594.  
  595.     causes the slave to terminate operation.
  596.  
  597.  
  598.  
  599. (c) Master wishes to receive a file.
  600.  
  601.  
  602.  
  603.     (1) R file1 file2 user    ----->
  604.  
  605.  
  606.  
  607.                         <-----    RN2        (2)
  608.  
  609.                             RY mode
  610.  
  611.  
  612.  
  613.     (3)        <---- <data exchanged> ---->
  614.  
  615.  
  616.  
  617.     (4)    CY        ----->
  618.  
  619.         CN5
  620.  
  621.  
  622.  
  623.     If the master wishes the slave to send a file, the master sends
  624.  
  625.     a R message. If the slave has the file and can send it, the
  626.  
  627.     slave will respond with the RY message. If the slave can't find
  628.  
  629.     the file, or won't send it the RN2 message is sent. It doesn't
  630.  
  631.     appear that the 'mode' field of the RY message is used.
  632.  
  633.  
  634.  
  635.     The argument file1 is the file to transfer, unless it is a
  636.  
  637.     directory. In this case the file to be transferred is built
  638.  
  639.     of a concatenation of file1 with the "last" part of the file2
  640.  
  641.     argument.
  642.  
  643.  
  644.  
  645.     If anything goes wrong with the data transfer, it results in
  646.  
  647.     both the slave and the master terminating.
  648.  
  649.  
  650.  
  651.     After the data has been transferred, the master will send an
  652.  
  653.     acknowledgement to the slave. If the transfer and copy to the
  654.  
  655.     destination file has been successful, the master will send the
  656.  
  657.     CY message. Otherwise it will send the CN5 message.
  658.  
  659.  
  660.  
  661. (d) Master has no work, or no more work.
  662.  
  663.  
  664.  
  665.     (1) H            ----->
  666.  
  667.  
  668.  
  669.                 <-----                HY    (2)
  670.  
  671.                                 HN
  672.  
  673.  
  674.  
  675.     (3) HY            ----->
  676.  
  677.  
  678.  
  679.                 <----                HY    (4)
  680.  
  681.  
  682.  
  683.     (5) ...
  684.  
  685.  
  686.  
  687.     The transfer of control is initiated with the master sending
  688.  
  689.     a H message. This message tells the slave that the master has
  690.  
  691.     no work, and the slave should look for work.
  692.  
  693.  
  694.  
  695.     If the slave has no work it will respond with the HY message.
  696.  
  697.     This will tell the master to send an HY message, and turn off
  698.  
  699.     the selected protocol. When the HY message is received by the
  700.  
  701.     slave, it turns off the selected protocol as well. Both the
  702.  
  703.     master and slave enter the UUCP termination phase.
  704.  
  705.  
  706.  
  707.     If the slave does have work, it sends the HN message to the
  708.  
  709.     master. At this point, the slave becomes the master. After
  710.  
  711.     the master receives the HN message, it becomes the slave.
  712.  
  713.     The whole sequence of sending work starts over again. Note,
  714.  
  715.     the transmission of HN doesn't force the master to send any
  716.  
  717.     other H messages : it waits for stuff  from the new master.
  718.  
  719.  
  720.  
  721. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  722.  
  723.  
  724.  
  725.  
  726.  
  727.             UUCP Termination Sequence
  728.  
  729.             =========================
  730.  
  731.  
  732.  
  733.  Master                                Slave
  734.  
  735.  ------                                -----
  736.  
  737.  
  738.  
  739.  (1) \020OOOOOO\0        ----->
  740.  
  741.  
  742.  
  743.                 <-----            \020OOOOOOO\0 (2)
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.     At this point all conversation has completed normally.
  752.  
  753.  
  754.  
  755.  
  756.  
  757. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  758.  
  759.  
  760.  
  761.             UUCP Data Transfers
  762.  
  763.             ===================
  764.  
  765.  
  766.  
  767.     After the initial handshake the systems send messages in one
  768.  
  769.     of two styles : packet and not packet. A Packet protocol is
  770.  
  771.     just raw data transfers : there is no protocol or acknowledgements;
  772.  
  773.     this appears to assume that the lower level is a packet network
  774.  
  775.     of some type. If the style is not Packet, then extra work is
  776.  
  777.     done. I am still working on this stuff.
  778.  
  779.  
  780.  
  781.  =====================================================
  782.  
  783.  -- part 2
  784.  
  785.  =====================================================
  786.  
  787.  ** summary of UUCP packets ** 
  788.  
  789. (this is much like part 1, but shortened and compared against a
  790.  
  791. live UUCP ~uucp_adm/uucico)
  792.  
  793.  
  794.  
  795. note that all transmissions end with a null, not shown here
  796.  
  797.  
  798.  
  799.  
  800.  
  801. (master)        (slave)
  802.  
  803.  
  804.  
  805.  ... dials up ...    <DLE>Shere        says "hello"
  806.  
  807.  
  808.  
  809. <DLE>S<sysname> <opts>                says who he is
  810.  
  811.  
  812.  
  813.         |    <DLE>ROK        says ok to talk
  814.  
  815.         |    <DLE>RLCK        says locked out
  816.  
  817.         |    <DLE>RCB        says will call back
  818.  
  819.         |    <DLE>RBADSEQ        says bad seq num
  820.  
  821.  
  822.  
  823.             <DLE>P<protos>        what protocols he has
  824.  
  825.  
  826.  
  827. <DLE>U<proto>    |                which to use
  828.  
  829. <DLE>UN        |                use none, hang up
  830.  
  831.  
  832.  
  833.  
  834.  
  835. packet driver is turned on at this time, if not told otherwise
  836.  
  837.  
  838.  
  839.  -- if master has work --
  840.  
  841.  
  842.  
  843. to sned file to slave...
  844.  
  845. S <mfilenm> <sfilenm> <user> <opts>        request to sned file
  846.  
  847.  
  848.  
  849.         |    SY            ok -- i'll take it
  850.  
  851.         |    SN2            not permitted
  852.  
  853.         |    SN4            can't make workfile
  854.  
  855.  
  856.  
  857. <data>                        the file is transmitted
  858.  
  859.  
  860.  
  861.         |    CY            finished OK
  862.  
  863.         |    CN5            can't move into place
  864.  
  865.  
  866.  
  867.  
  868.  
  869. to recv file from slave...
  870.  
  871. R <sfilenm> <mfilenm> <user>            request to recv file
  872.  
  873.  
  874.  
  875.         |    RY<mode>        ok -- here is prot mode
  876.  
  877.         |    RN2            not permitted
  878.  
  879.  
  880.  
  881.             <data>            file is transmitted
  882.  
  883.  
  884.  
  885. CY        |                worked
  886.  
  887. CN5        |                can't move into place
  888.  
  889.  
  890.  
  891.  
  892.  
  893. to do UUX on slave...
  894.  
  895. X <file1> <file2>                request to exec file
  896.  
  897.  
  898.  
  899.         |    XY            ok -- will do
  900.  
  901.         |    XN            nopers
  902.  
  903.  
  904.  
  905. to indicate that he has no more work...
  906.  
  907. H                        no more work
  908.  
  909.  
  910.  
  911.         |    HN            reverse roles
  912.  
  913.         |    HY            no work here either
  914.  
  915.  
  916.  
  917. to accept slave's claim of no more work...
  918.  
  919.  
  920.  
  921. HY                        agrees to hang up
  922.  
  923.  
  924.  
  925. the rest of the hang-up is done OUTSIDE of packet driver
  926.  
  927. <DLE>OOOOOO                    signs off (6*'O')
  928.  
  929.  
  930.  
  931.             <DLE>OOOOOOO        signs off (7*'O')
  932.  
  933.     
  934.  
  935.  
  936.  
  937. If the slave has work, then the roles are reversed, and the
  938.  
  939. session proceeds from the label 'loop1' above.  The system
  940.  
  941. which was the slave is now the master, and the old master is
  942.  
  943. just the slave.
  944.  
  945.  
  946.  
  947. The <opts> which follow the system name for the start-up sequence
  948.  
  949. include:
  950.  
  951.     -g        don't use packet driver (command line -G)
  952.  
  953.     -xN        debug level (command line -Xn)
  954.  
  955.     -QN        seq number (if systems use this)
  956.  
  957.  
  958.  
  959. The filenames for <mfilenm> should be complete filenames with
  960.  
  961. path information; otherwise they are assumed to be in /usr/spool/uucp.
  962.  
  963. The filenames for <sfilenm> should be either complete filenames
  964.  
  965. or directory names.  If directory names are used, then the final
  966.  
  967. componant of <mfilenm> is appended to form the complete filename.
  968.  
  969.  
  970.  
  971. The 'X' command to do UUX on a slave is more than a little unclear.
  972.  
  973. It doesn't seem to work here, but that may be a microsoft "feature".
  974.  
  975.  
  976.  
  977.  
  978.  
  979. Protocol "g", which seems to be the one most commonly used, is supposed
  980.  
  981. to be a slightly munged version of level 2 of X.25; an article was just
  982.  
  983. posted in net.unix-wizards (which you probably have already seen) to
  984.  
  985. this effect.  The article didn't provide any details on the protocol,
  986.  
  987. but merely mentioned the modifications.
  988.  
  989.  
  990.  
  991. The "packet" mode, with no protocol, does not work under microsoft
  992.  
  993. implementations, and may have *lots* of trouble working anywhere
  994.  
  995. else as well.  It evidently requires that zero-length reads happen
  996.  
  997. every so often to delimit things, such as files being transferred.
  998.  
  999. This of course can't happen without the packet driver, which was long
  1000.  
  1001. gone by the time sys-3 or sys-5 or <your current version> came along.
  1002.  
  1003.  
  1004.  
  1005. **********************************
  1006.  
  1007. ** end of issue #2
  1008.  
  1009. **********************************
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015. >From: ihnp4!akgua!ucf-cs!ki4pv!tanner
  1016.  
  1017. To: ucf-cs!ki4pv-uucpinfo, allegra!mp
  1018.  
  1019. Subject: UUCP INFO mailing list issue #03
  1020.  
  1021. Date: Sun Jan 12 19:11:18 1986
  1022.  
  1023.  
  1024.  
  1025. The following information, describing the uucp 'g' protocol, was
  1026.  
  1027. provided as "nroff" source.  Cut the header and this text off of
  1028.  
  1029. the message, and run it through "nroff".
  1030.  
  1031. .ce
  1032.  
  1033. .B
  1034.  
  1035. Packet Driver Protocol
  1036.  
  1037. .R
  1038.  
  1039. .sp 1
  1040.  
  1041. .ce
  1042.  
  1043. G. L. Chesson
  1044.  
  1045. .br
  1046.  
  1047. .ce
  1048.  
  1049. Bell Laboratories
  1050.  
  1051. .SH
  1052.  
  1053. Abstract
  1054.  
  1055. .in +.5i
  1056.  
  1057. .PP
  1058.  
  1059. These notes describe the packet driver link
  1060.  
  1061. protocol that was supplied
  1062.  
  1063. with the
  1064.  
  1065. Seventh Edition of
  1066.  
  1067. .UX
  1068.  
  1069. and is used by the UUCP program.
  1070.  
  1071. .in -.5i
  1072.  
  1073. .SH
  1074.  
  1075. General
  1076.  
  1077. .PP
  1078.  
  1079. Information flow between a pair of machines
  1080.  
  1081. may be regulated by
  1082.  
  1083. first
  1084.  
  1085. representing the data 
  1086.  
  1087. as sequence-numbered 
  1088.  
  1089. .I
  1090.  
  1091. packets
  1092.  
  1093. .R
  1094.  
  1095. of data 
  1096.  
  1097. and then establishing conventions that
  1098.  
  1099. govern the use of sequence numbers.
  1100.  
  1101. The
  1102.  
  1103. .I
  1104.  
  1105. PK,
  1106.  
  1107. .R
  1108.  
  1109. or
  1110.  
  1111. .I
  1112.  
  1113. packet driver,
  1114.  
  1115. .R
  1116.  
  1117. protocol
  1118.  
  1119. is a particular instance of this type of
  1120.  
  1121. flow-control discipline.
  1122.  
  1123. The technique depends on the notion of a transmission
  1124.  
  1125. .I
  1126.  
  1127. window
  1128.  
  1129. .R
  1130.  
  1131. to determine upper and lower bounds for valid
  1132.  
  1133. sequence numbers.
  1134.  
  1135. The transmitter is allowed to retransmit packets
  1136.  
  1137. having sequence numbers
  1138.  
  1139. within the window until the receiver indicates that
  1140.  
  1141. packets have been correctly received.
  1142.  
  1143. Positive acknowledgement from the receiver moves the
  1144.  
  1145. window;
  1146.  
  1147. negative acknowledgement or no acknowledgement
  1148.  
  1149. causes retransmission.
  1150.  
  1151. The receiver must ignore duplicate transmission, detect
  1152.  
  1153. the various errors that may occur,
  1154.  
  1155. and inform the transmitter when packets are 
  1156.  
  1157. correctly or incorrectly received.
  1158.  
  1159. .PP
  1160.  
  1161. The following paragraphs describe the packet formats,
  1162.  
  1163. message exchanges,
  1164.  
  1165. and framing
  1166.  
  1167. used by the protocol as coded
  1168.  
  1169. in the UUCP program and the
  1170.  
  1171. .UX
  1172.  
  1173. kernel.
  1174.  
  1175. Although no attempt will be made here to present
  1176.  
  1177. internal details of the algorithms that were used,
  1178.  
  1179. the checksum routine is supplied
  1180.  
  1181. for the benefit of other implementors.
  1182.  
  1183. .SH
  1184.  
  1185. Packet Formats
  1186.  
  1187. .PP
  1188.  
  1189. The protocol is defined in terms of message
  1190.  
  1191. transmissions of 8-bit bytes.
  1192.  
  1193. Each message includes one
  1194.  
  1195. .I
  1196.  
  1197. control
  1198.  
  1199. .R
  1200.  
  1201. byte plus a
  1202.  
  1203. .I
  1204.  
  1205. data segment
  1206.  
  1207. .R
  1208.  
  1209. of zero or more information bytes.
  1210.  
  1211. The allowed data segment sizes range
  1212.  
  1213. between 32 and 4096 as determined by the formula
  1214.  
  1215. 32(2\uk\d) where
  1216.  
  1217. k is a 3-bit number.
  1218.  
  1219. The packet sequence numbers are likewise constrained
  1220.  
  1221. to 3-bits; i.e. counting proceeds modulo-8.
  1222.  
  1223. .PP
  1224.  
  1225. The control byte is partitioned into three fields as
  1226.  
  1227. depicted below.
  1228.  
  1229. .bp
  1230.  
  1231. .nf
  1232.  
  1233. .sp 
  1234.  
  1235. .in 1i
  1236.  
  1237. .ls 1
  1238.  
  1239. bit    7    6    5    4    3    2    1    0
  1240.  
  1241.     t    t    x    x    x    y    y    y
  1242.  
  1243. .ls 1
  1244.  
  1245. .in -1i
  1246.  
  1247. .fi
  1248.  
  1249. .sp
  1250.  
  1251. The
  1252.  
  1253. .I
  1254.  
  1255. t
  1256.  
  1257. .R
  1258.  
  1259. bits indicate a packet type and
  1260.  
  1261. determine the interpretation to be placed on
  1262.  
  1263. the
  1264.  
  1265. .I
  1266.  
  1267. xxx
  1268.  
  1269. .R
  1270.  
  1271. and
  1272.  
  1273. .I
  1274.  
  1275. yyy
  1276.  
  1277. .R
  1278.  
  1279. fields.
  1280.  
  1281. The various interpretations are as follows:
  1282.  
  1283. .in +1i
  1284.  
  1285. .sp
  1286.  
  1287. .nf
  1288.  
  1289. .ls 1
  1290.  
  1291. .I
  1292.  
  1293. tt    interpretation
  1294.  
  1295. .sp
  1296.  
  1297. .R
  1298.  
  1299. 00    control packet
  1300.  
  1301. 10    data packet
  1302.  
  1303. 11    `short' data packet
  1304.  
  1305. 01    alternate channel
  1306.  
  1307. .ls 1
  1308.  
  1309. .fi
  1310.  
  1311. .sp
  1312.  
  1313. .in -1i
  1314.  
  1315. A data segment accompanies all non-control packets.
  1316.  
  1317. Each transmitter is constrained to observe the maximum
  1318.  
  1319. data segment size
  1320.  
  1321. established during initial synchronization by the
  1322.  
  1323. receiver that it sends to.
  1324.  
  1325. Type 10 packets have maximal size data segments.
  1326.  
  1327. Type 11, or `short', packets have zero or more data
  1328.  
  1329. bytes but less than the maximum.
  1330.  
  1331. The first one or two bytes of the data segment of a
  1332.  
  1333. short packet are `count' bytes that
  1334.  
  1335. indicate the difference between the
  1336.  
  1337. maximum size and the number of bytes in the short
  1338.  
  1339. segment.
  1340.  
  1341. If the difference is less than 127, one count
  1342.  
  1343. byte is used.
  1344.  
  1345. If the difference exceeds 127,
  1346.  
  1347. then the low-order seven bits of the difference
  1348.  
  1349. are put in the first data byte and the high-order
  1350.  
  1351. bit is set as an indicator that the remaining
  1352.  
  1353. bits of the difference are in the second byte.
  1354.  
  1355. Type 01 packets are never used by UUCP
  1356.  
  1357. and need not be discussed in detail here.
  1358.  
  1359. .PP
  1360.  
  1361. The sequence number of a non-control packet is
  1362.  
  1363. given by the
  1364.  
  1365. .I
  1366.  
  1367. xxx
  1368.  
  1369. .R
  1370.  
  1371. field.
  1372.  
  1373. Control packets are not sequenced.
  1374.  
  1375. The newest sequence number,
  1376.  
  1377. excluding duplicate transmissions,
  1378.  
  1379. accepted by a receiver is placed in the
  1380.  
  1381. .I
  1382.  
  1383. yyy
  1384.  
  1385. .R
  1386.  
  1387. field of non-control packets sent to the
  1388.  
  1389. `other' receiver.
  1390.  
  1391. .PP
  1392.  
  1393. There are no data bytes associated with a control packet,
  1394.  
  1395. the
  1396.  
  1397. .I
  1398.  
  1399. xxx
  1400.  
  1401. .R
  1402.  
  1403. field is interpreted as a control message,
  1404.  
  1405. and the
  1406.  
  1407. .I
  1408.  
  1409. yyy
  1410.  
  1411. .R
  1412.  
  1413. field is a value accompanying the control message.
  1414.  
  1415. The control messages are listed below in decreasing priority.
  1416.  
  1417. That is, if several control messages are to be sent,
  1418.  
  1419. the lower-numbered ones are sent first.
  1420.  
  1421. .in +1i
  1422.  
  1423. .nf
  1424.  
  1425. .ls 1
  1426.  
  1427. .sp
  1428.  
  1429. .I
  1430.  
  1431. xxx    name        yyy
  1432.  
  1433. .R
  1434.  
  1435.  
  1436.  
  1437. 1    CLOSE    n/a
  1438.  
  1439. 2    RJ        last correctly received sequence number
  1440.  
  1441. 3    SRJ        sequence number to retransmit
  1442.  
  1443. 4    RR        last correctly received sequence number
  1444.  
  1445. 5    INITC    window size
  1446.  
  1447. 6    INITB    data segment size
  1448.  
  1449. 7    INITA    window size
  1450.  
  1451. .in -i
  1452.  
  1453. .ls 1
  1454.  
  1455. .fi
  1456.  
  1457. .sp
  1458.  
  1459. .PP
  1460.  
  1461. The CLOSE message indicates that the communications channel
  1462.  
  1463. is to be shut down.
  1464.  
  1465. The RJ, or
  1466.  
  1467. .I
  1468.  
  1469. reject,
  1470.  
  1471. .R
  1472.  
  1473. message indicates that the receiver has detected an error
  1474.  
  1475. and the sender should retransmit after using the 
  1476.  
  1477. .I
  1478.  
  1479. yyy
  1480.  
  1481. .R
  1482.  
  1483. field to update the window.
  1484.  
  1485. This mode of retransmission is usually
  1486.  
  1487. referred to as a
  1488.  
  1489. `go-back-N' procedure.
  1490.  
  1491. The SRJ, or
  1492.  
  1493. .I
  1494.  
  1495. selective reject,
  1496.  
  1497. .R
  1498.  
  1499. message carries with it the sequence number of
  1500.  
  1501. a particular packet to be retransmitted.
  1502.  
  1503. The RR, or
  1504.  
  1505. .I
  1506.  
  1507. receiver ready,
  1508.  
  1509. .R
  1510.  
  1511. message indicates that the receiver has detected
  1512.  
  1513. no errors; the
  1514.  
  1515. .I
  1516.  
  1517. yyy
  1518.  
  1519. .R
  1520.  
  1521. field updates the sender's window.
  1522.  
  1523. The INITA/B/C messages are used
  1524.  
  1525. to set window and data segment sizes.
  1526.  
  1527. Segment sizes are calculated by the formula
  1528.  
  1529. 32(2\uyyy\d)
  1530.  
  1531. as mentioned above,
  1532.  
  1533. and window sizes may range between 1 and 7.
  1534.  
  1535. .PP
  1536.  
  1537. Measurements of the protocol running on communication
  1538.  
  1539. links at rates up to 9600 baud showed that
  1540.  
  1541. a window size of 2 is optimal
  1542.  
  1543. given a packet size greater than 32 bytes.
  1544.  
  1545. This means that the link bandwidth can be fully utilized
  1546.  
  1547. by the software.
  1548.  
  1549. For this reason the SRJ message is not as important as it
  1550.  
  1551. might otherwise be.
  1552.  
  1553. Therefore the
  1554.  
  1555. .UX
  1556.  
  1557. implementations no longer generate or respond to SRJ
  1558.  
  1559. messages.
  1560.  
  1561. It is mentioned here for historical accuracy only,
  1562.  
  1563. and one may assume that SRJ is no longer part of the protocol.
  1564.  
  1565. .SH
  1566.  
  1567. Message Exchanges
  1568.  
  1569. .SH
  1570.  
  1571.     Initialization
  1572.  
  1573. .PP
  1574.  
  1575. Messages are exchanged between four cooperating
  1576.  
  1577. entities: two senders and two receivers.
  1578.  
  1579. This means that the communication channel is thought of
  1580.  
  1581. as two independent half-duplex data paths.
  1582.  
  1583. For example the window and segment sizes need not
  1584.  
  1585. be the same in each direction.
  1586.  
  1587. .PP
  1588.  
  1589. Initial synchronization is accomplished
  1590.  
  1591. with two 3-way handshakes: two each of
  1592.  
  1593. INITA/INITB/INITC.
  1594.  
  1595. Each sender transmits INITA messages repeatedly.
  1596.  
  1597. When an INITA message is received, INITB is
  1598.  
  1599. sent in return.
  1600.  
  1601. When an INITB message is received
  1602.  
  1603. .I
  1604.  
  1605. and
  1606.  
  1607. .R
  1608.  
  1609. an INITB message has been sent,
  1610.  
  1611. an INITC message is sent.
  1612.  
  1613. The INITA and INITB messages carry 
  1614.  
  1615. with them the packet and window size that
  1616.  
  1617. each receiver wants to use,
  1618.  
  1619. and the senders are supposed to comply.
  1620.  
  1621. When a receiver has seen all three
  1622.  
  1623. INIT messages, the channel is 
  1624.  
  1625. considered to be open.
  1626.  
  1627. .PP
  1628.  
  1629. It is possible to design a protocol that starts up using
  1630.  
  1631. fewer messages than the interlocked handshakes described above.
  1632.  
  1633. The advantage of the more complicated design lies in its use as
  1634.  
  1635. a research vehicle:
  1636.  
  1637. the initial handshake sequence is completely symmetric,
  1638.  
  1639. a handshake
  1640.  
  1641. can be initiated by one side of the link while the
  1642.  
  1643. connection is in use, and the software to do this can
  1644.  
  1645. utilize code that would ordinarily be used only once
  1646.  
  1647. at connection setup time.
  1648.  
  1649. These properties were used in experiments with dynamically
  1650.  
  1651. adjusted parameters.
  1652.  
  1653. That is attempts were made to adapt the window and segment
  1654.  
  1655. sizes to changes observed in traffic while a link was in use.
  1656.  
  1657. Other experiments used the initial
  1658.  
  1659. handshake  in a different way
  1660.  
  1661. for restarting the protocol without data loss
  1662.  
  1663. after machine crashes.
  1664.  
  1665. These experiments never worked well in the packet driver and
  1666.  
  1667. basically provided the impetus for other protocol designs.
  1668.  
  1669. The result 
  1670.  
  1671. as far as UUCP is concerned is that initial synchronization
  1672.  
  1673. uses the two 3-way handshakes, and the INIT
  1674.  
  1675. messages are ignored elsewhere.
  1676.  
  1677. .SH
  1678.  
  1679.     Data Transport
  1680.  
  1681. .PP
  1682.  
  1683. After initial synchronization each receiver
  1684.  
  1685. sets a modulo-8 incrementing counter R to 0;
  1686.  
  1687. each sender sets a similar counter S to 1.
  1688.  
  1689. The value of R is always the number of the most recent
  1690.  
  1691. correctly received packet.
  1692.  
  1693. The value of S is always the first sequence number in
  1694.  
  1695. the output window.
  1696.  
  1697. Let W denote window size.
  1698.  
  1699. Note that the value of W may be different for each sender.
  1700.  
  1701. .PP
  1702.  
  1703. A sender may transmit packets with sequence numbers
  1704.  
  1705. in the range S to (S+W-1)\ mod-8.
  1706.  
  1707. At any particular time a receiver expects
  1708.  
  1709. arriving packets to have numbers in the range
  1710.  
  1711. (R+1)\ mod-8 to (R+W)\ mod-8.
  1712.  
  1713. Packets must arrive in sequence number order
  1714.  
  1715. are are only acknowledged in order.
  1716.  
  1717. That is,
  1718.  
  1719. the `next' packet a receiver
  1720.  
  1721. will acknowledge must have
  1722.  
  1723. sequence number (R+1)\ mod-8.
  1724.  
  1725. .PP
  1726.  
  1727. A receiver acknowledges receipt of data packets
  1728.  
  1729. by arranging for the value of its R counter to be
  1730.  
  1731. sent across the channel
  1732.  
  1733. where it will be used to update an S counter.
  1734.  
  1735. This is done in two ways.
  1736.  
  1737. If data is flowing in both directions across a
  1738.  
  1739. channel then each receiver's current R value is
  1740.  
  1741. carried in the
  1742.  
  1743. .I
  1744.  
  1745. yyy
  1746.  
  1747. .R
  1748.  
  1749. field of non-control packets.
  1750.  
  1751. Otherwise when there is no bidirectional
  1752.  
  1753. data flow,
  1754.  
  1755. each receiver's R value is transmitted across the link
  1756.  
  1757. as the
  1758.  
  1759. .I
  1760.  
  1761. yyy
  1762.  
  1763. .R
  1764.  
  1765. field of an RR control packet.
  1766.  
  1767. .PP
  1768.  
  1769. Error handling is up to the discretion
  1770.  
  1771. of the receiver.
  1772.  
  1773. It can ignore all errors in which case
  1774.  
  1775. transmitter timeouts must provide for
  1776.  
  1777. retransmission.
  1778.  
  1779. The receiver may also generate RJ 
  1780.  
  1781. error control packets.
  1782.  
  1783. The
  1784.  
  1785. .I
  1786.  
  1787. yyy
  1788.  
  1789. .R
  1790.  
  1791. field of an incoming RJ message replaces
  1792.  
  1793. the S value of the local sender and
  1794.  
  1795. constitutes a request for retransmission to start
  1796.  
  1797. at that sequence number.
  1798.  
  1799. The
  1800.  
  1801. .I
  1802.  
  1803. yyy
  1804.  
  1805. .R
  1806.  
  1807. field of an incoming SRJ message selects a particular
  1808.  
  1809. packet for retransmission.
  1810.  
  1811. .PP
  1812.  
  1813. The resemblance between the flow control procedure in the
  1814.  
  1815. packet driver and that defined for X.25 is no accident.
  1816.  
  1817. The packet driver protocol began life as an attempt at
  1818.  
  1819. cleaning up X.25.
  1820.  
  1821. That is why, for example,
  1822.  
  1823. control information is uniform in length (one byte),
  1824.  
  1825. there is no RNR message (not needed),
  1826.  
  1827. and there is but one timeout defined
  1828.  
  1829. in the sender.
  1830.  
  1831. .SH
  1832.  
  1833.     Termination
  1834.  
  1835. .PP
  1836.  
  1837. The CLOSE message is used to terminate communications.
  1838.  
  1839. Software on either or both ends of the communication
  1840.  
  1841. channel may initiate termination.
  1842.  
  1843. In any case when one end wants to terminate it sends
  1844.  
  1845. CLOSE messages until one is received from the other end
  1846.  
  1847. or until a programmable limit on the number of CLOSE
  1848.  
  1849. messages is reached.
  1850.  
  1851. Receipt of a CLOSE message causes a CLOSE message to be sent.
  1852.  
  1853. In the 
  1854.  
  1855. .UX
  1856.  
  1857. environment
  1858.  
  1859. it also causes the SIGPIPE or
  1860.  
  1861. `broken pipe' signal to be sent to
  1862.  
  1863. the local process using the communication channel.
  1864.  
  1865. .SH
  1866.  
  1867.     Framing
  1868.  
  1869. .PP
  1870.  
  1871. The term
  1872.  
  1873. .I
  1874.  
  1875. framing
  1876.  
  1877. .R
  1878.  
  1879. is used to denote the technique by which the
  1880.  
  1881. beginning and end of a message is detected
  1882.  
  1883. in a byte stream;
  1884.  
  1885. .I
  1886.  
  1887. error control
  1888.  
  1889. .R
  1890.  
  1891. denotes the method by which transmission
  1892.  
  1893. errors are detected.
  1894.  
  1895. Strategies for framing and error control depend
  1896.  
  1897. upon
  1898.  
  1899. additional information being transmitted along
  1900.  
  1901. with the control byte and data segment,
  1902.  
  1903. and the choice of a particular strategy usually
  1904.  
  1905. depends on characteristics of input/output
  1906.  
  1907. devices and transmission media.
  1908.  
  1909. .PP
  1910.  
  1911. Several framing techniques are in used in support
  1912.  
  1913. of PK protocol implementations,
  1914.  
  1915. not all of which can be described in detail here.
  1916.  
  1917. The technique used on asynchronous serial lines
  1918.  
  1919. will be described.
  1920.  
  1921. .PP
  1922.  
  1923. A six byte
  1924.  
  1925. framing
  1926.  
  1927. .I
  1928.  
  1929. envelope
  1930.  
  1931. .R
  1932.  
  1933. is constructed using the control byte
  1934.  
  1935. C of a packet and five other bytes as
  1936.  
  1937. depicted below.
  1938.  
  1939. .in +1i
  1940.  
  1941. <DLE><k><c0><c1><C><x>
  1942.  
  1943. .in -1i
  1944.  
  1945. The <DLE> symbol denotes the ASCII ctrl/P character.
  1946.  
  1947. If the envelope is to be followed by a data segment,
  1948.  
  1949. <k> has the value
  1950.  
  1951. log\d2\u(size)-4;
  1952.  
  1953. i.e. 1 \(<= k \(<= 8.
  1954.  
  1955. If k is 9, then the envelope represents a control packet.
  1956.  
  1957. The <c0> and <c1> bytes are the low-order and high-order
  1958.  
  1959. bytes respectively of a 16-bit checksum of the data segment,
  1960.  
  1961. if there is one.
  1962.  
  1963. For control packets <c1> is zero and <c0> is the same
  1964.  
  1965. as the control byte C.
  1966.  
  1967. The <x> byte is the exclusive-or of <k><c0><c1><C>.
  1968.  
  1969. Error control is accomplished by checking 
  1970.  
  1971. a received framing envelope for compliance with the definition,
  1972.  
  1973. and comparing a checksum function of the data segment
  1974.  
  1975. with <c0><c1>.
  1976.  
  1977. .PP
  1978.  
  1979. This particular framing strategy assumes data segments
  1980.  
  1981. are constant-sized:
  1982.  
  1983. the `unused' bytes in a short packet are actually
  1984.  
  1985. transmitted.
  1986.  
  1987. This creates a certain amount of overhead which
  1988.  
  1989. can be eliminated by a more complicated framing technique.
  1990.  
  1991. The advantage of this strategy is that i/o
  1992.  
  1993. devices can be programmed to take advantage of the
  1994.  
  1995. constant-sized framing envelopes and data segments.
  1996.  
  1997. .bp
  1998.  
  1999. .PP
  2000.  
  2001. The checksum calculation is displayed below as a C function.
  2002.  
  2003. Note that the code is not truly portable because
  2004.  
  2005. the definitions of
  2006.  
  2007. .I short
  2008.  
  2009. and
  2010.  
  2011. .I char
  2012.  
  2013. are not necessarily uniform across all machines
  2014.  
  2015. that might support this language.
  2016.  
  2017. This code assumes that
  2018.  
  2019. .I short
  2020.  
  2021. and
  2022.  
  2023. .I char
  2024.  
  2025. are 16 and 8-bits respectively.
  2026.  
  2027. .PP
  2028.  
  2029. .in +.5i
  2030.  
  2031. .nf
  2032.  
  2033. .ft CW
  2034.  
  2035. .ls 1
  2036.  
  2037. /* [Original document's version corrected to actual version] */
  2038.  
  2039. chksum(s,n)
  2040.  
  2041. register char *s;
  2042.  
  2043. register n;
  2044.  
  2045. {
  2046.  
  2047.     register short sum;
  2048.  
  2049.     register unsigned short t;
  2050.  
  2051.     register short x;
  2052.  
  2053.  
  2054.  
  2055.     sum = -1;
  2056.  
  2057.     x = 0;
  2058.  
  2059.  
  2060.  
  2061.     do {
  2062.  
  2063.         if (sum<0) {
  2064.  
  2065.             sum <<= 1;
  2066.  
  2067.             sum++;
  2068.  
  2069.         } else
  2070.  
  2071.             sum <<= 1;
  2072.  
  2073.         t = sum;
  2074.  
  2075.         sum += (unsigned)*s++ & 0377;
  2076.  
  2077.         x += sum^n;
  2078.  
  2079.         if ((unsigned short)sum <= t) {
  2080.  
  2081.             sum ^= x;
  2082.  
  2083.         }
  2084.  
  2085.     } while (--n > 0);
  2086.  
  2087.  
  2088.  
  2089.     return(sum);
  2090.  
  2091. }
  2092.  
  2093. .fi
  2094.  
  2095. .in -.5i
  2096.  
  2097. .ft R
  2098.  
  2099. -- 
  2100.  
  2101. John Gilmore  {sun,ptsfa,lll-crg,ihnp4}!hoptoad!gnu   gnu@ingres.berkeley.edu
  2102.  
  2103. Love your country but never trust its government.
  2104.  
  2105.              -- from a hand-painted road sign in central Pennsylvania
  2106.  
  2107.  
  2108. (>
  2109.