home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / protocol / pepmnt.nov1997things.txt < prev    next >
Text File  |  2020-01-01  |  17KB  |  378 lines

  1. 25-Nov-97 23:13:44-GMT,17151;000000000005
  2. Return-Path: <JCHBN@CUVMB.CC.COLUMBIA.EDU>
  3. Received: from CUVMB.CC.COLUMBIA.EDU (cuvmb.cc.columbia.edu [128.59.40.129])
  4.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with SMTP id SAA26165
  5.     for <fdc@watsun.CC.COLUMBIA.EDU>; Tue, 25 Nov 1997 18:13:44 -0500 (EST)
  6. Received: from CUVMB.CC.COLUMBIA.EDU by CUVMB.CC.COLUMBIA.EDU (IBM VM SMTP V2R1)
  7.    with BSMTP id 8461; Tue, 25 Nov 97 18:14:36 EST
  8. Date: Tue, 25 Nov 1997   18:13 EST
  9. From: "John F. Chandler"   <JCHBN@CUVMB.CC.COLUMBIA.EDU>
  10. To: Frank da Cruz   <fdc@watsun.CC.COLUMBIA.EDU>
  11. Subject: Re: New stuff draft 2
  12. In-reply-to: fdc@watsun.cc.columbia.edu message
  13.    <CMM.0.90.4.878519477.fdc@watsun.cc.columbia.edu> of Sun, 2 Nov 97 20:11:17
  14.    EST
  15. Message-id: <JCHBN.971125.181315.RC0@CUVMB.CC.COLUMBIA.EDU>
  16.  
  17. Frank,
  18.    Here are some reactions, prefixed with ">>>".
  19.  
  20.                                             John
  21. ---------
  22. SOME MINOR ADDITIONS TO THE KERMIT PROTOCOL
  23.  
  24.   D R A F T  #  2
  25.   Sun Nov  2 13:49:46 1997
  26.  
  27. 1. DIRECTORY OPERATIONS
  28.  
  29. The aim of these changes is to allow the exchange of directory trees or file
  30. systems.  It is assumed that all file systems are either tree-structured or
  31. flat.  Hardly any protocol changes are needed, mainly just agreements on data
  32. formats.  Most of the features are implemented outside the protocol: recursive
  33. SEND commands, automatic directory creation during RECEIVE commands, etc.
  34.  
  35. 1.0. Directory Name Format Selection
  36.  
  37. (This is simplified considerably in Draft 2 after I implemented it in C-K...)
  38.  
  39. SET FILE NAMES { CONVERTED, LITERAL }
  40.   Now applies to pathnames too.  For pathnames, CONVERTED means that the
  41.   native directory notation is converted to standard format when sending,
  42.   and the standard format is assumed when receiving.
  43.  
  44. The related command:
  45.  
  46.   SET { SEND, RECEIVE } PATHNAMES { OFF, ABSOLUTE, RELATIVE }
  47.  
  48. then applies as usual.  PATHNAMES are OFF by default, in which case nothing is
  49. different.  When SEND PATHNAMES is ABSOLUTE or RELATIVE, then the FILE NAMES
  50. setting is applied to them just as it is to the rest of the filename.
  51.  
  52. When receiving files, a Kermit program should be expected to understand its
  53. own native format and the native one; it cannot be expected to understand a
  54. foreign directory notation.  Thus SET FILE NAMES CONVERTED should be used
  55. between unlike systems.
  56.  
  57. Note: There is no reason why there can't be separate SET FILE NAMES commands
  58. and settings for each direction.
  59.  
  60. Note 2: We haven't said anything that affects the protocol yet, that comes
  61. in the next section.
  62.  
  63. 1.1. Kermit Protocol Directory Name Representation
  64.  
  65. UNIX notation shall be used for directories when FILE NAMES are CONVERTED.
  66. Forward slash (/) is the directory separator.  If a / appears as a literal
  67. character in a directory name, then it should be written as //.  A file or
  68. directory specification beginning with / is absolute, otherise it is relative.
  69. This is more or less the same scheme used by Info-ZIP and so it is widely
  70. proven in the real world.
  71.  
  72. Note: I have this working now in VMS as well as UNIX, but so far just in
  73. the sender -- will do the receiver tomorrow I hope.  Example from today's
  74. actual logs:
  75.  
  76. FILENAMES   SEND PATHNAMES  UNIX Result               VMS Result
  77.  CONVERTED   OFF             OOFA.TXT                  OOFA.TXT
  78.  CONVERTED   RELATIVE        BLAH/OOFA.TXT             BLAH/OOFA.TXT
  79.  CONVERTED   ABSOLUTE        /W/FDC/TMP/BLAH/OOFA.TXT  /FDC/BLAH/OOFA.TXT
  80.  LITERAL     OFF             oofa.txt                  OOFA.TXT
  81.  LITERAL     RELATIVE        blah/oofa.txt             [.BLAH]OOFA.TXT
  82.  LITERAL     ABSOLUTE        /w/fdc/tmp/blah/oofa.txt  [FDC.BLAH]OOFA.TXT
  83.  
  84. 1.2. Client/Server Directory Operations
  85.  
  86. REMOTE MKDIR <name>
  87.   G packet function code "m" (yes, lowercase).  Creates the specified
  88.   directory.  Names are as in 1.1 (absolute or relative).
  89.  
  90. REMOTE RMDIR <name>
  91.   G packet function code "r".  Removes specified directory.  Name can
  92.   be wild.
  93.  
  94. REMOTE RMDIR /RECURSIVE <name>
  95.   G packet function code "s".  Removes specified directory tree and all
  96.   its contents.  Like rm -Rf in UNIX.  Name can be wild.
  97.  
  98. 1.3. GET /RECURSIVE
  99.  
  100. New packet types:
  101.  
  102. V for GET /RECURSIVE.
  103.   Tells server to send all files that match the given specification in
  104.   the current or given directory tree.  Otherwise just like G for GET.
  105.  
  106. W for GET /DELETE /RECURSIVE.
  107.   Like V, but the server should delete each file after it is sent
  108.   successfully.
  109.  
  110. That should do it.
  111.  
  112. 2. 32-BIT CRC
  113.  
  114. We might as well, why not.  The code for the CHKT field in the init string
  115. is "4".  32-bit CRC must not be implemented in the absence of 16-bit CRC.  A
  116. special rule applies here, namely if one Kermit says "4" and the other says
  117. "3", then fall back to "3" instead of "1".  The generating polynomial is:
  118. >>> Can't do that because it violates existing protocol.  If the other
  119. >>> Kermit says "3" and doesn't know about "4", it falls back to "1", so
  120. >>> we must do the same.
  121.   X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0
  122.  
  123. taken "backwards" with the highest-order term in the lowest-order bit.  The
  124. X^32 term is "implied"; the LSB is the X^31 term, etc.  The X^0 term (usually
  125. shown as "+1") results in the MSB being 1.  Code will be based on the well
  126. known and open Gary Brown code that everybody else uses.
  127.  
  128. Unlike the type 1, 2, and 3 block checks, the 32-bit one should be encoded
  129. to never contain a blank.  We can either use the same encoding as for the
  130. 16-bit CRC but excess-33 instead of -32 (resulting in 6 bytes), or we can
  131. write it more compactly as a base-94 number whose lowest digit is "!".  (How
  132. many bytes is that?)
  133. >>> five -- could use "5" as the code instead of "4"??
  134. (Joe notes that there might not be much value here, but we have learned that
  135. trying to persuade the masses that the reason we don't have such-and-such a
  136. feature that the others (read "Zmodem") have by filling blackboards full of
  137. math never works -- better to just go along...  Anyway, this is just for the
  138. protocol definition, not necessarily to be implemented anywhere, and certainly
  139. not *required* anywhere.)
  140.  
  141. 3. EX-POST-FACTO PER-FILE CRC CHECKING
  142.  
  143. MS-DOS Kermit and C-Kermit can accumulate a 16-bit CRC of an entire
  144. transaction, and they include a rather cumbersome process for comparing the
  145. CRCs afterward, which works only in a client/server setting, and is script
  146. based:
  147.  
  148.   <file-transfer-command>
  149.   if fail <do something>
  150.   remote query kermit crc16
  151.   if not = \v(query) \v(crc16) <we got trouble>
  152.  
  153. Obviously this can be expected to succeed only for binary-mode transfers,
  154. and so scripts that use this technique will break in text mode.
  155.  
  156. A more general mechanism can be added to the protocol itself as follows:
  157.  
  158.  a. Add a new S/I packet parameter, after the last one that is defined,
  159.     whatever that is (don't worry, I'll look it up).  A single byte, this
  160.     character has the same values as the Block Check parameter, except only
  161.     "3" or "4" should be allowed.
  162.  
  163.  b. Add SET commands to turn the feature ON and OFF.  It should be OFF by
  164.     default, to avoid the extra overhead.
  165.  
  166.  c. When ON, it should be operative only for binary-mode transfers.
  167. >>> Why can't this be applied to the "canonical" text form?  I.e., after
  168. >>> line delimiters have been converted to CRLF (if necessary) and the
  169. >>> text has been translated to the transfer character set, but before
  170. >>> control-quoting and repeat-count compression, etc.
  171.  
  172.  d. At the end of file, the file sender puts the following in the Z-packet
  173.     data field: The letter C and then the decimal character representation of
  174.     the negotiated type of CRC for the file.
  175. >>> Didn't you say the MSB will always be on?  If so, then the decimal
  176. >>> representation will depend on whether you understand the value to be
  177. >>> signed 32-bit or unsigned 32-bit.  Why not just encode the value in
  178. >>> the same way as for packet checksums?
  179.  
  180.  e. If the CRC from (d) does not agree with the receiver's CRC, the receiver
  181.     ACKs the Z packet with a Data field of N, optionally followed by its own
  182.     CRC, otherwise it ACKs with either an empty data field or the letter C
  183.     followed by the CRC (exactly as in the Z packet).  It is up to the
  184.     receiver how to dispose of the file when the CRCs don't match.
  185.  
  186.  f. When the sender receives a CRC mismatch indication, the SEND command must
  187.     fail.  But what does this mean when a file group is being sent?  Should it
  188.     stop and send an error packet or go on to the next file?  This must be a
  189.     user choice, so there will need to be some SET commands...  In any case,
  190.     if it is a SEND /DELETE (aka MOVE) operation, then the source file must
  191.     not be deleted.  Appropriate notations must be made in the transaction
  192.     log, if any, etc.
  193.  
  194. The per-file CRC mechanism operates independently of the \v(crc16) variable,
  195. which accumulates a CRC over the entire transfer, which could obviously become
  196. bollixed if a mixture of text and binary files were transferred in the same
  197. transaction, as can occur with VMS C-Kermit.
  198.  
  199. 4. The Capabilities Mask
  200.  
  201. We're out of bits, except for the "continued" bit.  But if we use the
  202. continuation mechanism, we'll no doubt break every non-Kermit-Project Kermit
  203. implementation on earth, and probably also many of the old ones in our own
  204. collection.  So to add more capability bits, we'll need to leave the
  205. "continued" bit blank, and add the second capabilities mask at the end.
  206.  
  207. 5. Info Exchange
  208.  
  209. The idea is for the two Kermits to exchange information with each other that
  210. applies to the transaction as a whole, but is beyond the scope of (too
  211. voluminous for) the S/Y or I/Y exchange.
  212.  
  213.   a. Add a new capability bit for this.
  214.   b. The file sender sets this bit in its S packet.
  215.   c. The file receiver agrees by setting the same bit in its ACK(S).
  216.  
  217. At this point, if the two Kermits have agreed, the sender may (but need not)
  218. send an "L" packet, which contains an unencoded parameter-length-value (PLV)
  219. sequence (just like an "A" packet) of information applying to the connection
  220. and the entire transfer.  Parameters (all are optional):
  221.  
  222.   F = (Sender only) Number of files (expressed as decimal string)
  223.  
  224.   L = (Sender only) Total length, decimal string.  Obviously iffy for
  225.       text-mode transfers, but we've always had that problem.
  226.  
  227.   E = Encoding: Kermit transfer character-set designation for text used in
  228.       any of these fields that can contain arbitrary text.  Default = ASCII.
  229.       Syntax: exactly as in A packet.
  230.  
  231.   H = Hostname (e.g. so local Kermit can show remote host's name on the
  232.       file transfer display).
  233.  
  234.   D = Current directory, syntax according to SET FILE NAMES.
  235.  
  236.   O = Organization name.  Arbitrary text, encoding specified in E.
  237.  
  238.   C = Country code (ISO 3166).
  239.  
  240.   T = Connection type (to allow automatic choices of various things based
  241.       on whether the connection is known to be reliable -- e.g. TCP/IP at
  242.       *both* ends).  Number.  0 = unknown (usually the case when in remote
  243.       mode); 1 = serial port; 2 = ISDN; 3 = TCP; 4 = UDP; 5 = CTERM; 6 = LAT;
  244.       etc etc.
  245.  
  246.   A = Address.  Interpreted according to connection type.  This can be the IP
  247.       hostname, IP address, or other address specific to the network type, or
  248.       telephone phone number in +1(212)7654321 format, for display on the
  249.       other Kermit's screen, or logging, or callback, or any other desired
  250.       reason.  All sorts of uses for this one can be imagined.
  251.  
  252.   Z = Timezone.  There is some standard for this.  Can be used to adjust
  253.       A-packet date/times, which are always in local time.  Applies only to
  254.       terrestrial transfers.
  255. >>> Can't use the current time zone to adjust the date/time of files
  256. >>> previously created -- the daylight/standard switching mechanism is
  257. >>> not universal.  Also, the time stamp on a file may or may not be
  258. >>> set in local time.  Some installations choose to run on UT!  Further,
  259. >>> the time stamp on a file doesn't reflect the time zone that was
  260. >>> in effect when the file was created.  If the system manager decides
  261. >>> it was stupid to run on UT, and switches over to local standard time,
  262. >>> there's no "paper trail".
  263.  
  264.   X = Encryption identifier (this needs spelling out).
  265.  
  266.   K = Public key for X, when applicable.
  267.  
  268.   N = (Receiver only): No.  Refuses the transaction.  Optionally one or more
  269.       more parameter letters are given as data, to indicate the reason for
  270.       refusal.
  271.  
  272.   etc etc...
  273.  
  274. The order doesn't matter, except that if E is given, it must precede any
  275. arbitrary-text fields.  We can have up to 96 parameters, one for each 7-bit
  276. graphic character.  One must be reserved as an escape for when we run out.
  277.  
  278. NOTE: "L" was our last unused uppercase letter for packet types.  Additional
  279. packet types will be lowercase letters or other graphic characters.  At least
  280. one must be reserved as an escape for when we run out.
  281.  
  282. 6. Extended Sequence Numbers and Window Size
  283.  
  284. 32 just isn't big enough, e.g. for interplanetary transfers, not to mention
  285. the Internet some days.  But we can't increase it beyond 32 because it is
  286. limited to the half the sequence-number range.  Thus for larger windows we
  287. must increse the sequence number space.  But we can't do this in the regular
  288. sequence number field, at least not significantly, because it is restricted
  289. to a 64-byte codeset (in theory maybe 94, but that too would require a change
  290. in the protocol, and as long as we're changing it, let's shoot higher).
  291.  
  292. 6.1. Negotiation
  293.  
  294.   a. Add a new capability bit for this.
  295.   b. The file sender sets this bit in its S packet.
  296.   c. The file receiver agrees by setting the same bit in its ACK(S).
  297.   d. Add another 2-byte field to the init string, XWINDO.
  298.  
  299. This works exactly like long packet negotiation.  If the bit is set then we
  300. fetch the actual window size from the two XWINDO bytes, which are in excess-32
  301. base 95 notation, just like the extended packet length.  The receiver that
  302. doesn't understand this option, of course, fetches the window size from the
  303. regular WINDO field.  The maximum extended window size is:
  304.  
  305.   95^2 - 1 = 9024 / 2 = 4512
  306.  
  307. 6.2. Packet Format
  308.  
  309. When an extended window size is negotiated, the packet sequence number is
  310. indicated as ` (backquote, ASCII 96) to indicate that the full 2-byte base-95
  311. packet number is included in the extended header.  For long packets, this goes
  312. between the length and the header checksum.  For short packets, it forms the
  313. extended header by itself (plus a checksum).
  314. >>> This applies only to D packets, right?
  315.  
  316. The maximum extended sequence number is thus 95^2 - 1 = 9024, and the maximum
  317. window size is half that, or 4512.  A 4512-packet window of 9024-byte packets
  318. (the theoretical maximum) would require about 7MB of packet buffers.
  319. Obviously a smaller actual maximum can be imposed by the implementation.
  320.  
  321. 6.3. Improved Packet Framing
  322.  
  323.   This is changed from yesterday -- now it's imply folded in with the
  324.   new packet format.
  325.  
  326. There is nothing in a basic Kermit packet to indicate where the data ends and
  327. the block check begins.  But we have the opportunity in extended-sequence
  328. packets to use a better format.  In these packets, the packet length indicates
  329. the beginning of a PLV format block check.  Parameters are the block-check
  330. codes (1, 2, 3, B, 4).  The length indicates the number of bytes in the block
  331. check.  Then the block check.  In addition to preventing foulups, this allows
  332. the block check type to be varied dynamically throughout the transaction.  It
  333. >>> Why would we want to do that???
  334. also allows a graphic character to be placed after the block check in case it
  335. ends with a blank.
  336. >>> In practice, we can do that already.
  337.  
  338. 7. Supervisory Packets
  339.  
  340. These can be used for "out of band" functions.  Supervisory packets must be
  341. numbered, just like regular ones, because otherwise there is no way for the
  342. receiver to indicate that it was or wasn't received.
  343. >>> Is this going to play havoc with sliding windows?  E.g., changing
  344. >>> the packet size upon request of the receiver would logically
  345. >>> demand that the packets already in transit be "flushed" somehow.
  346. >>> Ouch!
  347.  
  348. Let's call this a "u" packet.  It can be sent only by the file sender, and
  349. it can be sent at any time during a transaction if negotiated:
  350.  
  351.   a. Add a new capability bit for this.
  352.   b. The file sender sets this bit in its S packet.
  353.   c. The file receiver agrees by setting the same bit in its ACK(S).
  354.  
  355. Contents are, again, the familiar PLV sequences.  Some possible parameters:
  356.  
  357.   M = Message.  To be logged or shown in the display.
  358.   W = Change window size
  359.   P = Change packet length
  360.   R = Reset to defaults
  361.   S = Sync
  362.   D = Drain
  363.   B = Buffer credit
  364.  
  365. (I'm not really sure yet whether any of these make sense, or what they would
  366. do, or how they would work, or what else we can do here, so this is mainly
  367. just a placeholder.)
  368.  
  369. The sender ACKs with the normal indications (Y or N, length, list of tags).
  370.  
  371. If the file receiver wants to send a supervisory message, it can be placed
  372. into the data field of any D-packet ACK: the letter "u" followed by PLV
  373. sequences (we can't put these in *any* ACK because some already are allowed to
  374. contain arbitrary string data, e.g. ACK(F), tsk tsk).  The file sender
  375. "acknowledges" by sending a "u" packet, which must then be ACK'd by the
  376. receiver with an empty ACK.
  377.  
  378.