home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / pdp11 / k11f85.txt < prev    next >
Text File  |  2020-01-01  |  20KB  |  426 lines

  1.  
  2.  
  3.  
  4.   Kermit - A Protocol for Painless Micro and Mini File Transfer
  5.  
  6.  
  7.  
  8.  
  9.                            Brian Nelson
  10.                         Computer Services
  11.                        University of Toledo
  12.                         2801 West Bancroft
  13.                         Toledo, Ohio 43606
  14.  
  15.  
  16.  
  17. Abstract
  18.  
  19. This article will describe  the  Kermit  file  transfer  protocol.
  20. This  protocol allows many (if not most) types of computer systems
  21. to effect, at minimum, error free file transfer with other systems
  22. and microcomputers over asynchronous lines.
  23.  
  24. Introduction
  25.  
  26. With the widespread use of personal computers the  need  for  file
  27. exchange  between  systems  has  become  of foremost concern among
  28. users and managers alike.   There  are  many  commercial  products
  29. available  which  meet  this  need,  some  of which may offer more
  30. advanced  functions  such  as  transparent  record  oriented  file
  31. access.   Networks that do this, such as DECnet, can be expensive,
  32. and if your computer or microcomputer is not on the  network  your
  33. needs  won't  be  met.  Transfer of files with removable disks can
  34. work, but generally only when the computers are of the same  type,
  35. it's  not  very  useful  when the systems are removed in location.
  36. Rarely will  a  larger  mini  or  supermini  be  able  to  read  a
  37. microcomputer's disk.
  38.  
  39. A more realistic approach, from both cost and convenience,  is  to
  40. find  a way to use ordinary telecommunications and/or in-house PBX
  41. systems to connect computers and microcomputers  together.   If  a
  42. local connection using a PBX or front end switch is not available,
  43. there is always dialup access with standard 103/212 modems.   Data
  44. can be transferred with very simple methods, such as TYPING a file
  45. on one system and capturing it on the other system, but this gives
  46. no protection from noise and overrun of data.  It is not very user
  47. friendly  either.   What  is  really  needed  is  a  protocol   to
  48. accomplish file transfer reliably and efficiently.
  49.  
  50. The first obvious use of  any  program  or  protocol  designed  to
  51. accomplish  file  transfer is to be able to provide the ability to
  52. support file uploads and downloads from minis and superminis  such
  53. as the VAX and PDP-11 to remote personal computers, such as the PC
  54. and  Rainbow.   It  should  also  be  widely  available  for  many
  55. different  micros  and  mainframes.   File  transfer from micro to
  56. micro, as well as from a larger central host, should be  possible.
  57. The  command  interface  should  be  easy to learn, and require no
  58. intervention from a central site operator or other user.  The many
  59.  
  60.                                                                 Page 2
  61.  
  62.  
  63. implementations  of  Kermit  follow  these lines, and all versions
  64. allow some form of transfer in either  direction.   More  advanced
  65. versions,  such  as  those  found on the PDP-11, DEC10/20 and VAX,
  66. offer what is known as server operation, which  allow  the  remote
  67. (connected) Kermit system to completely control the file exchanges
  68. from their system.  Since as of this  writing  (October  9,  1985)
  69. there  are  available  over  160  versions of Kermit available for
  70. numerous  micro,  mini  and   mainframe   configurations,   Kermit
  71. addresses this need quite well.
  72.  
  73. While the primary use of Kermit will likely  be  to  support  file
  74. transfer   from  microcomputer  to  mini/supermini  and  mainframe
  75. connections, there are many uses for Kermit for  connections  from
  76. mini  to  mini  and  so  on.   The author routinely use Kermit for
  77. transfering software developed for the PRO/350 on a RSTS/E  11/23+
  78. and a VAX 11/785, as well as using the PDP and VAX for dialing out
  79. to other systems around the country (not to  mention  VAX  to  PDP
  80. directly though a front end port selector).
  81.  
  82. The Kermit protocol
  83.  
  84. The  Kermit  protocol  is  designed   to   operate   over   normal
  85. asynchronous   terminal   lines.    All   data  and  commands  are
  86. transferred with a packet oriented protocol, basically  consisting
  87. of a start of packet character (normally SOH), followed by length,
  88. control, data and checksum fields.  Communication is half  duplex,
  89. in  that for every packet sent, the sender must wait for either an
  90. acknowledgement packet (ACK) or a negative acknowledgement  packet
  91. (NAK).   Transmission  is  in  ascii, with no requirements for the
  92. transmission of eight bit characters or control  characters  other
  93. than  control-A  for marking the start of a packet.  All 'control'
  94. characters imbedded in the data are prefixed to  convert  them  to
  95. printable characters, the same applying to eight bit characters if
  96. required by the characteristics of the line.  Since there are many
  97. different  implementations  of  Kermit,  the  protocol  provides a
  98. mechanism by which the capabilities of two connected  Kermits  can
  99. be  negotiated  to  allow for differences in the level of protocol
  100. support.  Examples of  protocol  features  that  not  all  Kermits
  101. understand   include   data   compression  and  transfer  of  file
  102. attributes.
  103.  
  104. The packet format is
  105.  
  106.  
  107.     +------+-----------+-----------+------+------------+-------+
  108.     | MARK | char(LEN) | char(SEQ) | TYPE |    DATA    | CHECK |
  109.     +------+-----------+-----------+------+------------+-------+
  110.  
  111.  
  112. where all  fields  consist  of  ASCII  characters,  and  the  char
  113. function  converts  a number in the range 0-94 (10) to a printable
  114. ASCII character by adding 32 (10).  The MARK, LEN,  SEQ  and  TYPE
  115. fields  are  one byte, the DATA field is variable in size, and the
  116. CHECK field is one to three bytes in size.
  117. The MARK (normally control A) signifies the  start  of  a  packet.
  118.  
  119.                                                                 Page 3
  120.  
  121.  
  122. The  length  field  tells how long the rest of the packet is.  The
  123. SEQ field is used to insure synchronization used to detect lost or
  124. duplicate  packets.   The SEQ number wraps around every 64 packets
  125. due to the need to encode it as a printable ascii character in the
  126. range  32  (10) to 126 (10).  The TYPE field specifies whether the
  127. packet is a DATA or CONTROL packet.  The DATA section is used  for
  128. the  actual transfer of data or informative messages from a Kermit
  129. server, this field can be up to  90  characters  in  length.   Any
  130. character  whose  low seven bits fall in the range of 0 to 37 (8),
  131. ie, char and 177 (8) is less than 40 (8), will have the value  100
  132. (8)  exclusive  or'ed  (xor'ed)  with  itself and be prefixed by a
  133. shift character, '#'.  Other shift characters may be use for eight
  134. bit  characters  if  the  line characteristics require such.  Data
  135. compression may also occur in the data field, this  is  done  with
  136. yet  another  shift code and byte count sequence.  The CHECK field
  137. is a checksum, either a one  character,  two  character  or  three
  138. character  CRC check; the sender computes it and the receiver must
  139. compute it and compare.  A checksum mismatch will  result  in  the
  140. receiver  sending  a  NAK  packet  (negative acknowledgment) which
  141. directs the sender to resend the NAK'ed packet.  The packet may be
  142. following  by  a terminator (likely an ascii 13).  This terminator
  143. is NOT part of the protocol and is sent only to tell the  receiver
  144. that  a 'line' is present.  Not all Kermit implementations require
  145. this; all Kermits will discard data outside of  a  packet  in  any
  146. event.
  147.  
  148. Error detection and recovery is by  checksum,  as  noted,  and  by
  149. packet  read  timeouts.   If  the  packet  should be corrupted the
  150. checksum will be incorrect, the receiver will NAK the packet.   If
  151. an  expected packet never arrives within the timeout period, or if
  152. the received packet is not the expected one (as determined by  the
  153. SEQ field) the packet will also be NAK'ed.  There are limits as to
  154. how many times an expected packet will be NAK'ed without  aborting
  155. the current operation.
  156.  
  157. Packet types
  158.  
  159.         D       Data
  160.         Y       Acknowledgement (ACK), text may be in DATA field
  161.         N       Negative Acknowledgement (NAK)
  162.         S       Send initiate (Send-Init)
  163.         R       Receive Initiate
  164.         B       Break (EOT, end of transmission)
  165.         F       File name header
  166.         Z       End of file (EOF, end of current file)
  167.         E       Error packet, text may be present in DATA field
  168.  
  169.         G       Generic SERVER command.  The first character in the
  170.                 data field will be a command to a server, arguments
  171.                 may follow that character.
  172.  
  173.            I    Login, user and password follow in data field
  174.            C    CWD, change working or default directory.
  175.            L    Bye, Logout server
  176.            F    Finish, Exit server, but do not log out
  177.  
  178.                                                                 Page 4
  179.  
  180.  
  181.            E    Erase, delete files on server system
  182.            D    Directory query
  183.            U    Disk space usage query
  184.            T    Type a file onto local kermit
  185.            R    Rename file(s) on server system
  186.            K    Copy file(s) on server system
  187.            W    Who's logged in, as in sho sys, sy/s, dev tt
  188.            M    Send a terminal message to a user
  189.            H    Help, the server responds with commands it can do
  190.            Q    Server status query
  191.            P    Program, run a program
  192.            J    Journal
  193.            V    Variable, alter a Kermit setting
  194.  
  195.         C       Execute host command. The host command follows in
  196.                 the data field.
  197.  
  198. Note that some of the generic server commands, as well  as  the  C
  199. packet,  may  not  be  feasible  for  a  given  environment.   For
  200. instance, the REMOTE LOGIN command,  which  sends  the  generic  I
  201. command  to the server, can only be done under RSTS/E; the generic
  202. U command (disk space) is meaningless under RSX unless  one  wants
  203. the  free space on the entire volume.  No Kermit server will abort
  204. on receiving a packet it can't execute, it  will  simply  send  an
  205. error  packet  with an informative message saying it can't process
  206. the requested function.
  207.  
  208.  
  209. A typical transaction
  210.  
  211. An example of a Kermit-11 kermit telling a VMS Kermit-32 server to
  212. expect a file follows.  The Kermit-11 command was SEND JUNK.TST
  213.  
  214.         (0)PDP sends:   ^A. S~* @-#Y3~( ,
  215.         (0)VAX sends:   ^A, Yp/ @-#Y3~!
  216.         (1)PDP sends:   ^A-!FJUNK.TST,-4
  217.         (1)VAX sends:   ^A%!Y,\I
  218.         (2)PDP sends:   ^A`"D$ set ter/vt100#M#J$ xcc :== ccl cc
  219.                         #M#J$ xas :== ccl as#M#J!4S
  220.         (2)VAX sends:   ^A%"Y.5!
  221.         (3)PDP sends:   ^A%#Z,X"
  222.         (3)VAX sends:   ^A%#Y/R9
  223.         (4)PDP sends:   ^A%$B!_#
  224.         (4)VAX sends:   ^A%$Y+&1
  225.  
  226. In packet zero, the Kermit's exchanged information regarding their
  227. capabilities.  The PDP-11 sent an 'S' packet with the data for its
  228. maximum packet length, default time out, number of pad  characters
  229. to  follow  a  packet  (none,  hence  the  space),  use a null for
  230. padding, end of line terminator (a CR + 32), the prefix  character
  231. for control characters, a 'YES' to say the it can prefix eight bit
  232. characters with the default, that it would like to use  CRC  block
  233. checks,  that  it  will  use a tilde for data compression, and the
  234. 'CAPAS' mask, which  here  says  that  it  can  process  attribute
  235. packets (discussed later).  Since the VAX also sends a '3' for the
  236.  
  237.                                                                 Page 5
  238.  
  239.  
  240. checksum type,  they  will  both  switch  to  CRC  checks  on  the
  241. following  packets.  In packet 1, the PDP11 sends the filename the
  242. VAX should use for the file it creates.  The VAX  then  sends  the
  243. acknowledgement.   In  packet  three, the PDP sends the first (and
  244. only for this file) packet of data.  Note that the  sequence  #M#J
  245. is  a  carriage  return/line feed sequence with 100 (8) xored into
  246. each character.  The '#' character informs the other  Kermit  that
  247. it  must xor the next character with 100 (8).  In packet three the
  248. PDP11 sends an EOF packet, the VAX acks it.  In packet  four,  the
  249. PDP sends a break packet which tell the VAX that no more files (of
  250. a possibly wildcard group) are coming and the VAX Kermit acks  the
  251. break  packet.   Both  Kermits  now switch to the single character
  252. checksum and the VMS kermit enters the server idle state.
  253.  
  254. More specific  information  regarding  Kermit  packets  and  state
  255. transitions  can  be  found in the references listed at the end of
  256. the article.
  257.  
  258.  
  259. Transmission of file attributes
  260.  
  261. One of the  optional  features  of  the  Kermit  protocol  is  the
  262. ATTRIBUTE packet.  The attribute packets allow a Kermit program to
  263. send  to  a  receiving  Kermit  information  regarding  the   file
  264. organization,  size,  cluster/retrieval  size,  protection  and so
  265. forth.  There is even a system  dependant  attribute  packet  type
  266. that  can  be  used  to  transfer  things like the RMS11 IFAB (the
  267. RMS/FCS attributes).  Since  to  date  only  the  author's  Kermit
  268. implementation,  Kermit-11,  can  process  attribute  packets, the
  269. discussion is limited to the PDP-11.
  270.  
  271. One of the things  that  two  Kermits  exchange  before  any  file
  272. transfer is an information packet, this packet tells the receiving
  273. Kermit about itself.  The last field in  this  packet,  the  CAPAS
  274. mask, tells Kermit if the other one can process attribute packets.
  275. If two Kermit-11's are communicating, they will find that each can
  276. do  so,  and  the  sender  of a file will then send over attribute
  277. packets indicating the need (or lack of) for binary  transmission,
  278. based  on the file organization, filetype and protection code (for
  279. RSTS/E).  If the sending Kermit-11 is running on RSTS/E, RSX11M/M+
  280. or  P/OS it will also send a copy of the RMS/FCS attributes so the
  281. received file will be identical (to FCS and/or RMS) to the copy on
  282. the  sender's  system.   Since other implementations of Kermit may
  283. use this special system attribute packet, Kermit-11  always  sends
  284. an  attribute  packet  telling  the  receiver  what  hardware  and
  285. operating system it is running on, and thus  will  only  use  such
  286. data  if they are compatible.  Of course, there will be times when
  287. a file may be binary and Kermit-11 can't tell  so,  many  Kermit's
  288. have  a  SET  FILE  BINARY and SET FILE ASCII to allow the user to
  289. override defaults.  Kermit-11 also has a SET FILE  AUTO/NOAUTO  to
  290. disable it from trying to determine a file's binary status.
  291.  
  292. The PDP-11 Kermit-11 implementation
  293.  
  294. The author's version of Kermit-11 is written in Macro-11  and  can
  295.  
  296.                                                                 Page 6
  297.  
  298.  
  299. run  on  RSTS/E,  RSX11M,  RSX11M Plus, P/OS, RT11 and TSX+.  This
  300. version of Kermit is distinct from the other three PDP-11  Kermits
  301. available;  the Stevens P/OS menu driven Kermit; the University of
  302. Toronto RT11 pascal  Kermit  and  Bob  Denny's  P/OS  Kermit.   In
  303. Kermit-11,  the  RSTS  and  RSX file system interface is via RMS11
  304. version 2, while the RT11 interface attempts to emulate the  RMS11
  305. subsystem.  The choice of Macro-11 for the implementation language
  306. was made for several reasons, one being the  availability  of  the
  307. assembler  on  all systems and another being speed and compactness
  308. of the code.
  309. RMS11 was used for RSTS/E and the RSX11M based systems to  provide
  310. a common i/o interface to the host file system.  Additionally, Bob
  311. Denny of Alisa Systems  further  extended  the  RMS  interface  to
  312. support  remote  file  access  over  DECNET  with Kermit, allowing
  313. commands such as SEND NODENAME::[BRIAN.FUBAR]FILE.TYPE  and  other
  314. remote file accesses over DECNET.  RMS11 version 2 also provides a
  315. very simple and powerful means of doing wildcard  searching,  file
  316. renames  and  file  deletion  via the $PARSE, $SEARCH, $RENAME and
  317. $DELETE macros; it also allows the same RMS interface code  to  be
  318. used  on all systems without change.  Points against RMS basically
  319. amount to it's size, RMS is quite large even if  overlayed.   This
  320. is  helped  by  using the segmented RMSRES available on RSTS/E and
  321. RSX11M Plus.  The one over negative point is that RMS11 version  2
  322. does not function well, if at all, on the older versions of PDP-11
  323. operating systems, specifically, one should be using RSTS/E v8  or
  324. later, RSX11M v4.1 or later, and RSX11M Plus version 2.1 or later.
  325.  
  326. All versions of Kermit-11  receive  eight  bit  data  assuming  no
  327. parity  is  used.   Where parity is a must, Kermit-11 has to use a
  328. prefixing scheme for eight bit  binary  data.   Binary  files  are
  329. created  as  FIXED no carriage control files such as used for task
  330. images.  Note that  parity  generation  is  done  by  software  in
  331. Kermit-11.   The  P/OS  version of Kermit-11 runs under control of
  332. DCL.  The next release of Kermit-11,  which  will  be  2.37,  will
  333. include  support  for  the  PRO  TMS (Telephone Management System)
  334. option.  Each version of Kermit-11 has it's  own  source  file  to
  335. deal  with  the  operating  system,  for RSX it is K11M41.MAC, for
  336. RSTS/E they are K11E80.MAC and K1180S.MAC, and for RT11  they  are
  337. called  K11RT*.MAC.   Apart  from  these specific files, all other
  338. source files are shared.  The RT11 Kermit-11 can  use  either  the
  339. version  5.x  XL and XC handler for high throughput, or it can use
  340. multiple terminal service to do all its terminal i/o.  This second
  341. option  allows  the  use of any interface supported, including the
  342. PDT150 modem port, DL/DLV11's  and  DZ/DZV11's.   TSX+  users  can
  343. connect  to CL:  for dialing out, the exact means is documented in
  344. the Kermit-11 users guide.
  345.  
  346. Future directions
  347.  
  348. With  the  advent  of  packet  switched  networks  and   satellite
  349. communications  the  Kermit  protocol  will  likely be extended to
  350. increase efficiency over such links.  The main problem is the half
  351. duplex  nature  of Kermit, the packet acknowledgements can take up
  352. to several  seconds  in  transit  thus  drastically  reducing  the
  353. throughput.   There are several possibilities under discussion and
  354.  
  355.                                                                 Page 7
  356.  
  357.  
  358. a standard should be appearing shortly.
  359.  
  360.  
  361. Summary
  362.  
  363. With the knowledge that there are Kermit implementations for  most
  364. personal  computers  in  use  it  becomes apparent that the Kermit
  365. standard is well worth looking in to.  A list of versions  running
  366. on Digital hardware follows the article.
  367.  
  368.  
  369. Kermit: A File-transfer Protocol for Universities 
  370. Frank da Cruz and Bill Catchings
  371. BYTE Magazine, June/July 1984
  372.  
  373. The Kermit Protocol Manual, version 5
  374. Frank da Cruz   April 1984
  375. Columbia University Center for Computing Activities
  376.  
  377. Information on obtaining Kermit:
  378.  
  379. KERMIT Distribution
  380. Columbia University Center for Computing Activities 
  381. 7th Floor, Watson Laboratory
  382. 612 West 115th Street
  383. New York, N.Y.  10025
  384.  
  385. Kermit is also usually found on the Decus symposia SIG tapes.
  386. Kermit-11 is available from DECUS as number 11-731
  387.  
  388. Digital hardware that Kermit is currently available for:
  389.  
  390.                  Operating  Program   
  391. Machine          System     Language     Contributor
  392.      
  393. DEC PDP-11       MUMPS-11   MUMPS-1982   Cornell U
  394. DEC PDP-11       RSTS/E     Macro-11     U of Toledo
  395. DEC PDP-11       RSX-11/M   Macro-11     U of Toledo
  396. DEC PDP-11       RSX-11/M+  Macro-11     U of Toledo
  397. DEC PDP-11       RT-11      Macro-11     U of Toledo
  398. DEC PDP-11       RT-11      OMSI Pascal  U of Toronto
  399. DEC PDP-11       TSX+       Macro-11     U of Toledo
  400. DEC PDP-11       Unix 2xBSD C            Columbia U
  401. DEC PDP-11, ...  Unix V7    C            Columbia U
  402. DEC PDP-8        OS8, RTS8  PAL-8        R. Hippe
  403. DEC Pro-3xx      P/OS       Bliss, Macro Stevens I.T.
  404. DEC Pro-3xx      P/OS       Macro-11     U of Toledo
  405. DEC Pro-3xx      Pro/RT     Macro-11     U of Toledo
  406. DEC Pro-3xx      Venix V1   C            Columbia U
  407. DEC Pro-3xx      Venix V2   C            Columbia U
  408. DEC Rainbow      CPM86      ASM86        Columbia U
  409. DEC Rainbow      MS-DOS     MASM         Columbia U
  410. DEC Rainbow      QNX 1.x    C            Merrell-Dow
  411. DEC VAX          Ultrix-32  C            Columbia U
  412. DEC VAX          VMS        Bliss,Macro  Stevens I.T.
  413.  
  414.                                                                 Page 8
  415.  
  416.  
  417. DEC VAX          VMS        C (VAX-11 C) Columbia U
  418. DEC VAX          VMS        Pascal       U of Toronto
  419. DEC VAX, ...     Unix 4xBSD C            Columbia U
  420. DEC VT-180 Robin CPM80      Turbo Pascal Jeff Duncan
  421. DEC VT-180 Robin CPM80 2.2  M80,LASM     ACC
  422. DECmate-II,III   CPM80 2.2  M80,LASM     ACC
  423. DECsystem-10     TOPS-10    Bliss, Macro Stevens I.T.
  424. DECSYSTEM-20     TOPS-20    MACRO-20     Columbia U
  425.      
  426.