home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / c / bts314b4 / hydra001 / hydra.doc < prev   
Text File  |  1992-11-29  |  111KB  |  1,898 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  12.  
  13.     Filename......: HYDRA.DOC; The HYDRA file transfer protocol
  14.                     (also published as EMSC-002).
  15.     Rev...........: 001
  16.     Date..........: Dec 1, 1992
  17.     Subject.......: HYDRA file transfer protocol definitions
  18.     Authors.......: Joaquim H. Homrighausen and Arjen G. Lentz
  19.  
  20.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  21.      Copyright 1991-1993 Joaquim H. Homrighausen. All rights reserved.
  22.      Copyright 1991-1993 Lentz Software Development. All rights reserved.
  23.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  24.  
  25.  
  26.     Restrictions
  27.     ללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללל
  28.     You are granted a license to implement the HYDRA file transfer
  29.     protocol, HYDRA hereafter, in your own programs and/or use the sample
  30.     source code and adapt these to your particular situation and needs;
  31.     subject to the following conditions:
  32.  
  33.     o You must refer to it as the HYDRA file transfer protocol, and you
  34.       must give credit to the authors of HYDRA in any information screens
  35.       or literature pertaining to your programs that contains other such
  36.       information (credits, your own copyrights, etc.).
  37.  
  38.     o HYDRA will always remain backwards compatible with previous
  39.       revisions. HYDRA allows for expansion of its features without
  40.       interfering with previous revisions. It is, however, important that
  41.       different people do not expand the protocol in different directions.
  42.       We therefore ask you to contact us if you have any needs/ideas
  43.       regarding HYDRA, so development can be synchronized and beneficial
  44.       to all.
  45.  
  46.     o If your implementation cannot converse with past or future revisions
  47.       as supplied by us, then you must refer to it as "HYDRA derived", or
  48.       as "a variation of HYDRA", or words to that effect.
  49.  
  50.     Permission is hereby granted to the FTSC (FidoNet Technical Standards
  51.     Committee) and other technical organisations to republish this
  52.     document in its entirety. Librarians may change the title page and
  53.     page headers to match their library format as long as all copyrights
  54.     and body text remain unaltered. The original document name and source
  55.     must be mentioned in any republished versions of this document.
  56.  
  57.     No organization, company, person, or other being may impose any fees
  58.     for any reason for providing this document. This document may not be
  59.     sold or otherwise transferred for personal or company gain under any
  60.     circumstances.
  61.  
  62.  
  63.     Disclaimer
  64.     ללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללל
  65.     This information is provided "as is" and comes with no warranties of
  66.     any kind, either expressed or implied. There is no support available
  67.     for this package. It's intended to be used by programmers and
  68.     developers.
  69.  
  70.     In no event shall the authors be liable to you or anyone else for any
  71.     damages, including any lost profits, lost savings or other incidental
  72.     or consequential damages arising out of the use or inability to use
  73.     this information.
  74.  
  75.  
  76.     Revision timestamps
  77.     ללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללל
  78.     001                           0x2b1aab00                 Dec 01, 1992
  79.  
  80.  
  81.     Introduction
  82.     ללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללל
  83.     This document will not attempt to convince the reader that HYDRA is
  84.     of value to him/her or that it is better than other file transfer
  85.     protocols, it will simply describe the protocol. Just to get it out
  86.     of the way, HYDRA is not the ultimate file transfer protocol.
  87.  
  88.     The authors do, however, feel that it offers an significant
  89.     improvement over those file transfer protocols available today. HYDRA
  90.     is a bi-directional protocol with the ability to receive and send
  91.     files simultaneously. There are other bi-directional file transfer
  92.     protocols, but to the authors' knowledge no public specifications
  93.     exist.
  94.  
  95.     HYDRA owes much to Zmodem and its designer, Chuck Forsberg as well as
  96.     to Janus, designed by Rick Huebner. We would like to think of HYDRA
  97.     as a combination of both with a few extra options installed.
  98.  
  99.     The basic concept of a bi-directional file transfer protocol is
  100.     simple. Both data channels are utilized to transmit and receive files
  101.     simultaneously. I.e. two 100 kb files can be exchanged between two
  102.     parties in the time it takes a fully streaming uni-directional file
  103.     transfer protocol to transmit one of the files.
  104.  
  105.  
  106.     Protocol design
  107.     ללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללל
  108.     The ultimate goal when designing HYDRA was to design a protocol that
  109.     is as simple and robust as possible; complexity increase the problem
  110.     of faulty implementations.
  111.  
  112.     The obvious function of a file transfer protocol is to transport a
  113.     collection of data from its source to its destination as efficient
  114.     possible and without jeopardizing the integrity of the data.
  115.  
  116.     The lack of data compression and lost packet management (as used in
  117.     Kermit and Super Kermit) is intentional. The authors feel that this
  118.     unnecessarily increases the complexity of the protocol.
  119.  
  120.     While HYDRA performs to its best on full duplex links, it should be
  121.     possible to use it on links using proprietary protocols such as the
  122.     US Robotics HST protocol which features one 14.4 kbps data channel
  123.     and one 450 bps back channel.
  124.  
  125.     The protocol design should be flexible enough for future enhancements
  126.     while maintaining backward compatibility.
  127.  
  128.  
  129.     Protocol requirements and restrictions
  130.     ללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללל
  131.     HYDRA require that the link can handle ASCII character 24 (DLE) as
  132.     well as all ASCII characters in the range 32 through 126. All other
  133.     characters can be escaped or encoded by the protocol as required by
  134.     the link.
  135.  
  136.     Capability of the computer to perform simultaneous serial I/O as well
  137.     as simultaneous serial I/O combined with disk access is preferred,
  138.     but can be circumvented by opting for windowed transmission instead
  139.     of full streaming.
  140.  
  141.     HYDRA calls for the ability to check whether there is anything in the
  142.     serial input buffer (i.e. "peek-ahead"), but it doesn't mind if it
  143.     has to wait for a second if there is no data available (using for
  144.     instance the UNIX alarm() mechanism).
  145.  
  146.     The protocol is extremely tolerant with timeouts (i.e. satellite or
  147.     network delays) while still maintaining maximum reliability,
  148.     robustness, and throughput.
  149.  
  150.  
  151.     Terms and definitions
  152.     ללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללל
  153.     A BYTE                   An 8-bit unsigned character.
  154.     A WORD                   A 16-bit unsigned integer.
  155.     A DWORD                  A 32-bit unsigned integer.
  156.     A LONG                   A 32-bit SIGNED integer.
  157.     FILE OFFSETS (position)  A long.
  158.     NUL                      The ASCII character 0.
  159.     BS                       The ASCII character 8.
  160.     CR                       The ASCII character 13.
  161.     XOFF                     The ASCII character 17.
  162.     XON                      The ASCII character 19.
  163.     H_DLE                    The HYDRA link escape character, ASCII 24
  164.                              (^X).
  165.     SP or SPACE              The ASCII character 32.
  166.     UNIX timestamp           A specific time and date expressed as the
  167.                              number of seconds since midnight, January
  168.                              1st, 1970. All UNIX timestamps used in HYDRA
  169.                              are expressed in local time.
  170.  
  171.     Multi-byte items are transmitted in "low-byte first" order, so big-
  172.     endian CPUs (like 680xx) need to do some byteswapping, depending on
  173.     the implementation.
  174.  
  175.     Values preceded by '0x' are in hexadecimal notation (base 16, 0..9
  176.     a..f). All values transmitted in hexadecimal notation must be
  177.     converted to lowercase characters and left-padded to their full
  178.     size with '0' prior to transmission. E.g. a WORD with the value 255
  179.     (decimal) is expressed as 00ff. A LONG with the value 255 (decmial)
  180.     is expressed as 000000ff.
  181.  
  182.     In formulas, "AND" means bitwise AND, "XOR" means bitwise Exclusive
  183.     OR, "NOT" is ones complement (i.e. all zeros become ones, all ones
  184.     become zeros). The ">>" is a shift operation to the right, "R >> 3"
  185.     means shift R three bits to the right.
  186.  
  187.  
  188.     General packet format
  189.     ללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללל
  190.     All data exchange is done with framed packets protected by 16 or 32
  191.     bit CRC values appended to the packet data and packet type (low-
  192.     byte first). The only exception to this is the cancel sequence of 5
  193.     consecutive H_DLE characters.
  194.  
  195.     All packets except those with the type DATA are followed by a CR
  196.     (ASCII 13) to help get through some buffered environments and aid
  197.     possible debugging and/or tracing. If requested by the other side in
  198.     its INIT packet, packets can also be prefixed by a specific data
  199.     string which can include NULs, delays or break signals. Refer to the
  200.     section on the INIT packet for more information.
  201.  
  202.  
  203.                           Format of unframed packet
  204.  
  205.                 םגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג™
  206.                 ~ Zero or more bytes packet dependent data ~
  207.                 בגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  208.                 ø Packet type byte                         ø
  209.                 בגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  210.                 ø CRC-16/32 of packet data and packet type ø
  211.                 ijגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגך
  212.  
  213.  
  214.                             Table of packet types
  215.  
  216.          םגגגגגגגגאגגגגגגגגגאגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג™
  217.          øName    øCharacterøASCIIøDescription                     ø
  218.          בגגגגגגגגדגגגגגגגגגדגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  219.          øSTART   ø   'A'   ø  65 øStartup sequence                ø
  220.          øINIT    ø   'B'   ø  66 øSession initialisation          ø
  221.          øINITACK ø   'C'   ø  67 øResponse to INIT packet         ø
  222.          øFINFO   ø   'D'   ø  68 øFile information                ø
  223.          øFINFOACKø   'E'   ø  69 øResponse to FINFO packet        ø
  224.          øDATA    ø   'F'   ø  70 øFile data packet                ø
  225.          øDATAACK ø   'G'   ø  71 øFile data position ACK packet   ø
  226.          øRPOS    ø   'H'   ø  72 øReposition request packet       ø
  227.          øEOF     ø   'I'   ø  73 øEnd of file packet              ø
  228.          øEOFACK  ø   'J'   ø  74 øResponse to EOF packet          ø
  229.          øEND     ø   'K'   ø  75 øEnd of session                  ø
  230.          øIDLE    ø   'L'   ø  76 øIdle (just saying I'm alive)    ø
  231.          øDEVDATA ø   'M'   ø  77 øData to specified device     (1)ø
  232.          øDEVDACK ø   'N'   ø  78 øResponse to DEVDATA packet   (1)ø
  233.          ijגגגגגגגגIJגגגגגגגגגIJגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגך
  234.  
  235.     (1) Support for DEVDATA and DEVDACK types is optional and indicated
  236.         in INIT state of a HYDRA session.
  237.  
  238.  
  239.                            Format of framed packet
  240.  
  241.                םגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגגגגגגגגגגגג™
  242.                ø        H_DLE         øPacket format byte  ø
  243.                בגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגגגגגגגגגגגœ
  244.                ~               Encoded packet              ~
  245.                בגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגגגגגגגגגגגגœ
  246.                ø        H_DLE         øEnd of framed packetø
  247.                ijגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגגגגגגגגגגגך
  248.  
  249.  
  250.                             Table of packet formats
  251.  
  252.            םגגגגאגגגגגגגגגאגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג™
  253.            øNameøCharacterøASCIIøDescription                     ø
  254.            בגגגגדגגגגגגגגגדגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  255.            øEND ø   'a'   ø  97 øEnd of framed packet            ø
  256.            øBIN ø   'b'   ø  98 øBinary packet                   ø
  257.            øHEX ø   'c'   ø  99 øHex encoded packet              ø
  258.            øASC ø   'd'   ø 100 øShifted 7-bit encoded packet (1)ø
  259.            øUUE ø   'e'   ø 101 øUUencoded packet             (1)ø
  260.            ijגגגגIJגגגגגגגגגIJגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגך
  261.  
  262.     (1) Support for ASC and/or UUE formats is optional and indicated in
  263.         the INIT state of a HYDRA session.
  264.  
  265.  
  266.     Packet sender and receiver state charts
  267.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  268.  
  269. TXPKT (Sender)
  270. םגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגג™
  271. øState   øPredicate(s)                  øAction(s)                 øNext stateø
  272. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  273. øBegin   ø1øpkttype == START or         øformat = HEXPKT           øFormat    ø
  274. ø        ø øpkttype == INIT or          ø                          ø          ø
  275. ø        ø øpkttype == INITACK or       ø                          ø          ø
  276. ø        ø øpkttype == END or           ø                          ø          ø
  277. ø        ø øpkttype == IDLE             ø                          ø          ø
  278. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  279. ø        ø2øEscape 8th bit (7 bit link) ø                          øCoding    ø
  280. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  281. ø        ø3øelse (no spc.pkt, 8bit link)øformat = BINPKT           øFormat    ø
  282. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  283. øCoding  ø1øescape all control chars &  øformat = UUEPKT           øFormat    ø
  284. ø        ø øUUENCODED packets allowed   ø                          ø          ø
  285. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  286. ø        ø2øASCII packets allowed       øformat = ASCPKT           øFormat    ø
  287. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  288. ø        ø3ø7 bit link &                øformat = HEXPKT           øFormat    ø
  289. ø        ø øescape all control chars &  ø                          ø          ø
  290. ø        ø øUUE/ASC pkts not allowed    ø                          ø          ø
  291. בגגגגגגגגדגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  292. øFormat  ø                              øAppend format byte to dataøCRC       ø
  293. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  294. øCRC     ø1øformat != HEXPKT &          øCalc CRC-32 (data,pkttype)øEncode    ø
  295. ø        ø øCRC-32 allowed              øAppend one's complement ofø          ø
  296. ø        ø ø                            øCRC to data, lowbyte firstø          ø
  297. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  298. ø        ø2øelse (HEXPKT or no CRC-32)  øCalc CRC-16 (data,pkttype)øEncode    ø
  299. ø        ø ø                            øAppend one's complement ofø          ø
  300. ø        ø ø                            øCRC to data, lowbyte firstø          ø
  301. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  302. øEncode  ø1øformat == BINPKT            øBIN escape databuf        øPrefix    ø
  303. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  304. ø        ø2øformat == HEXPKT            øHEX encode databuf        øPrefix    ø
  305. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  306. ø        ø3øformat == ASCPKT            øASC encode/escape databuf øPrefix    ø
  307. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  308. ø        ø4øformat == UUEPKT            øUUE encode databuf        øPrefix    ø
  309. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  310. øPrefix  ø1øNo more prefix characters   ø                          øTransmit  ø
  311. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  312. ø        ø2øPrefix character ASCII 221  øSend 1 second break signalø          ø
  313. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  314. ø        ø3øPrefix character ASCII 222  ø1 second delay            ø          ø
  315. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  316. ø        ø4øPrefix character ASCII 223  øTransmit NUL (ASCII 0)    ø          ø
  317. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  318. ø        ø5øelse (any other character)  øTransmit character        ø          ø
  319. בגגגגגגגגדגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  320. øTransmitø                              øTransmit H_DLE,format byteøSuffix    ø
  321. ø        ø                              øTransmit encoded buffer   ø          ø
  322. ø        ø                              øTransmit H_DLE,pktend byteø          ø
  323. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  324. øSuffix  ø1øpkttype != DATA &           øTransmit CR,LF (ASC 13,10)øDone      ø
  325. ø        ø øpktformat != BINPKT         ø                          ø          ø
  326. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  327. ø        ø2øelse (pkttype == DATA or    ø                          øDone      ø
  328. ø        ø ø      pktformat == BINPKT)  ø                          ø          ø
  329. ijגגגגגגגגIJגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגך
  330.  
  331.  
  332. RXPKT (Receiver)
  333. םגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגג™
  334. øState   øPredicate(s)                  øAction(s)                 øNext stateø
  335. בגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  336. øReset   ø                              ørxdle = 0                 øNextByte  ø
  337. ø        ø                              øformat = 0                ø          ø
  338. ø        ø                              øpktlen = 0                ø          ø
  339. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  340. øNextByteø1øUser wishes to abort sessionøReport reason for abort   øAbort     ø
  341. ø        ø øor carrier lost             ø                          ø          ø
  342. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  343. ø        ø2øByte available in inputbuf  ø                          øStripIn   ø
  344. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  345. ø        ø3øbraintimer expired          øReport braindead situationøAbort     ø
  346. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  347. ø        ø4øAny other timer expired     øTell responsible party    ø          ø
  348. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  349. øStripIn ø1øEscape 8th bit (7 bit link) øc = c AND 0x7f (strip 8th)øStripC    ø
  350. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  351. ø        ø2øelse (8 bit link)           ø                          øStripC    ø
  352. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  353. øStripC  ø1øEscape ctlchars with 8th setøn = c AND 0x7f (strip 8th)øProcess   ø
  354. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  355. ø        ø2øelse (let 8 bit ctl through)øn = c                     øProcess   ø
  356. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  357. øProcess ø1øc == H_DLE                  øincrement rxdle           øDLE       ø
  358. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  359. ø        ø2øEscape XON/XOFF &           øEat these                 øNextByte  ø
  360. ø        ø øn == XON or n == XOFF       ø                          ø          ø
  361. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  362. ø        ø3øEscape all control chars &  øEat these                 øNextByte  ø
  363. ø        ø øn < 32 or n == 127          ø                          ø          ø
  364. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  365. ø        ø4ørxdle > 0                   ø                          øEscape    ø
  366. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  367. ø        ø5øelse (no eating or escaping)ø                          øStore     ø
  368. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  369. øDLE     ø1ørxdle == 5                  øReport remote wants abort øAbort     ø
  370. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  371. ø        ø2øelse (rxdle < 5)            ø                          øNextByte  ø
  372. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  373. øEscape  ø1øc == PKTEND                 ø                          øPktEnd    ø
  374. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  375. ø        ø2øc == BINPKT                 øformat = BINPKT           øPktStart  ø
  376. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  377. ø        ø3øc == HEXPKT                 øformat = HEXPKT           øPktStart  ø
  378. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  379. ø        ø4øc == ASCPKT                 øformat = ASCPKT           øPktStart  ø
  380. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  381. ø        ø5øc == UUEPKT                 øformat = UUEPKT           øPktStart  ø
  382. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  383. ø        ø6øelse (normal escaped char)  øc = c XOR 0x40            øStore     ø
  384. ø        ø ø                            ørxdle = 0                 øStore     ø
  385. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  386. øStore   ø1øformat == 0                 øGarbage                   øNextByte  ø
  387. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  388. ø        ø2øpktlen >= maximum           øPkt too long / lost PKTENDøReset     ø
  389. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  390. ø        ø3øelse (fmt > 0 & len < max)  øAppend c to databuffer    øNextByte  ø
  391. ø        ø ø                            øincrement pktlen          ø          ø
  392. בגגגגגגגגדגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  393. øPktStartø                              ørxdle = 0                 øNextByte  ø
  394. ø        ø                              øpktlen = 0                ø          ø
  395. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  396. øPktEnd  ø1øformat == 0                 øEnd without start, garbageøReset     ø
  397. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  398. ø        ø2øformat == BINPKT            ø(No more decoding needed) øCalcCRC   ø
  399. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  400. ø        ø3øformat == HEXPKT            øok = Decode HEXPKT        øCheckDec  ø
  401. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  402. ø        ø4øformat == ASCPKT            øok = Decode ASCPKT        øCheckDec  ø
  403. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  404. ø        ø5øformat == UUEPKT            øok = Decode UUEPKT        øCheckDec  ø
  405. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  406. øCheckDecø1øok (no errors during decode)ø                          øCalcCRC   ø
  407. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  408. ø        ø2øelse (errors in decoding)   øBad encoding, ignore pkt  øReset     ø
  409. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  410. øCalcCRC ø1øformat != HEXPKT &          øCalc CRC-32 over databuf  øCheckCRC  ø
  411. ø        ø øCRC-32 allowed              øok = (crc == 0xdebb20e3)  ø          ø
  412. ø        ø ø                            øpktlen = pktlen - 4       ø          ø
  413. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  414. ø        ø2øelse (HEXPKT or no CRC-32)  øCalc CRC-16 over databuf  øCheckCRC  ø
  415. ø        ø ø                            øok = (crc == 0xf0b8)      ø          ø
  416. ø        ø ø                            øpktlen = pktlen - 2       ø          ø
  417. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  418. øCheckCRCø1øok (CRC matched magic)      øpkttype = last byte of buføReset     ø
  419. ø        ø ø                            øpktlen = pktlen - 1       ø          ø
  420. ø        ø ø                            øHand pkt to higher level  ø          ø
  421. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  422. ø        ø2øelse (CRC check failed)     øBad CRC, ignore packet    øReset     ø
  423. ijגגגגגגגגIJגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגך
  424.  
  425.  
  426.  
  427.     BIN packet format
  428.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  429.     The binary packet format require an 8-bit data channel. If requested
  430.     by either side, one or more sets of control characters are escaped.
  431.     In this case, when one of these characters appears in an unframed
  432.     packet, a H_DLE is sent followed by the character XOR 0x40. The H_DLE
  433.     character itself is always transmitted in this fashion. On the
  434.     receiver side, if the character after a H_DLE is not one of the
  435.     packet format bytes, this character is decoded using XOR 0x40 again.
  436.  
  437.  
  438. BINPKT Escaping
  439. םגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגג™
  440. øState   øPredicate(s)                  øAction(s)                 øNext stateø
  441. בגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  442. øBegin   ø                              øtxlastc = 0               øNextByte  ø
  443. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  444. øNextByteø1øNo more bytes to process    ø                          øDone      ø
  445. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  446. ø        ø2øEscape ctlchars with 8th setøn = c AND 0x7f (strip 8th)øEscape    ø
  447. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  448. ø        ø3øelse (let 8 bit ctl through)øn = c                     øEscape    ø
  449. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  450. øEscape  ø1øn == H_DLE                  øOutput H_DLE              øOutput    ø
  451. ø        ø ø                            øc = c XOR 0x40            ø          ø
  452. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  453. ø        ø2øEscape XON/XOFF &           øOutput H_DLE              øOutput    ø
  454. ø        ø øn == XON or n == XOFF       øc = c XOR 0x40            ø          ø
  455. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  456. ø        ø3øEscape Telenet &            øOutput H_DLE              øOutput    ø
  457. ø        ø øn == CR &                   øc = c XOR 0x40            ø          ø
  458. ø        ø øtxlasc == '@'               ø                          ø          ø
  459. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  460. ø        ø4øEscape all control chars &  øOutput H_DLE              øOutput    ø
  461. ø        ø øn < 32 or n == 127          øc = c XOR 0x40            ø          ø
  462. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  463. ø        ø5øelse (any other character)  ø                          øOutput    ø
  464. בגגגגגגגגדגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  465. øOutput  ø                              øStore c                   øNextByte  ø
  466. ø        ø                              øtxlastc = c               ø          ø
  467. ijגגגגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגך
  468.  
  469.  
  470.  
  471.     HEX packet format
  472.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  473.     Supported by all implementations, this packet format is used in
  474.     worst-case situations and upon startup of a session when it is not
  475.     yet known what restrictions the line and the other side will place on
  476.     the link.
  477.  
  478.     Packet types always transmitted in HEX format are: START, INIT,
  479.     INITACK, IDLE, END.
  480.  
  481.     HEX format packets always use a 16-bit CRC.
  482.  
  483.     HEX packets assume a 7-bit link, escaping all control characters and
  484.     filtering all control characters upon receipt.
  485.  
  486.     ASCII characters in the range 128-255 (high bit set) are encoded by
  487.     first transmitting a backslash ('\') character (ASCII 92), followed
  488.     by the character in two lowercase hex-digits (bits 4-7 in first
  489.     digit, bits 0-3 in second).
  490.  
  491.     Uppercase hex-digits are not permitted.
  492.  
  493.     The backslash character itself is transmitted as two backslashes.
  494.  
  495.     ASCII characters in the range 0-31 and 127 (all control characters)
  496.     are escaped with H_DLE in the same fashion as in binary (BIN)
  497.     packets.
  498.  
  499.     Decoded  byte 1
  500.             םגגגגגג™
  501.             76543210
  502.             ijגגךijגגך
  503.     Encoded  h1  h2
  504.  
  505.  
  506. HEXPKT Encoding/Escaping
  507. םגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגג™
  508. øState   øPredicate(s)                  øAction(s)                 øNext stateø
  509. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  510. øNextByteø1øNo more bytes to process    ø                          øDone      ø
  511. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  512. ø        ø2øHigh bit of c set           øOutput \ (backslash)      ø          ø
  513. ø        ø ø                            øOutput hexdigit(c bit 4-7)ø          ø
  514. ø        ø ø                            øOutput hexdigit(c bit 0-3)ø          ø
  515. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  516. ø        ø3øc < 32 or c == 127          øOutput H_DLE              ø          ø
  517. ø        ø ø                            øOutput (c XOR 0x40)       ø          ø
  518. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  519. ø        ø4øc == \ (backslash)          øOutput \ (backslash)      ø          ø
  520. ø        ø ø                            øOutput \ (backslash)      ø          ø
  521. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  522. ø        ø5øelse (any other character)  øOutput c                  ø          ø
  523. ijגגגגגגגגIJגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגך
  524.  
  525.  
  526. HEXPKT Decoding
  527. םגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגג™
  528. øState   øPredicate(s)                  øAction(s)                 øNext stateø
  529. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  530. øNextByteø1øNo more bytes to process    ø                          øDone OK   ø
  531. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  532. ø        ø2øc == \ (backslash)          ø                          øEscape    ø
  533. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  534. ø        ø3øelse (any other character)  øOutput c                  øEscape    ø
  535. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  536. øEscape  ø1øNo more bytes to process    øPremature end of data     øError     ø
  537. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  538. ø        ø2øc == \ (backslash)          øOutput \ (backslash)      ø          ø
  539. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  540. ø        ø3øc == lowercase hexdigit     øSave c, move ptr to next  øNextHex   ø
  541. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  542. ø        ø4øelse (all other characters) øInvalid character         øError     ø
  543. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  544. øNextHex ø1øNo more bytes to process    øPremature end of data     øError     ø
  545. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  546. ø        ø2øc == lowercase hexdigit     øOutput (1st << 4 OR 2nd)  øNextByte  ø
  547. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  548. ø        ø3øelse (all other characters) øInvalid character         øError     ø
  549. ijגגגגגגגגIJגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגך
  550.  
  551.  
  552.     ASC packet format
  553.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  554.     Support of this packet format is optional and signalled in the INIT
  555.     packet with the ASC flag in the "Supported options" field. 8-bit data
  556.     is transformed into 7-bit data by a simple shift operation. Each byte
  557.     is inserted at the top of a shift register, the lower seven bits are
  558.     moved out. So seven 8-bit bytes are encoded into eight 7-bit
  559.     characters.
  560.  
  561.     The end of the packet is padded by a maximum of six bits of 0 to make
  562.     the number of bits a multiple of seven and thereby creating
  563.     complete characters (so the receiver stops decoding when there are
  564.     less than seven bits left). The output can contain control
  565.     characters, so if escaping of these characters is required, this is
  566.     done as in BIN packets using the H_DLE method.
  567.  
  568.  
  569.     Decoded  byte 7  byte 6  byte 5  byte 4  byte 3  byte 2  byte 1
  570.             םגגגגגג™םגגגגגג™םגגגגגג™םגגגגגג™םגגגגגג™םגגגגגג™םגגגגגג™
  571.             76543210765432107654321076543210765432107654321076543210
  572.             ijגגגגגךijגגגגגךijגגגגגךijגגגגגךijגגגגגךijגגגגגךijגגגגגךijגגגגגך
  573.     Encoded   c8     c7      c6    c5     c4     c3     c2     c1
  574.  
  575.  
  576. ASCPKT Encoding/Escaping
  577. םגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגג™
  578. øState   øPredicate(s)                  øAction(s)                 øNext stateø
  579. בגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  580. øReset   ø                              øn = 0 (16 bit wide!)      øNextByte  ø
  581. ø        ø                              øbitshift = 0              ø          ø
  582. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  583. øNextByteø1øNo more bytes to process    ø                          øFlush     ø
  584. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  585. ø        ø2øelse (more bytes to process)øn = n OR (c << bitshift)  øShift     ø
  586. ø        ø ø                            øBINPKT escape (n & 0x7f)  ø          ø
  587. ø        ø ø                            øn = n >> 7                ø          ø
  588. ø        ø ø                            øincrement bitshift        ø          ø
  589. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  590. øShift   ø1øbitshift == 7               øBINPKT escape (n & 0x7f)  øReset     ø
  591. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  592. ø        ø2øelse (bitshift < 7)         ø                          øNextByte  ø
  593. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  594. øFlush   ø1øbitshift > 0                øBINPKT escape (n & 0x7f)  øDone      ø
  595. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  596. ø        ø2øelse (bitshift == 0)        ø                          øDone      ø
  597. ijגגגגגגגגIJגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגך
  598.  
  599. ASCPKT Decoding
  600. םגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגג™
  601. øState   øPredicate(s)                  øAction(s)                 øNext stateø
  602. בגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  603. øBegin   ø                              øn = 0 (16 bit wide!)      øNextByte  ø
  604. ø        ø                              øbitshift = 0              ø          ø
  605. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  606. øNextByteø1øNo more bytes to process    ø                          øDone OK   ø
  607. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  608. ø        ø2øelse (more bytes to process)øc = c AND 0x7f            øShift     ø
  609. ø        ø ø                            øn = n OR (c << bitshift)  ø          ø
  610. ø        ø ø                            øbitshift = bitshift + 7   ø          ø
  611. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  612. øShift   ø1øbitshift >= 8               øOutput (n AND 0xff)       øNextByte  ø
  613. ø        ø ø                            øn = n >> 8                ø          ø
  614. ø        ø ø                            øbitshift = bitshift - 8   ø          ø
  615. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  616. ø        ø2øelse (bitshift < 8)         ø                          øNextByte  ø
  617. ijגגגגגגגגIJגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגך
  618.  
  619.  
  620.  
  621.     UUE packet format
  622.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  623.     Support of this packet format is optional and signalled in the INIT
  624.     packet with the UUE flag in the "Supported options" field. The 8-bit
  625.     data is transformed into printable ASCII using the UUENCODE
  626.     algorithm. Three 8-bit bytes are encoded into four printable ASCII
  627.     characters. This done by taking the bottom six bits left and adding
  628.     '!' (ASCII 33) to move this character value into printable ASCII
  629.     range.
  630.  
  631.     The end of the packet is padded by a maximum of five bits of 0 to
  632.     make the number of bits a multiple of six and thereby creating 
  633.     complete characters (so the receiver stops decoding when there are
  634.     less than six bits left). The output of this coding scheme does not
  635.     need any further escaping before transmission.
  636.  
  637.     Decoded  byte 3  byte 2  byte 1
  638.             םגגגגגג™םגגגגגג™םגגגגגג™
  639.             765432107654321076543210
  640.             ijגגגגךijגגגגךijגגגגךijגגגגך
  641.     Encoded   c4    c3    c2    c1
  642.  
  643.  
  644. UUEPKT Encoding
  645. םגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגג™
  646. øState   øPredicate(s)                  øAction(s)                 øNext stateø
  647. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  648. øNextByteø1øLess than three bytes left  ø                          øFlush     ø
  649. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  650. ø        ø2øelse (three or more left)   øUUE(in[0]>>2)             ø          ø
  651. ø        ø ø                            øUUE(in[0]<<4 OR in[1]>>4) ø          ø
  652. ø        ø ø                            øUUE(in[1]<<2 OR in[2]>>6) ø          ø
  653. ø        ø ø                            øUUE(in[2])                ø          ø
  654. ø        ø ø                            ø(UUE: (c AND 0x3f) + '!') ø          ø
  655. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  656. øFlush   ø1øNo more bytes left          ø                          øDone      ø
  657. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  658. ø        ø2øOne byte left               øUUE(in[0]>>2)             øDone      ø
  659. ø        ø ø                            øUUE(in[0]<<4)             ø          ø
  660. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  661. ø        ø3øTwo bytes left              øUUE(in[0]>>2)             øDone      ø
  662. ø        ø ø                            øUUE(in[0]<<4 OR in[1]>>4) ø          ø
  663. ø        ø ø                            øUUE(in[1]<<2)             ø          ø
  664. ijגגגגגגגגIJגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגך
  665.  
  666. UUEPKT Decoding
  667. םגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגג™
  668. øState   øPredicate(s)                  øAction(s)                 øNext stateø
  669. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  670. øNextByteø1øLess than four bytes left   ø                          øFlush     ø
  671. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  672. ø        ø2øelse (four or more left) &  øUD(i[0])<<2 OR UD(i[1])>>4ø          ø
  673. ø        ø ø(c AND 0x7f) is in UUE rangeøUD(i[1])<<4 OR UD(i[2])>>2ø          ø
  674. ø        ø ø                            øUD(i[2])<<6 OR UD(i[3])   ø          ø
  675. ø        ø ø                            ø(UD: (c - '!') AND 0x3f)  ø          ø
  676. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  677. ø        ø3øelse (all other characters) øInvalid character(s)      øError     ø
  678. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  679. øFlush   ø1øNo bytes left or            ø                          øDone OK   ø
  680. ø        ø øLess than two bytes left    ø                          ø          ø
  681. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  682. ø        ø2øTwo bytes left &            øUD(i[0])<<2 OR UD(i[1])>>4øDone OK   ø
  683. ø        ø ø(c AND 0x7f) is in UUE rangeø                          ø          ø
  684. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  685. ø        ø3øThree bytes left &          øUD(i[0])<<2 OR UD(i[1])>>4øDone OK   ø
  686. ø        ø ø(c AND 0x7f) is in UUE rangeøUD(i[1])<<4 OR UD(i[2])>>2ø          ø
  687. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  688. ø        ø4øelse (all other characters) øInvalid character(s)      øError     ø
  689. ijגגגגגגגגIJגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגך
  690.  
  691.  
  692.  
  693.     START packet                                             (HEX format)
  694.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  695.     This packet is sent to tell the remote to initiate a HYDRA session.
  696.  
  697.     The complete framed packet as transmitted looks like:
  698.  
  699.         ASCII values   24    99  65  92 102  53  92  97  51    24    97
  700.                     םגגגגגגגאגגגאגגגאגגגאגגגאגגגאגגגאגגגאגגגאגגגגגגגאגגג™
  701.         Characters  ø H_DLE ø c ø A ø \ ø f ø 5 ø \ ø a ø 3 ø H_DLE ø a ø
  702.                     ijגגגגגגגIJגגגIJגגגIJגגגIJגגגIJגגגIJגגגIJגגגIJגגגIJגגגגגגגIJגגגך
  703.  
  704.     Applications may scan for this sequence to automatically start HYDRA
  705.     when the remote transmits this packet (AutoStart). Prior to the START
  706.     packet, a special string is transmitted to enable remote starting
  707.     from a command prompt, hydra<CR> (the word hydra in lowercase):
  708.  
  709.         ASCII values 104 121 100 114  97  13
  710.                     םגגגאגגגאגגגאגגגאגגגאגגגג™
  711.         Characters  ø h ø y ø d ø r ø a ø CR ø
  712.                     ijגגגIJגגגIJגגגIJגגגIJגגגIJגגגגך
  713.  
  714.     The special string combined with the START packet is transmitted at
  715.     five second intervals until either a START or INIT packet is received
  716.     from the remote, or the maximum number of retries is reached. Any
  717.     other packet types received in this stage must be ignored as they
  718.     could be remains of a previous session.
  719.  
  720.  
  721.     INIT packet                                              (HEX format)
  722.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  723.     The INIT packet contains file transfer session options. The remote
  724.     acknowledges this packet by returning an INITACK packet.
  725.  
  726.  
  727.                               INIT packet data
  728.  
  729.                  םגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג™
  730.                  ~ Application ID string, NUL terminated ~
  731.                  בגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  732.                  ~ Supported options, NUL terminated     ~
  733.                  בגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  734.                  ~ Desired options, NUL terminated       ~
  735.                  בגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  736.                  ø Desired transmitter window size or 0  ø
  737.                  בגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  738.                  ø Desired receiver window size or 0     ø
  739.                  בגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  740.                  ~ Other general options, NUL terminated ~
  741.                  בגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  742.                  ~ Packet prefix string, NUL terminated  ~
  743.                  ijגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגך
  744.  
  745.     The application ID string contains a printable ASCII string with the
  746.     document revision date, product name, product revision number, and
  747.     optionally the product serial number. The format of the string is:
  748.  
  749.         <RevDate><ProductName><,><ProductRevision>[<,><ProductSerial#>]
  750.  
  751.     RevDate is the UNIX timestamp (the hour, minute, and second portion
  752.     is assumed to be zero), in hexadecimal notation, of the HYDRA
  753.     document that the application is supposed to support. None of the
  754.     following three fields should exceed thirty characters in length and
  755.     must not contain any control characters (ASCII 0-31) or the comma
  756.     character (ASCII 44). The field separator is a comma (ASCII 44)
  757.     character.
  758.  
  759.     Capability flags
  760.  
  761.         XON        Escape <XON> and <XOFF> characters.
  762.         TLN        Escape the <CR>@<CR> sequence (Telenet escape).
  763.         CTL        Escape ASCII characters 0-31 and 127.
  764.         HIC        Escape above three with high bit set.
  765.         HI8        Escape ASCII characters 128-255 and strip the high bit.
  766.         BRK        Can transmit a break signal.
  767.         ASC        Can handle ASC packets.
  768.         UUE        Can handle UUE packets.
  769.         C32        Can receive packets with 32-bit CRC error detection.
  770.         DEV        Can receive device packets.
  771.         FPT        Can receive filenames with paths.
  772.  
  773.     Capability flags are always three characters long, in uppercase, and
  774.     seperated by a comma character (ASCII 44). Please note that the first
  775.     five flags must be supported by all applications that implement the
  776.     HYDRA specifications.
  777.  
  778.     The "Supported options" string contain the capability flags of the
  779.     options that the application support. The "Desired options" string
  780.     contain the capability flags of the options that the application
  781.     would like to use/enable for the session. Some flags do not have to
  782.     be specified in both strings. E.g. if the C32 flag is present in the
  783.     "Supported options" string and the remote system indicates support
  784.     for the same flag, 32-bit CRC error detection will be used. An
  785.     application may not ask for an option it does not support.
  786.  
  787.     Escaping certain characters or bits also means filtering any
  788.     occurrence of them in the incoming data stream. At the start of a
  789.     session, it is assumed that the first five capability flags are in
  790.     effect, i.e. the high bit is stripped off every received character
  791.     and all control characters are filtered out.
  792.  
  793.     The "Desired transmitter/receiver window size" fields are long
  794.     integers expressed in hexadecimal notation. With these options each
  795.     side tells the other to use window management of the requested size
  796.     when transmitting file data, instead of using full streaming (0).
  797.     The window setting is completely seperate for both directions.
  798.     If one side requests a smaller window size than the other, that
  799.     smaller size will be used for that direction; also, a window of any
  800.     size takes precedence over no window (0).
  801.     Please note that the terms 'transmitter' and 'receiver' used for the
  802.     fields in the INIT packet are from the view of the side transmitting
  803.     that packet, so the other side should merge the 'transmitter' window
  804.     field from the received INIT packet with its own 'receiver' window
  805.     field.
  806.  
  807.     The "General options" string currently has no other fields than
  808.     "Desired tx/rx window size"; the string is NUL terminated.
  809.  
  810.     The packet prefix string is normally empty, but may be provided by
  811.     the remote if required. The maximum length of a packet prefix string
  812.     is 30 characters. All characters should be transmitted as specified,
  813.     with the following exceptions:
  814.  
  815.     
  816.                 Table of special packet prefix string chars
  817.  
  818.                םגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג™
  819.                øASCIIøDescription                           ø
  820.                בגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  821.                ø 221 øTransmit a break signal for one secondø
  822.                ø 222 øDelay one second before next characterø
  823.                ø 223 øTransmit a NUL (ASCII 0) character    ø
  824.                ijגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגך
  825.  
  826.  
  827.     INITACK packet                                           (HEX format)
  828.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  829.     The INITACK packet is used to acknowledge the receipt of the remote's
  830.     INIT packet.
  831.  
  832.     Duplicate INIT packets should be acknowledged too, as the remote may
  833.     have missed previous INITACK packets; the reception of such a
  834.     duplicate packet should not however reset the braindead timer, as it
  835.     does not mean a change of state and is not actual file data.
  836.  
  837.  
  838.     FINFO packet
  839.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  840.     File information packet, sent to notify the remote that another file
  841.     is to be transmitted, or to signal end of batch. After the FINFO
  842.     packet has been transmitted, the timer is set to the normal timeout
  843.     value. The sender then waits for an FINFOACK packet from the remote
  844.     or for the timer to expire. In the event of a timeout, the transmit/
  845.     wait sequence is repeated with half the normal timeout value until
  846.     the maximum number of retries has been reached.
  847.  
  848.  
  849.                               FINFO packet data
  850.                    םגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג™
  851.                    ~ File information, NUL terminated    ~
  852.                    ijגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגך
  853.  
  854.  
  855.                    File information        End of batch
  856.                   םגגגגגגגגגגגגגגגגג™   םגגגגגגגגגגגגגגגגג™
  857.                   ø Timestamp or 0  ø   ø       NUL       ø 
  858.                   בגגגגגגגגגגגגגגגגגœ   ijגגגגגגגגגגגגגגגגגך 
  859.                   ø Filesize or 0   ø
  860.                   בגגגגגגגגגגגגגגגגגœ
  861.                   ø Reserved (0)    ø
  862.                   בגגגגגגגגגגגגגגגגגœ
  863.                   ø Transaction #   ø
  864.                   בגגגגגגגגגגגגגגגגגœ
  865.                   ø File count or 0 ø
  866.                   בגגגגגגגגגגגגגגגגגœ
  867.                   ~ Short filename  ~
  868.                   בגגגגגגגגגגגגגגגגגœ
  869.                   ~ Real filename   ~
  870.                   בגגגגגגגגגגגגגגגגגœ
  871.                   ø     NUL         ø
  872.                   ijגגגגגגגגגגגגגגגגגך
  873.                      
  874.     End of batch is signalled by an empty string (only the terminating
  875.     NUL).
  876.  
  877.     The first five fields are long integers expressed in hexadecimal
  878.     notation.
  879.  
  880.     Timestamp is a UNIX timestamp representing the creation time of the
  881.     file. If the creation time is not known, this is zero.
  882.  
  883.     Filesize is the size of the file in bytes. If the size of the file is
  884.     not known, this is zero. This field should not be used as an exact
  885.     measure of the size of the file. It is safe to assume that you should
  886.     not receive less data than specified in this field, but the file may
  887.     grow while it is being transferred (e.g. the result of a background
  888.     process).
  889.  
  890.     Transaction # is a unique number for each set of files being sent
  891.     during the session. This is primarily used to allow the receiving
  892.     application to group several files together and store them in
  893.     specific directories as a result of automated file requests. If the
  894.     file being sent is not a result of an automated file request, this
  895.     field must be set to zero.
  896.  
  897.     File count is the session file counter. For the first file in a
  898.     session, this field contains the total number of files to be sent
  899.     during the session; for subsequent files, it contains the file number
  900.     in the session, starting with two (2). If the total number of files
  901.     is not known, this field contains zero for all files.
  902.  
  903.     The first filename field must be specified in lowercase characters.
  904.     It must conform to MS-DOS filename conventions and not exceed 12
  905.     characters in length (excluding the terminating NUL character). The
  906.     second field, real filename, is the actual filename on the sending
  907.     system. If this field is not present, the short filename field is
  908.     used.
  909.  
  910.     No directory paths may be specified in the short filename. Directory
  911.     paths may be specified in the real filename field if the "Desired
  912.     options" of the receiver contains FPT. If the real filename field
  913.     contains a path, it may include any ASCII character in the range 32
  914.     (0x20) through 255 (0xff) with \ characters translated to /. A drive
  915.     specifier may be present in the <Drive>: (e.g. c:) format. If both
  916.     the short and real filename fields are present, they are separated
  917.     by a NUL character. There is never more than one NUL character
  918.     terminating the packet.
  919.     
  920.  
  921.     FINFOACK packet
  922.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  923.     Sent in response to an FINFO packet. If the FINFO packet contained
  924.     file information, the FINFOACK packet is also used to instruct the
  925.     remote how to proceed with the transfer.
  926.  
  927.  
  928.                             FINFOACK packet data
  929.                  םגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג™
  930.                  ø Long file offset, special code, or 0  ø
  931.                  ijגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגך
  932.  
  933.     The only data in this packet is a long integer. In response to an
  934.     an end of batch FINFO packet, the file offset is set to zero (0). In
  935.     all other cases, file offset is one of the following:
  936.  
  937.  
  938.                        File offsets and special values
  939.            םגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג™
  940.            øOffsetøDescription                                   ø
  941.            בגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  942.            ø >=0  øSeek to specified offset and start sending (1)ø
  943.            ø  -1  øAlready have file                          (2)ø
  944.            ø  -2  øSend file during another batch (not now)      ø
  945.            ijגגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגך
  946.  
  947.     (1) This can only be something other than zero if the FINFO packet
  948.         specified a filesize other than zero (i.e. the size of the file
  949.         is known to the receiver).
  950.  
  951.     (2) The sending application should consider the file as having been
  952.         sent successfully. This is primarily used to prevent duplicate
  953.         files from being transmitted.
  954.  
  955.  
  956.     DATA packet
  957.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  958.     Packet containing actual file data.
  959.  
  960.  
  961.                                   DATA packet
  962.                   םגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג™
  963.                   ø Long file offset of file data block     ø
  964.                   בגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  965.                   ~ Variable length data block 0-2048 bytes ~
  966.                   ijגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגך
  967.  
  968.     If the file offset corresponds with what is expected by the receiver,
  969.     the data block is saved and the file position increased accordingly.
  970.     If the file offset is not correct, DATA packets may have been lost or
  971.     failed the CRC check. Bad packets are ignored because it is not
  972.     certain that the bad packet was an actual DATA packet and not some
  973.     other type of packet. The file offset comparison is therefore the
  974.     only way to find out about lost or bad data.
  975.  
  976.     When a bad data packet is detected, an RPOS packet is transmitted by
  977.     the receiver to force the sender to seek to the desired file offset
  978.     and resume transmission from it. After transmitting the RPOS packet,
  979.     the receiver initializes a timer and continues to monitor received
  980.     DATA packets while comparing their file offset with its desired
  981.     offset.
  982.  
  983.     If the offset of a newly received DATA packet is greater than the
  984.     offset received in the last DATA packet prior to transmitting the
  985.     RPOS packet, the sender has not yet seen the RPOS packet, or the
  986.     DATA packet was already in the data stream when the RPOS packet was
  987.     transmitted.
  988.  
  989.     If the received offset matches the requested offset, the transfer is
  990.     resumed, otherwise, a new RPOS packet is transmitted by the receiver
  991.     and the timer restarted.
  992.  
  993.     If the timer expires, another RPOS packet is transmitted by the
  994.     receiver. This is repeated until the maximum number of retries has
  995.     been reached.
  996.  
  997.     If the receiver encounters more missing or invalid DATA packets at
  998.     the same offset than it finds acceptable and it is not the originator
  999.     of the session, it may decide to revert to a one-way transfer and
  1000.     wait with sending the remainder of its own files until the remote has
  1001.     transmitted its end of batch signal. It is possible that some hard-
  1002.     ware is not capable or well suited for a bi-directional file transfer
  1003.     involving large volumes of data (see description of the IDLE packet).
  1004.  
  1005.  
  1006.     DATAACK packet
  1007.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  1008.     Transmitted by the receiver with its current file offset after
  1009.     receiving a valid DATA packet.
  1010.  
  1011.  
  1012.                               DATAACK packet data
  1013.                           םגגגגגגגגגגגגגגגגגגגגגגגג™
  1014.                           ø    Long file offset    ø
  1015.                           ijגגגגגגגגגגגגגגגגגגגגגגגגך
  1016.  
  1017.     This packet is only transmitted if there is a window in operation
  1018.     for that direction (selected in the INIT stage of the session), in
  1019.     which case the sender uses the DATAACK file offsets to manage its
  1020.     transmit window. If the sender's file offset is greater than or equal
  1021.     to the last DATAACK offset received plus the window size, no more
  1022.     data is transmitted by the sender until a DATAACK packet is received
  1023.     which allows the sender to proceed without exceeding the window size.
  1024.  
  1025.     While waiting for the DATAACK packet, the sender checks its timer
  1026.     and retry counter. If the timer expires before a valid DATAACK packet
  1027.     is received, the next DATA packet is transmitted, the retry counter
  1028.     incremented, and the timer restarted with half the normal timeout.
  1029.     This system ensures that the two sides do not end up waiting for
  1030.     each other in case packets are lost; the receiver will respond with
  1031.     either a DATAACK or RPOS packet. Receipt of a DATAACK packet does not
  1032.     reset the braindead timer.
  1033.  
  1034.     There are two windowing systems the receiver can use: sliding window
  1035.     or segmented streaming.
  1036.  
  1037.     If the receiver is capable of simultaneous serial and disk I/O, it
  1038.     will transmit a DATAACK packet for every received DATA packet, or
  1039.     every few DATA packets if it wants to be more economical with line
  1040.     capacity.
  1041.     Sliding window transmission is just a method of keeping the runahaid
  1042.     of the transmitter within reasonable limits (for sattelite or network
  1043.     links with long delays), thereby allowing for faster error recovery.
  1044.     Because of Hydra's tolerancy to delays and method of error recovery,
  1045.     sliding windows transmission is not normally required and full
  1046.     streaming can be used.
  1047.  
  1048.     If however the receiver is not capable of simultaneous serial and
  1049.     disk I/O, it will will process received DATA packets until the window
  1050.     size is reached (or slightly exceeded), write the received packets to
  1051.     disk, and then transmit one DATAACK packet to signal that it can
  1052.     receive the next segment of data.
  1053.  
  1054.     If the sender cannot handle simultaneous serial and disk I/O, it can
  1055.     apply the segmented streaming technique for reading data segments of
  1056.     the negotiated window size from disk.
  1057.  
  1058.  
  1059.     RPOS packet
  1060.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  1061.     Transmitted by the receiver to force the sender to seek to a specific
  1062.     position in the file and resume the transfer (as described above).
  1063.  
  1064.     The RPOS packet is also used by the receiver to skip a file once the
  1065.     transfer has been initiated. This is done by transmitting a RPOS
  1066.     packet with -2 as the desired offset and then waiting for a EOF
  1067.     packet with the same offset (-2). Once the EOF packet is received,
  1068.     the receiver responds to it by transmitting a EOFACK packet and then
  1069.     proceeds to wait for the next FINFO packet.
  1070.  
  1071.  
  1072.                           RPOS packet dependent data
  1073.                   םגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג™
  1074.                   ø Long file offset                       ø
  1075.                   בגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  1076.                   ø Desired datablock size (word, 64-2048) ø
  1077.                   בגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  1078.                   ø Long RPOS packet ID                    ø
  1079.                   ijגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגך
  1080.  
  1081.  
  1082.                                  File offsets 
  1083.              םגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג™
  1084.              øOffsetøDescription                                ø
  1085.              בגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  1086.              ø >=0  øSeek to specified offset and resume sendingø
  1087.              ø  -2  øSend file during another batch (not now)   ø
  1088.              ijגגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגך
  1089.  
  1090.     The desired data blocksize field tells the sender what blocksize
  1091.     to use when it resumes transmitting from the specified file offset.
  1092.  
  1093.     Each new RPOS packet should be given a different packet ID. This
  1094.     allows the sender to identify and ignore duplicate RPOS packets.
  1095.     The ID need not be sequential, but it must not have the same value as
  1096.     any other RPOS packet sent during the transmission of the same file.
  1097.     A RPOS ID value of zero (0) is not permitted. The same ID value is
  1098.     only used when sending multiple RPOS packets due to an expired RPOS
  1099.     packet timer as described above (DATA packet).
  1100.  
  1101.  
  1102.     EOF packet
  1103.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  1104.     Indicates that the end of the file has been reached by the sender.
  1105.     The packet is transmitted after the last DATA packet with file data.
  1106.     The EOF packet only contains one field which holds the current file
  1107.     offset of the sender (i.e. the actual size of the file).
  1108.  
  1109.     After the EOF packet has been transmitted, the timer is set to the
  1110.     normal timeout value. The sender then waits for an EOFACK packet
  1111.     from the remote or for the timer to expire. In the event of a
  1112.     timeout, the transmit/wait sequence is repeated with half the normal
  1113.     timeout value until the maximum number of retries has been reached.
  1114.  
  1115.     In the event that the receiver requests to skip the file by
  1116.     transmitting a RPOS(-2) packet (see RPOS packet), the EOF packet
  1117.     contains the same value (-2). If the sender wants to skip the file
  1118.     currently being transmitted, it issues an EOF packet with -2 as the
  1119.     offset value.
  1120.  
  1121.     EOF packets with an incorrect offset should be treated by the
  1122.     receiver as if it was an incorrect DATA packet (i.e. transmitting an
  1123.     RPOS packet). Accepted EOF packets are acknowledged by transmitting
  1124.     an EOFACK packet.
  1125.  
  1126.  
  1127.                                 EOF packet data
  1128.                      םגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג™
  1129.                      ø Long file offset or special code ø
  1130.                      ijגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגך
  1131.  
  1132.  
  1133.                          File offsets and special value
  1134.                םגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג™
  1135.                øOffsetøDescription                             ø
  1136.                בגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  1137.                ø >=0  øFinal offset in file (size of file)     ø
  1138.                ø  -2  øSend file during another batch (not now)ø
  1139.                ijגגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגך
  1140.  
  1141.  
  1142.     EOFACK packet
  1143.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  1144.     Transmitted in response to an accepted EOF packet. After transmitting
  1145.     this packet, the receiver waits for the FINFO packet of the next file
  1146.     or end of batch.
  1147.  
  1148.  
  1149.     END packet                                               (HEX format)
  1150.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  1151.     Once all files have been transmitted by both sides and no device
  1152.     packets remain to be transmitted, the end of session sequence is
  1153.     initiated. END packets are always sent in HEX format.
  1154.  
  1155.     Two END packets are transmitted and the transmit timer set to half
  1156.     the normal timeout. The application then waits for an END packet from
  1157.     the remote or for the transmit timer to expire. In the event of a
  1158.     timeout, the transmit/wait sequence is repeated until the maximum
  1159.     number of retries has been reached. At this point, the HYDRA session
  1160.     may be considered to be successful as both batches were completed.
  1161.  
  1162.     If an END packet is received before timeout, another three (3) END
  1163.     packets are transmitted and the protocol exits. Both sides need to
  1164.     transmit END packets and receive at least one from the remote.
  1165.  
  1166.  
  1167.     IDLE packet                                              (HEX format)
  1168.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  1169.     The IDLE packet is used to let the remote know that the application
  1170.     is still alive. This is only applicable in uni-directional transfer
  1171.     mode to let the remote know that your application is still alive when
  1172.     it is receiving files, and after having transmitted an end of batch
  1173.     signal to the remote and not having any more files to send for the
  1174.     remainder of the session.
  1175.  
  1176.     When applicable, the IDLE packet is transmitted every 20 seconds. The
  1177.     remote resets its braindead timer upon receipt of an IDLE packet. If
  1178.     an application receives an IDLE packet while it is in a state where
  1179.     it is transmitting IDLE packets to the remote, something is wrong.
  1180.     This could occur if both sides have accidentally switched to one-way
  1181.     mode waiting for the remote to finish its batch. In this situation,
  1182.     one-way should be disabled to prevent a complete deadlock. Note that
  1183.     if both sides have finished their batch, the end of session sequence
  1184.     (see END packet) should be initiated.
  1185.  
  1186.  
  1187.     DEVDATA packet
  1188.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  1189.     Support for the DEVDATA and DEVDACK packets is optional and indicated
  1190.     in the INIT packet with the DEV flag in the "Supported options"
  1191.     field. The ID value is a long, different for each new device data
  1192.     packet sent. A value of zero (0) is not permitted.
  1193.  
  1194.     Only one DEVDATA packet may be transmitted at a time; the side
  1195.     issuing it then waits either for a timeout of the device transmit
  1196.     timer, or for a DEVDACK packet with the correct ID value to be
  1197.     received from the remote. If the timer expires before a correct
  1198.     DEVDACK packet is received, the DEVDATA packet is again transmitted,
  1199.     and the nnumber of device transmit retries incremented. If the
  1200.     maximum number of retries is reached, the HYDRA session is aborted;
  1201.     apparently the other is not functioning properly, or data is not
  1202.     getting through. In either case, the normal operation of the
  1203.     protocol (transferring files) will also fail.
  1204.  
  1205.     The name of the device to which the data is addressed is transmitted
  1206.     as an uppercase fixed-length three character NUL terminated string.
  1207.     There are two pre-defined device names as described below. If an
  1208.     unknown device name is specified, or a duplicate DEVDATA packet is
  1209.     received (one with the same ID value as a previously received and
  1210.     acknowledged DEVDATA packet), the packet is simply discarded after
  1211.     transmitting a DEVDACK packet with the corresponding ID value.
  1212.  
  1213.     DEVDATA and DEVDACK packets do not reset the braindead timer. They
  1214.     operate independently from the normal protocol. Device packets may
  1215.     only be transmitted after the initialization sequence, and before
  1216.     both sides have completed their batch. If a DEVDATA packet has not
  1217.     yet been acknowledged, the end of session sequence is delayed until
  1218.     a DEVDACK packet has been sent in response.
  1219.  
  1220.  
  1221.                        DEVDATA packet dependent data
  1222.            םגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג™
  1223.            ø Long DEVDATA packet ID value                     ø
  1224.            בגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  1225.            ø 3 character uppercase device name, NUL terminatedø
  1226.            בגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  1227.            ~ Variable length device data block (0-2048)       ~
  1228.            ijגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגך
  1229.  
  1230.  
  1231.                            Predefined device names
  1232.                 םגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג™
  1233.                 øDevøDescription                          ø
  1234.                 בגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגœ
  1235.                 øMSGøPrint data in protocol message windowø
  1236.                 øCONøPrint data to user console           ø
  1237.                 ijגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגך
  1238.  
  1239.     The MSG device may be used to notify the remote of protocol-specific
  1240.     issues, i.e. "One-way transfer mode". Such messages may be logged,
  1241.     but should not be considered to be machine-readable.
  1242.  
  1243.     The CON device may be used to implement a "chat" or conversation
  1244.     feature. This is a special case in which a session *can* be prolonged
  1245.     after end of batch, but not against the remote's will.
  1246.     While chat is enabled, there is no transition from the REND to the
  1247.     END transmitter state. When a CON device packet is transmitted in
  1248.     chat mode and the txstate is REND, the own braindead timer is reset.
  1249.     If the other side does initiate the end sequence by sending an END
  1250.     packet, the chat mode is immediately terminated and the session ended
  1251.     in a clean manner. If one side does not want to (continue) chat, and
  1252.     the other side does not comply, the one side will abort after a
  1253.     braindead timeout, so this chat system does not mean a security flaw.
  1254.     Each side is responsible for keeping the session going on his end
  1255.     until its own user has finished chatting. It is suggested that the
  1256.     software apply a timeout of say 1 minute to keyboard input, ending
  1257.     the chat automatically if the user stops typing but does not exit
  1258.     chat mode. Also, the chat mode should be initiated with a special key
  1259.     so that it can not erronously be started or prolonged.
  1260.  
  1261.  
  1262.     DEVDACK packet
  1263.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  1264.     Transmitted in response to a DEVDATA packet. The device data ID value
  1265.     must correspond to the ID of the previously received DEVDATA packet.
  1266.  
  1267.  
  1268.                               DEVDACK packet data
  1269.                          םגגגגגגגגגגגגגגגגגגגגגגגגגגג™
  1270.                          ø Long device data ID value ø
  1271.                          ijגגגגגגגגגגגגגגגגגגגגגגגגגגגך
  1272.  
  1273.  
  1274.  
  1275. DEVICE sender (devtxstate HTD_...)
  1276. םגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגג™
  1277. øState   øPredicate(s)                  øAction(s)                 øNext stateø
  1278. בגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1279. øBegin   ø                              ødevtxid = 0               øDONE      ø
  1280. ø        ø                              øreset devtxtimer          ø          ø
  1281. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1282. øDONE    ø1øwish to send device data &  øincrease devtxid          øDATA      ø
  1283. ø        ø øother side allows DEV pkts  ødevtxretries = 0          ø          ø
  1284. ø        ø ø                            øreset devtxtimer          ø          ø
  1285. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1286. ø        ø2øwish to send device data &  øTell calling function     ø          ø
  1287. ø        ø øother doesn't allow DEV pktsøit's not on...            ø          ø
  1288. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1289. øDATA    ø1ødevtxretries == 10          øReport too many errors    øAbort     ø
  1290. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1291. ø        ø2øelse (devtxretries < 10)    øtxpkt DEVDATA(id,dev,data)øDACK      ø
  1292. ø        ø ø                            ødevtxtimer = timeout      ø          ø
  1293. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1294. øDACK    ø1ørxpkt DACK &                øreset devtxtimer          øDONE      ø
  1295. ø        ø øDACK(id) == devtxid         ø                          ø          ø
  1296. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1297. ø        ø2ødevtxtimer expired          øReport devtx timeout      øDATA      ø
  1298. ø        ø ø                            øincrease devtxretries     ø          ø
  1299. ijגגגגגגגגIJגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגך
  1300.  
  1301. DEVICE RECEIVER
  1302. םגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגג™
  1303. øState   øPredicate(s)                  øAction(s)                 øNext stateø
  1304. בגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1305. øBegin   ø                              ødevrxid = 0               øDONE      ø
  1306. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1307. øDONE    ø1ørxpkt DEVDATA               øtxpkt DEVDACK(id)         øCheckID   ø
  1308. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1309. øCheckID ø1øDEVDATA(id) != devrxid      ødevrxid = DEVDATA(id)     øProcess   ø
  1310. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1311. ø        ø2øelse (apparent duplicate)   ø                          øDONE      ø
  1312. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1313. øProcess ø1øDEVDATA(dev) == MSG         øPrint protocol message    øDONE      ø
  1314. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1315. ø        ø2øDEVDATA(dev) == CON         øOutput to user console    øDONE      ø
  1316. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1317. ø        ø3øDEVDATA(dev) == known&ok    øCall processing routine   øDONE      ø
  1318. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1319. ø        ø4øelse (unknown/not-ok device)øOne-way into bitbucket    øDONE      ø
  1320. ijגגגגגגגגIJגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגך
  1321.  
  1322.  
  1323.     Packet length and data block size
  1324.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  1325.     The maximum length of a source data block (i.e. raw, non processed
  1326.     input file or device data) is 2048 bytes. The maximum allowed length
  1327.     of the packet data is 2048 + 8 = 2056 bytes. The eight bytes are to
  1328.     provide sufficient room for the additional fields in the DATA and
  1329.     DEVDATA packets. Packetizing adds an additional three to five bytes.
  1330.     The maximum length of a framed packet being transmitted can be three
  1331.     times the size of its source data depending on what type of encoding
  1332.     scheme is used (ASC, HEX, UUE, BIN). The minimum length of a data
  1333.     block is 64 bytes.
  1334.  
  1335.     The block size of DATA packets is based on the physical (DCE) link
  1336.     speed and is established as follows:
  1337.  
  1338.             םגגגגגגגגגאגגגגגגגגגגגגגגגגגגאגגגגגגגגגגגגגגגגגגג™
  1339.             øDCE speedøMaximum block sizeøStarting block sizeø
  1340.             בגגגגגגגגגדגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגœ
  1341.             ø  300 bpsø     256 bytes    ø     256 bytes     ø
  1342.             ø 1200 bpsø     512 bytes    ø     256 bytes     ø
  1343.             ø 2400 bpsø    1024 bytes    ø     512 bytes     ø
  1344.             ø>2400 bpsø    2048 bytes    ø     512 bytes     ø
  1345.             ijגגגגגגגגגIJגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגגגגגגגגגגך
  1346.  
  1347.     The blocksize is initialized to the starting blocksize when a session
  1348.     is first started. After each kilobyte of file data transmitted, the
  1349.     blocksize is doubled until it reaches the maximum allowed blocksize.
  1350.  
  1351.     When the maximum allowed blocksize has been reached, the variable
  1352.     keeping track of how many bytes are needed to increase the blocksize
  1353.     is reset to zero.
  1354.  
  1355.     If a request for retransmission (RPOS packet) is received from the
  1356.     receiver, the blocksize is immediately set to that specified in the
  1357.     retransmission request. Every time this occurs, the number of bytes
  1358.     needed to double the blocksize is increased by 1024 with a maximum of
  1359.     of 8192 bytes. The end result is that more data has to be
  1360.     successfully transmitted before the blocksize is increased for each
  1361.     error that occurs.
  1362.  
  1363.     The length of a data block is dynamic and always in the range 0-2048
  1364.     bytes. A data block is never padded. If there is insufficient data
  1365.     to fill a block of the current blocksize, the blocksize is adjusted
  1366.     to the amount of remaining data.
  1367.  
  1368.     The blocksize logic is not reset between files in a session.
  1369.  
  1370.  
  1371.     Timers and retry counters
  1372.     ללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללל
  1373.     Each process in the protocol (transmit, receive and device transmit)
  1374.     has its own timer and retry counter, and there is one overall
  1375.     braindead timer. Allowed are 10 tries, the braindead timeout is 120
  1376.     seconds, and the other timeouts are based on the speed of the line
  1377.     and the state of the protocol. It can be calculated as (40960/DCE
  1378.     rate), with a minimum of 10 seconds and a maximum of 60 seconds.
  1379.  
  1380.                      םגגגגגגגגגאגגגגגגגגגגאגגגגגגגגגג™
  1381.                      øDCE speedøTimeout   øHalf      ø
  1382.                      בגגגגגגגגגדגגגגגגגגגגדגגגגגגגגגגœ
  1383.                      ø  300 bpsø60 secondsø30 secondsø
  1384.                      ø 1200 bpsø34 secondsø17 secondsø
  1385.                      ø 2400 bpsø17 secondsø 8 secondsø
  1386.                      ø>2400 bpsø10 secondsø 5 secondsø
  1387.                      ijגגגגגגגגגIJגגגגגגגגגגIJגגגגגגגגגגך
  1388.  
  1389.     If the output buffer is empty, the timeout value is halved. In
  1390.     general, this is the case if the number of tries is greater than zero
  1391.     and during the init and end sequences. These timeouts are not fatal
  1392.     situations, they just give the remote a reasonable amount of time to
  1393.     receive and respond to a packet before a retry occurs. Duplicate
  1394.     packets are always identified and ignored. A retry counter is reset
  1395.     if there is a change of state, or a reposition different from the
  1396.     previous file offset occurs.
  1397.  
  1398.     The braindead timer monitors useful data from the other side: a first
  1399.     response to a transmitted supervisiory packet, or a received packet
  1400.     with file data at the correct offset. Device packets and packets that
  1401.     do not signify any progress of the protocol do not affect the
  1402.     braindead timer.
  1403.  
  1404.     No other timers (such as one between characters in a packet) are
  1405.     necessary.
  1406.  
  1407.  
  1408.     Aborting a session
  1409.     ללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללל
  1410.     A session is aborted with five consequetive CAN (^X or ASCII 24)
  1411.     characters. Whenever a state table mentions "Abort", the following
  1412.     procedure is to be followed:
  1413.  
  1414.     Clear the output buffer and transmit eight CAN characters followed by
  1415.     ten BS (^H or ASCII 8) characters; wait a few seconds for the data to
  1416.     be transmitted to the remote, purge the input buffer and exit the
  1417.     protocol code.
  1418.  
  1419.  
  1420. GENERAL sender (txstate HTX_...)
  1421. םגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגג™
  1422. øState   øPredicate(s)                  øAction(s)                 øNext stateø
  1423. בגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1424. øBegin   ø                              øtxretries = 0             øSTART     ø
  1425. ø        ø                              øreset txtimer             ø          ø
  1426. ø        ø                              øblksize = startblksize    ø          ø
  1427. ø        ø                              øgoodbytes = 0             ø          ø
  1428. ø        ø                              øgoodneeded = 1024         ø          ø
  1429. ø        ø                              øbraintimer = 120          ø          ø
  1430. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1431. øSTART   ø1øtxretries == 10             øReport too many errors    øAbort     ø
  1432. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1433. ø        ø2øelse (txretries < 10)       øtxstr AutoStart           øSWAIT     ø
  1434. ø        ø ø                            øtxpkt START               ø          ø
  1435. ø        ø ø                            øtxtimer = 5               ø          ø
  1436. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1437. øSWAIT   ø1ørxpkt START or              øtxretries = 0             øINIT      ø
  1438. ø        ø ørxpkt INIT                  øreset txtimer             ø          ø
  1439. ø        ø ø                            øbraintimer = 120          ø          ø
  1440. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1441. ø        ø2øtxtimer expired             øReport tx timeout         øSTART     ø
  1442. ø        ø ø                            øincrement txretries       ø          ø
  1443. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1444. øINIT    ø1øtxretries == 10             øReport too many errors    øAbort     ø
  1445. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1446. ø        ø2øelse (txretries < 10)       øtxpkt INIT(linkinfo)      øINITACK   ø
  1447. ø        ø ø                            øtxtimer = timeout/2       ø          ø
  1448. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1449. øINITACK ø1ørxpkt INITACK               øtxretries = 0             øRINIT     ø
  1450. ø        ø ø                            øreset txtimer             ø          ø
  1451. ø        ø ø                            øbraintimer = 120          ø          ø
  1452. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1453. ø        ø2øtxtimer expired             øReport tx timeout         øINIT      ø
  1454. ø        ø ø                            øincrement txretries       ø          ø
  1455. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1456. øRINIT   ø1ørxstate != INIT             ø                          øNextFile  ø
  1457. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1458. øNextFileø1øNo files left?              øReport end of batch       øToFName   ø
  1459. ø        ø ø                            øSet NULL fileinfo         ø          ø
  1460. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1461. ø        ø2øCan access next file?       øSet up fileinfo           øToFName   ø
  1462. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1463. ø        ø3øCan't access file?          øReport access failure     øNextFile  ø
  1464. בגגגגגגגגדגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1465. øToFName ø                              øtxsyncid = 0              øFINFO     ø
  1466. ø        ø                              øtxretries = 0             ø          ø
  1467. ø        ø                              øreset txtimer             ø          ø
  1468. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1469. øFINFO   ø1øtxretries == 10             øReport too many errors    øAbort     ø
  1470. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1471. ø        ø2øtxretries > 0               øtxpkt FINFO(fileinfo)     øFINFOACK  ø
  1472. ø        ø ø                            øtxtimer = timeout/2       ø          ø
  1473. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1474. ø        ø3øelse (txretries == 0)       øtxpkt FINFO(fileinfo)     øFINFOACK  ø
  1475. ø        ø ø                            øtxtimer = timeout         ø          ø
  1476. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1477. øFINFOACKø1øNULL fname (end of batch) & øtxtimer = idletimeout     øREND      ø
  1478. ø        ø ørxpkt FINFOACK              øbraintimer = 120          ø          ø
  1479. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1480. ø        ø2ørxpkt FINFOACK &            øtxpos = FINFOACK(pos)     øDATA      ø
  1481. ø        ø øFINFOACK(pos) >= 0          øtxretries = 0             ø          ø
  1482. ø        ø ø                            øtxlastack = 0             ø          ø
  1483. ø        ø ø                            øbraintimer = 120          ø          ø
  1484. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1485. ø        ø3ørxpkt FINFOACK &            øThey already have file    øNextFile  ø
  1486. ø        ø øFINFOACK(pos) == -1)        øbraintimer = 120          ø          ø
  1487. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1488. ø        ø4ørxpkt FINFOACK &            øSkip this file for now    øNextFile  ø
  1489. ø        ø øFINFOACK(pos) == -2)        øbraintimer = 120          ø          ø
  1490. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1491. ø        ø5øtxtimer expired             øReport tx timeout         øFINFO     ø
  1492. ø        ø ø                            øinrease txretries         ø          ø
  1493. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1494. øDATA    ø1ørxstate != Done &           øtxtimer = idletimeout     øXWAIT     ø
  1495. ø        ø øhdxlink == True             ø                          ø          ø
  1496. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1497. ø        ø2ørxpkt DATAACK &             øtxlastack = DATAACK(pos)  ø          ø
  1498. ø        ø øDATAACK(pos) > txlastack    ø                          ø          ø
  1499. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1500. ø        ø3ørxpkt RPOS &                øSkip this file for now    øSkipFile  ø
  1501. ø        ø øRPOS(pos) < 0               øbraintimer = 120          ø          ø
  1502. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1503. ø        ø4ørxpkt RPOS &                øReport too many errors    øAbort     ø
  1504. ø        ø øRPOS(id) == txsyncid &      ø                          ø          ø
  1505. ø        ø øinc txretries == 10         ø                          ø          ø
  1506. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1507. ø        ø5ørxpkt RPOS &                øtxpos = RPOS(pos)         ø          ø
  1508. ø        ø øRPOS(id) != txsyncid &      øtxsyncid = RPOS(id)       ø          ø
  1509. ø        ø øRPOS(pos) >= 0              øtxretries = 1             ø          ø
  1510. ø        ø ø                            øblksize = RPOS(blksize)   ø          ø
  1511. ø        ø ø                            øgoodbytes = 0             ø          ø
  1512. ø        ø ø                            øinc goodneeded + 1024     ø          ø
  1513. ø        ø ø                            øif (goodneeded > 8192)    ø          ø
  1514. ø        ø ø                            ø   goodneeded = 8192      ø          ø
  1515. ø        ø ø                            øbraintimer = 120          ø          ø
  1516. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1517. ø        ø6øFile seek/read error or     øSkip this file for now    øSkipFile  ø
  1518. ø        ø øuser wishes to skip file    ø                          ø          ø
  1519. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1520. ø        ø7øtxwindow &                  øif (txretries > 0)        øDATAACK   ø
  1521. ø        ø øtxpos >= txlastack+txwindow ø   txtimer = timeout/2    ø          ø
  1522. ø        ø ø                            øelse                      ø          ø
  1523. ø        ø ø                            ø   txtimer = timeout      ø          ø
  1524. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1525. ø        ø8øEnough room in output &     øtxpkt DATA(pos,data)      ø          ø
  1526. ø        ø ømore filedata(blksize) to goøtxpos += datalen          ø          ø
  1527. ø        ø ø                            øinc goodbytes + datalen   ø          ø
  1528. ø        ø ø                            øif goodbytes > goodneeded ø          ø
  1529. ø        ø ø                            ø   Store txpos,blksize    ø          ø
  1530. ø        ø ø                            ø   blksize * 2 (max.2048) ø          ø
  1531. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1532. ø        ø9øEnd of filedata reached     ø                          øEOF       ø
  1533. בגגגגגגגגדגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1534. øSkipFileø                              øtxpos = -1                øEOF       ø
  1535. ø        ø                              øtxretries = 0             ø          ø
  1536. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1537. øDATAACK ø1øtxretries == 10             øReport too many errors    øAbort     ø
  1538. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1539. ø        ø2ørxpkt DATAACK &             øtxlastack = DATAACK(pos)  øDATA      ø
  1540. ø        ø øDATAACK(pos) > txlastack &  øtxretries = 0             ø          ø
  1541. ø        ø øtxpos < DATAACK(pos) + txwinøreset txtimer             ø          ø
  1542. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1543. ø        ø3ørxpkt RPOS                  øHandle RPOS in state DATA ø          ø
  1544. ø        ø ø                            øbut stay in this state    ø          ø
  1545. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1546. ø        ø4øtxtimer expired             øReport tx timeout         øDATA      ø
  1547. ø        ø ø                            øincrement txretries       ø          ø
  1548. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1549. øXWAIT   ø1ørxstate == Done             øreset txtimer             øDATA      ø
  1550. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1551. ø        ø2ørxpkt DATAACK &             øtxlastack = DATAACK(pos)  ø          ø
  1552. ø        ø øDATAACK(pos) > txlastack    ø                          ø          ø
  1553. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1554. ø        ø3ørxpkt RPOS                  øHandle RPOS in state DATA ø          ø
  1555. ø        ø ø                            øbut stay in this state    ø          ø
  1556. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1557. ø        ø4ørxpkt IDLE                  øhdxlink = False           øDATA      ø
  1558. ø        ø ø                            øreset txtimer             ø          ø
  1559. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1560. ø        ø5øtxtimer expired             øtxpkt IDLE                ø          ø
  1561. ø        ø ø                            øtxtimer = idletimeout     ø          ø
  1562. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1563. øEOF     ø1øtxretries == 10             øReport too many errors    øAbort     ø
  1564. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1565. ø        ø2øtxretries > 0               øtxpkt EOF(txpos)          øEOFACK    ø
  1566. ø        ø ø                            øtxtimer = timeout/2       ø          ø
  1567. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1568. ø        ø3øelse (txretries == 0)       øtxpkt EOF(txpos)          øEOFACK    ø
  1569. ø        ø ø                            øtxtimer = timeout         ø          ø
  1570. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1571. øEOFACK  ø1ørxpkt EOFACK                øbraintimer = 120          øNextFile  ø
  1572. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1573. ø        ø2ørxpkt DATAACK &             øtxlastack = DATAACK(pos)  ø          ø
  1574. ø        ø øDATAACK(pos) > txlastack    ø                          ø          ø
  1575. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1576. ø        ø3ørxpkt RPOS &                ørxpos == -2               øEOF       ø
  1577. ø        ø øRPOS(pos) == -2 &           ø                          ø          ø
  1578. ø        ø ørxpos != -2                 ø                          ø          ø
  1579. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1580. ø        ø4ørxpkt RPOS &                øHandle as in state DATA   øDATA      ø
  1581. ø        ø øRPOS(pos) >= 0              ø                          ø          ø
  1582. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1583. ø        ø5øtxtimer expired             øReport tx timeout         øEOF       ø
  1584. ø        ø ø                            øincrement txretries       ø          ø
  1585. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1586. øREND    ø1ørxstate == DONE &           øtxretries = 0             øEND       ø
  1587. ø        ø ødevtxstate == DONE          ø                          ø          ø
  1588. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1589. ø        ø2øtxtimer expired             øtxpkt IDLE                ø          ø
  1590. ø        ø ø                            øtxtimer = idletimeout     ø          ø
  1591. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1592. øEND     ø1øtxretries == 10             ø                          øAbort     ø
  1593. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1594. ø        ø2øelse (txretries < 10)       øtxpkt END (twice)         øENDACK    ø
  1595. ø        ø ø                            øtxtimer = timeout/2       ø          ø
  1596. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1597. øENDACK  ø1ørxpkt END                   øtxpkt END (thrice)        øDone      ø
  1598. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1599. ø        ø2øtxtimer expired             øReport tx timeout         øEND       ø
  1600. ø        ø ø                            øincrement txretries       ø          ø
  1601. ijגגגגגגגגIJגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגך
  1602.  
  1603.  
  1604.  
  1605. GENERAL RECEIVER (rxstate HRX_...)
  1606. םגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגגגגגגגגגגגגגגגגגגאגגגגגגגגגג™
  1607. øState   øPredicate(s)                  øAction(s)                 øNext stateø
  1608. בגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1609. øBegin   ø                              øreset rxtimer             øSTART     ø
  1610. ø        ø                              ølastrxdlen = startblksize ø          ø
  1611. ø        ø                              ø(tx handles braintimer)   ø          ø
  1612. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1613. øINIT    ø1ørxpkt INIT &                øtxpkt INITACK             øFINFO     ø
  1614. ø        ø øINIT(options) are compatibleøSet options               ø          ø
  1615. ø        ø ø                            øbraintimer = 120          ø          ø
  1616. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1617. ø        ø2øINIT(options) not compatibleøReport link failure       øAbort     ø
  1618. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1619. øFINFO   ø1ørxpkt INIT (apparent dup)   øtxpkt INITACK             ø          ø
  1620. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1621. ø        ø2ørxpkt FINFO &               øReport end of batch       ø          ø
  1622. ø        ø øFINFO(fileinfo) == Empty    øtxpkt FINFOACK            øDONE      ø
  1623. ø        ø ø                            øbraintimer = 120          ø          ø
  1624. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1625. ø        ø3ørxpkt FINFO &               ødo not want this file     ø          ø
  1626. ø        ø øwe already have file        øtxpkt FINFOACK(-1)        ø          ø
  1627. ø        ø ø                            øbraintimer = 120          ø          ø
  1628. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1629. ø        ø4ørxpkt FINFO &               øSkip this file for now    ø          ø
  1630. ø        ø øopen/diskspace error        øtxpkt FINFOACK(-2)        ø          ø
  1631. ø        ø ø                            øbraintimer = 120          ø          ø
  1632. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1633. ø        ø5ørxpkt FINFO &               ørxpos = resume offset     øToData    ø
  1634. ø        ø øfile we want to resume      ø                          ø          ø
  1635. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1636. ø        ø6ørxpkt FINFO &               ørxpos = 0                 øToData    ø
  1637. ø        ø ønew file for us             ø                          ø          ø
  1638. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1639. ø        ø7ørxpkt EOF (apparent dup)    øtxpkt EOFACK              ø          ø
  1640. בגגגגגגגגדגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1641. øToData  ø                              øtxpkt FINFOACK(rxpos)     øDATA      ø
  1642. ø        ø                              ørxsyncid = 0              ø          ø
  1643. ø        ø                              ørxlastsync = 0;           ø          ø
  1644. ø        ø                              ørxretries = 0             ø          ø
  1645. ø        ø                              øreset rxtimer             ø          ø
  1646. ø        ø                              øbraintimer = 120          ø          ø
  1647. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1648. øDATA    ø1ørxpkt FINFO (apparent dup)  øtxpkt FINFOACK(rxpos)     ø          ø
  1649. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1650. ø        ø2ørxpkt DATA &                øStore data                ø          ø
  1651. ø        ø øDATA(pos) == rxpos          ørxpos += datalen          ø          ø
  1652. ø        ø ø                            ørxretries = 0             ø          ø
  1653. ø        ø ø                            ørxlastsync = rxpos        ø          ø
  1654. ø        ø ø                            øreset rxtimer             ø          ø
  1655. ø        ø ø                            øbraintimer = 120          ø          ø
  1656. ø        ø ø                            øif (rxwindow)             ø          ø
  1657. ø        ø ø                            ø   txpkt DATAACK(rxpos)   ø          ø
  1658. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1659. ø        ø3ørxpkt DATA &                øReport bad rxpos          øBadPos    ø
  1660. ø        ø øDATA(pos) != rxpos          ø                          ø          ø
  1661. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1662. ø        ø4ørxpkt EOF &                 øClose file, received ok   øOkEOF     ø
  1663. ø        ø øEOF(pos) == rxpos           ø                          ø          ø
  1664. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1665. ø        ø5ørxpkt EOF &                 øClose, save for resume    øOkEOF     ø
  1666. ø        ø øEOF(pos) == -2              ø                          ø          ø
  1667. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1668. ø        ø6ørxpkt EOF &                 øReport bad EOF            øBadPos    ø
  1669. ø        ø øEOF(pos) != rxpos           ø                          ø          ø
  1670. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1671. ø        ø7øFile write error or         øClose, save for resume    ø          ø
  1672. ø        ø øuser wishes to skip file    ørxpos = -2                ø          ø
  1673. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1674. ø        ø8ørxpkt IDLE &                øbraintimer = 120          ø          ø
  1675. ø        ø øhdxlink == False            ø                          ø          ø
  1676. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1677. øBadPos  ø1øDATA/EOF(pos) <= rxlastsync ørxretries = 0             øTimer     ø
  1678. ø        ø ø                            øreset rxtimer             ø          ø
  1679. ø        ø ø                            ørxlastsync = pos          ø          ø
  1680. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1681. ø        ø2øDATA/EOF(pos) > rxlastsync  ørxlastsync = pos          øTimer     ø
  1682. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1683. øTimer   ø1ørxtimer expired             ø                          øHdxLink   ø
  1684. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1685. ø        ø2øelse (rxtimer not expired)  ø                          øDATA      ø
  1686. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1687. øHdxLink ø1ørxretries > 4 &             øhdxlink = True            øRetries   ø
  1688. ø        ø øtxstate < REND &            ørxretries = 0             ø          ø
  1689. ø        ø øoriginator == False &       ø                          ø          ø
  1690. ø        ø øhdxlink == False            ø                          ø          ø
  1691. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1692. ø        ø2øelse (above not the case)   ø                          øRetries   ø
  1693. בגגגגגגגגדגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1694. øRetries ø1øinc rxretries == 10         øReport too many errors    øAbort     ø
  1695. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1696. ø        ø2ørxretries == 1              øincrease rxsyncid         øRPos      ø
  1697. ø        בגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1698. ø        ø3øelse (rxretries > 1)        ø                          øRPos      ø
  1699. בגגגגגגגגדגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1700. øRPos    ø                              ølastrxdatalen/=2 (min.64) øDATA      ø
  1701. ø        ø                              øtxpkt RPOS (rxpos,        ø          ø
  1702. ø        ø                              ø   lastrxdatalen,rxsyncid)ø          ø
  1703. ø        ø                              ørxtimer = timeout         ø          ø
  1704. בגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1705. øOkEOF   ø                              øtxpkt EOFACK              øFINFO     ø
  1706. ø        ø                              øreset rxtimer             ø          ø
  1707. ø        ø                              øbraintimer = 120          ø          ø
  1708. בגגגגגגגגדגאגגגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגגגגגגגגגגגגגגגגגדגגגגגגגגגגœ
  1709. øDONE    ø1ørxpkt FINFO (apparent dup)  øtxpkt FINFOACK(-2)        ø          ø
  1710. ijגגגגגגגגIJגIJגגגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגגגגגגגגגגגגגגגגגIJגגגגגגגגגגך
  1711.  
  1712.  
  1713.     HYDRA in FidoNet technology mailers
  1714.     ללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללל
  1715.     HYDRA is suitable for use in FidoNet mailers. It can be implemented
  1716.     for EMSI and FTS-6 mail sessions. The FTS-6 (YooHoo) capability bit
  1717.     for HYDRA is 0x0020 (DOES_HYDRA). The EMSI and IEMSI protocol
  1718.     capability flag is HYD.
  1719.  
  1720.     When utilizing HYDRA in a mail session, two complete batches are
  1721.     always performed. Little else differs from a normal FTS-6 ZedZap mail
  1722.     session. The first batch is used to transmit all mail, files, and
  1723.     file requests by both sides. The second batch is always performed,
  1724.     sending nothing if there are no file requests to honor. The data
  1725.     buffers are not purged between the two batches since HYDRA ignores
  1726.     any leftovers from the previous batch (END packets, etc.).
  1727.  
  1728.     To integrate HYDRA into an existing mailer, the same code used for
  1729.     the ZedZap session flow can be used, but instead of one transmit and
  1730.     one receive session, two transmit sessions (or batches) are used.
  1731.     When the HYDRA end of batch is initiated it will not be terminated
  1732.     until an end of batch has been received from the remote and the end
  1733.     of session sequence has been finished.
  1734.  
  1735.     Fido and FidoNet are registered marks of Tom Jennings and Fido
  1736.     Software.
  1737.  
  1738.  
  1739.     Error detection using CRCs
  1740.     ללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללל
  1741.     CRC (Cyclic Redundancy Check) values only provide their promised
  1742.     maximum error detection capability when properly applied, which
  1743.     involves calculating and transmitting low-bit first, presetting the
  1744.     CRC with all ones, and transmitting the ones' complement of the
  1745.     result. The receiver also initializes to all ones, processes all of
  1746.     the data AND the following CRC, and the result should match a "magic
  1747.     value" which is 0xf0b8 for the 16-bit CRC and 0xdebb20e3 for the
  1748.     32-bit CRC.
  1749.  
  1750.     The easiest and fastest way to perform CRC calculations is by using a
  1751.     table that does the algorithm's shift-operations in 8-bits at a time.
  1752.  
  1753.  
  1754.     CRC-16 error detection
  1755.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  1756.     16-bit CRC using the CCITT CRC-16 polynomial. This is the default at
  1757.     startup, and always used for HEX packets even if both sides are
  1758.     capable of handling 32-bit CRCs.
  1759.  
  1760.     This CRC-16 is not identical to the one used by the Xmodem and Zmodem
  1761.     file transfer protocols. The polynomial is the same
  1762.     (X^16+X^12+X^5+X^0 or 0x8408) but the bit-ordering is the opposite,
  1763.     and preconditioning and postconditioning is used as in 32-bit CRCs.
  1764.     This method is also used by the European version of X.25.
  1765.  
  1766.     The 16-bit CRC table is created as follows (pseudocode, the variable
  1767.     CRC16 and the table of 256 entries are 16-bit unsigned integers):
  1768.  
  1769.         FOR (i=0 TO 255)
  1770.             {
  1771.             CRC16=i
  1772.             FOR (N=1 TO 8)
  1773.                 {
  1774.                 IF (CRC16 AND 1)
  1775.                     CRC16=(CRC16 >> 1) XOR 0x8408
  1776.                 ELSE
  1777.                     CRC16=CRC16 >> 1
  1778.                 }
  1779.             CRC16TAB[i]=CRC16;
  1780.             }
  1781.  
  1782.     When processing data, each byte is run through the CRC calculation
  1783.     routine as follows (variable CRC stores the 16-bit CRC value/result,
  1784.     C is the next 8-bit char):
  1785.  
  1786.         CRC=CRC16TAB[(CRC XOR C) AND 0xff] XOR ((CRC>>8) AND 0x00ff)
  1787.  
  1788.  
  1789.     CRC-32 error detection
  1790.     גגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגגג
  1791.     32-bit CRC using the CCITT CRC-32 polynomial. Support of CRC-32 is
  1792.     optional and signalled in the INIT packet.
  1793.  
  1794.     If both sides indicate they can handle CRC-32, all packets except
  1795.     those transmitted in HEX format use this algorithm instead of CRC-16
  1796.     to improve error detection.
  1797.  
  1798.     This CRC-32 is identical to the one used by the Zmodem protocol.
  1799.     The polynomial is (0xedb88320):
  1800.  
  1801.     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
  1802.  
  1803.     The principal method of calculation, transmission, and checking is
  1804.     identical to CRC-16 as described above, but the "magic value" for
  1805.     32-bit CRC is 0xdebb20e3.
  1806.  
  1807.     The CRC-32 table is created as follows (pseudocode, the variable
  1808.     CRC32 and the table of 256 entries are 32-bit unsigned integers):
  1809.  
  1810.     FOR (i=0 TO 255)
  1811.         {
  1812.         CRC32=i
  1813.         FOR (N=1 TO 8)
  1814.             {
  1815.             IF (CRC32 AND 1)
  1816.                 CRC32 = (CRC32 >> 1) XOR 0xedb88320
  1817.             ELSE
  1818.                 CRC32 = CRC32 >> 1
  1819.             }
  1820.         CRC32TAB[i] = CRC32;
  1821.         }
  1822.  
  1823.     When processing data, each byte is run through the CRC calculation
  1824.     routine as follows (variable CRC stores the 32-bit CRC value/result,
  1825.     C is the next 8-bit character):
  1826.  
  1827.         CRC=CRC32TAB[(CRC XOR C) AND 0xFF] XOR ((CRC>>8) AND 0x00ffffff)
  1828.  
  1829.  
  1830.     The authors
  1831.     ללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללל
  1832.     The authors can be reached at the following addresses:
  1833.  
  1834.     Joaquim H. Homrighausen                    Arjen G. Lentz
  1835.     389, route d'Arlon                         Lentz Software Development
  1836.     L-8011 Strassen                            Langegracht 7B
  1837.     Luxembourg                                 3811 BT Amersfoort
  1838.                                                The Netherlands
  1839.     joho@ae.lu
  1840.     FidoNet 2:270/17                           aglentz@fido.lu
  1841.                                                FidoNet 2:283/512
  1842.  
  1843.  
  1844.     The name HYDRA
  1845.     ללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללללל
  1846.     Hydra is a greek mythological creature (the watersnake). Like the
  1847.     Nemeic lion, Hydra is the daughter of the giant Typhon and the snake
  1848.     Echidna.
  1849.  
  1850.     She grew up in the marshes of Lerna near/in Argolis (Argos). There
  1851.     she ate entire herds of cattle and destroyed large cropfields. Later,
  1852.     she lived in caves on a hill near the spring of Amymone.
  1853.  
  1854.     Hydra is a monstrous large snake with nine heads: eight mortal ones,
  1855.     and one (the middle one) immortal. She was defeated and killed by
  1856.     Heracles (Hercules) - son of Zeus and Alcemene, grandson of Perseus -
  1857.     as the second of his twelve tasks, with the help of his cousin
  1858.     Iolaos. Every time he cut of one of the heads with his sword, two new
  1859.     heads grew in its place. So Iolaos scorched the wound of each cut off
  1860.     head with burning branches so the head couldn't grow on again.
  1861.  
  1862.     Heracles buried the last and immortal head under a stone nearby. He
  1863.     also dipped his arrows in Hydra's poisonous blood, thereafter the
  1864.     wounds caused by those arrows were incurable.
  1865.  
  1866.  
  1867.     Also star constellation (sign of the watersnake) in the equatorial
  1868.     zone.
  1869.  
  1870.  
  1871.     Also a type of sweetwater polip (the Hydroidea Thin, tubeshaped body
  1872.     can be full contracted, just like the six (or more) tentacles. There
  1873.     is no generation change, the gender-products grow directly on the
  1874.     body.
  1875.  
  1876.     The animals catch their prey with nettlecells, and are very verocious.
  1877.     They can be found in various stilstanding and flowing water and were
  1878.     first described by Anthonie van Leeuwenhoek in the year 1704.
  1879.  
  1880.  
  1881.     Also small island (spelled Idhra in modern Greek) of the Sargonic
  1882.     group in the Aegean Sea, just of the eastern tip of the Argolis
  1883.     peninsula of the Peloponesus (Attika). Its length (NE/SW) is 21 km,
  1884.     with a total area of 49,6 square km. Its highest point is 597 meters
  1885.     above sea level. Population of 2794 (latest census: 1981). Only one
  1886.     real city with the same name as the island. Once quite wooded and
  1887.     well watered, now denuded and dry, with almost no arable land
  1888.     (infertile limestone). Certain times of the year the people have to
  1889.     ship in water from the main land. Its Turkish name is Camliza which
  1890.     means "Place of Pines".
  1891.  
  1892.     References:
  1893.          Dutch:  Oosthoeks Encyclopedie
  1894.                  Grote Winklerprins Encyclopedie
  1895.        English:  Encyclopaedia Brittannica
  1896.  
  1897.     --- end of "hydra.doc" ---
  1898.