home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / fido / ftsc_all.z43 / FTS-0007.EXT < prev    next >
Text File  |  1990-06-17  |  95KB  |  1,849 lines

  1. Document: FTS-0007
  2. Version:  002
  3. Date:     17-Jun-90
  4. Updates:  FTS-0001
  5.  
  6.  
  7.  
  8.  
  9.                   An Enhanced FidoNet(r) Technical Standard
  10.                 Extending FTS-0001 to include SEAlink protocol
  11.                     (Including Overdrive and File Restart)
  12.  
  13.                                June 17, 1990
  14.  
  15.  
  16.  
  17.  
  18. Status of this document:
  19.  
  20.     This document specifies an optional standard for the FidoNet community.
  21.     Implementation of the protocols defined in this document is not mandatory,
  22.     but all implementations of these protocols are expected to adhere to this
  23.     standard.  Distribution of this document is subject to the limitations of
  24.     the copyright notice displayed below.
  25.  
  26.  
  27.  
  28.     Copyright 1989 by Philip L. Becker.  Portions of this document are
  29.     copyright 1989 by the International FidoNet Association and are
  30.     incorporated with their consent.  The right to distribute for 
  31.     non-commercial use is granted to the FidoNet Technical Standards 
  32.     Committee, provided that no fee is charged.  This may be posted on FidoNet
  33.     electronic BBSs which charge no fee for accessing this document.   Any and
  34.     all other reproduction or excerpting requires theexplicit written consent
  35.     of the copyright holders.
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.     Introduction
  68.  
  69.     While the basic FTS-0001 protocol has become reasonably standardized, it
  70.     is technically inferior when used with modem speeds of 2400bps or higher,
  71.     and results in considerably slower file transfers than more sophisticated
  72.     protocols under many line and modem configurations.
  73.  
  74.     Very sophisticated protocols exist to allow absolute maximum efficiency,
  75.     but these protocols are much more difficult to implement than the basic
  76.     XMODEM used by FTS-0001.  A need exists for a standardized, easy to
  77.     implement extension to the FTS-0001 protocol which can gain much better
  78.     performance.  SEAlink is such an extension.  It is nearly as easy to
  79.     implement as the FTS-0001 protocol with which it is fully backward
  80.     compatible.  Despite its ease of implementation, it provides several
  81.     significant performance advantages. Among these advantages are:
  82.  
  83.          o  Transparently communicates with strict FTS-0001 implementations.
  84.  
  85.          o  Transparently communicates with FTS-0001 variants which omit
  86.             either the MODEM7 file name or the TeLink header block.
  87.  
  88.          o  Transparently becomes a sliding window XMODEM protocol when
  89.             communicating with a like implementation.  This sliding window
  90.             protocol gives significantly improved throughput when there is
  91.             an end-to-end delay.
  92.  
  93.          o  Offers a negotiated streaming mode for high speed asymmetrical
  94.             modems to further enhance throughput for such links.
  95.  
  96.          o  Offers a negotiated file restart capability which allows an
  97.             interrupted transfer to restart where it left off, reducing
  98.             time spent to retransmit the file.
  99.  
  100.     This document defines the  data structures and communication protocols
  101.     which a FidoNet SEAlink implementation must provide.  The implementor of
  102.     FidoNet compatible systems is the intended audience of this document.
  103.  
  104.     This document has the same overall format and state table descriptions
  105.     as FTS-0001.  SEAlink is implemented by modifying the following tables:
  106.  
  107.        Session Layer:   Sender - S1
  108.        Network Layer:   Batch File Sender - BS0
  109.        Network Layer:   Batch File Receiver - BR0
  110.        Data Link Layer: XMODEM/TeLink Sender - XS0
  111.        Data Link Layer: XMODEM/TeLink Receiver - XR0
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.                                                                              1
  133.                               Table of Contents
  134.  
  135.  
  136.                                                                           Page
  137.     The purpose of the SEAlink protocol ...................................  3
  138.  
  139.     How SEAlink negotiates its enhancements ...............................  4
  140.  
  141.     Basic requirements for a FidoNet Implementation .......................  5
  142.  
  143.     Levels of Compliance ..................................................  5
  144.  
  145.     The ISO/OSI Reference Model ...........................................  5
  146.  
  147.     Data Description Language .............................................  6
  148.  
  149.     Finite State Machine Notation .........................................  7
  150.  
  151.     Glossary of variables and terms .......................................  7
  152.  
  153.     Application layer .....................................................  8
  154.  
  155.     Presentation layer ....................................................  8
  156.  
  157.     Session layer protocol ................................................  8
  158.          Session State Table: Sender (S0) .................................  9
  159.          Session State Table: Receiver (R0) ............................... 10
  160.  
  161.     Transport layer ....................................................... 10
  162.  
  163.     Network layer ......................................................... 11
  164.          Data Definition: MODEM7 file name ................................ 11
  165.          Network State Table: Batch File Sender (BS0) ..................... 12
  166.          Network State Table: Batch File Receiver (BR0) ................... 13
  167.  
  168.     Data Link Layer ....................................................... 14
  169.          Data Definition: XMODEM data block (CRC) ......................... 14
  170.          Data Definition: XMODEM data block (Checksum) .................... 15
  171.          Data Definition: TeLink header block ............................. 15
  172.          Data Definition: SEAlink header block ............................ 16
  173.          Data Definition: SEAlink RESYNC packet ........................... 16
  174.          DDL Definition: XMODEMBlock, TeLink header ....................... 17
  175.          DDL Definition: SEAlink header, ACK, NAK, RESYNC block ........... 18
  176.          Checksum and CRC calculation algorithms .......................... 19
  177.          Data Link Layer protocol ......................................... 20
  178.          Data Link State Table: XMODEM/TeLink/SEAlink Sender (XS0) ........ 21
  179.          Data Link State Table: Transmitter ACK/NAK check (AC0) ........... 22
  180.          Data Link State Table: XMODEM/TeLink/SEAlink Receiver (XR0) ...... 24
  181.          Data Link State Table: Send NAK (SN0) ............................ 26
  182.          Data Link State Table: Send ACK (SA0) ............................ 26
  183.          Data Link State Table: MODEM7 Filename Sender (MS0) .............. 27
  184.          Data Link State Table: MODEM7 Filename Receiver (MR0) ............ 27
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.                                                                             2
  199.     The purpose of the SEAlink protocol
  200.  
  201.     The purpose of the SEAlink protocol is to provide a much higher level
  202.     of capability than the XMODEM protocol provides, while retaining the
  203.     ease of implementation which has made the XMODEM protocol ubiquitous.
  204.  
  205.     In order for an extended protocol to function in FidoNet, it has to be
  206.     fully upward compatible with FTS-0001 mailers, and also those slight
  207.     variants of FTS-0001 which can communicate well with FTS-0001 mailers.
  208.     To meet this requirement, any extension to the FTS-0001 protocol has
  209.     to be capable of transparently negotiating away its extended capabilities
  210.     and communicate with strict FTS-0001 mailers (and their approved variants)
  211.     properly and reliably.
  212.  
  213.     This means that an extended protocol must miminally do the following:
  214.  
  215.         o  Detect that the other mailer can or cannot support its extensions
  216.            automatically, and within the framework of a legitimate FTS-0001
  217.            protocol encounter.
  218.  
  219.         o  Support mail sessions with or without MODEM7 file names and with
  220.            or without TeLink headers in either combination.
  221.  
  222.     To be useful such an extended protocol should also be able to reliably
  223.     detect when the other mailer can support its extensions so they can
  224.     be used to maximum benefits.
  225.  
  226.     The major problems which exist with a standard FidoNet FTS-0001 session
  227.     result from the use of the XMODEM protocol.  This is a half duplex protocol
  228.     which forces a line turnaround on every transmitted block.  As a result,
  229.     any end-to-end delay in the transmission link is directly added to each
  230.     transmitted data block twice (once for each line turnaround).
  231.  
  232.     To dramatize how easily XMODEM is impacted by even small line delays, let's
  233.     examine a 2400bps call on a line with 500ms (1/2 second) delay on each line
  234.     turnaround.  This is not an uncommon delay time on long distance calls.  A
  235.     single data block in the XMODEM CRC format contains 133 characters.  This
  236.     means it will be transmitted in 554ms.  The ACK/NAK response is a single
  237.     character and will take 4ms.  Thus with no delay (an ideal link) an XMODEM
  238.     transfer would send 128 data characters in 558ms for an effective data
  239.     throughput of about 230cps.  With a 500ms line turnaround delay, these same
  240.     128 data bytes will take 1558ms resulting in a throughput of 82cps.  If
  241.     faster modem speeds are used, the percentage impact is even greater.
  242.  
  243.     The solution to this problem is to enhance the XMODEM protocol by adding
  244.     a "sliding window" capability which allows more than one block to be sent
  245.     before an acknowledgment is received.  This converts the protocol to a
  246.     full duplex protocol, and if the "window size" (the number of blocks which
  247.     may be sent before the sender must wait for an acknowledgment) is larger
  248.     that the line turnaround delay, then the ideal throughput can be restored
  249.     even to lines with long turnaround delays.  SEAlink is such a protocol.
  250.  
  251.     The standard SEAlink window size is 6 blocks, but the state tables given
  252.     below implement a receiver which will operate correctly with any window
  253.     size up to 127 blocks.  Thus an implementation which uses a larger window
  254.     size will be totally compatible with the standard 6 block window versions.
  255.  
  256.     A second problem with the XMODEM protocol arises when asymmetrical high
  257.     speed modems are used.  These modems achieve much higher throughput when
  258.     data is sent in only one direction.  Since they provide error free links,
  259.     a protocol which does not send any positive acknowledgments, but only
  260.     reports any bad blocks received will achieve a significantly higher
  261.  
  262.  
  263.  
  264.                                                                              3
  265.     throughput than a protocol which is either full duplex or which turns
  266.     around between each block such as XMODEM or normal SEAlink.  It is for
  267.     this purpose that SEAlink Overdrive is provided.  It is a streaming version
  268.     of SEAlink designed to provide much higher throughput on asymmetrical
  269.     high speed links which provide end-to-end data flow control.
  270.  
  271.     Finally, there is the annoying problem which occurs when a large data file
  272.     transfer has nearly completed and a loss of connection occurs.  Normally
  273.     the entire file must be retransmitted on a new call, resulting in lost
  274.     time and money.  The SEAlink RESYNC enhancement allows an interrupted
  275.     file transfer to be resumed at the point it was interrupted thus minimizing
  276.     the impact of such an interruption.
  277.  
  278.     How SEAlink Negotiates its enhancements
  279.  
  280.     SEAlink makes some assumptions about how FTS-0001 mailer implementations
  281.     react to various stimuli in order to negotiate its enhancements.  For the
  282.     sender, the test consists of two parts:
  283.  
  284.     1.  Send a SEAlink header and see if the other end acknowledges it.  In
  285.         general it will, because most XMODEM implementations will think that
  286.         the SEAlink header is a "previous block" and ACK and discard it.  If
  287.         the receiver refuses to accept a SEAlink header block in three tries,
  288.         then it clearly cannot do SEAlink protocol and the negotiation is over.
  289.  
  290.     2.  Since the receiver's acknowledgment of the SEAlink header is not a
  291.         sufficient criteria to determine if the receiver in fact supports
  292.         SEAlink, the sender dynamically examines the acknowledgments the
  293.         receiver provides to determine if their format indicates support of
  294.         SEAlink or not and adjusts its sending techniques accordingly.  This
  295.         is also the technique used to detect whether the receiver is in fact
  296.         supporting any extensions (such as SEAlink Overdrive) which have been
  297.         requested in the header.
  298.  
  299.     For the receiver, the negotiation occurs during the receipt of the first
  300.     valid block.
  301.  
  302.     1.   If the first block received is a valid SEAlink header, then the
  303.          transmitter supports SEAlink and the receiver can switch to it.  This
  304.          same header also indicates if the transmitter wants or can support the
  305.          SEAlink options such as Overdrive and File RESYNC.
  306.  
  307.      2.  If the first block received is a valid TeLink header, then the
  308.          transmitter supports a variant of FTS-0001 and SEAlink support may
  309.          be assumed to be absent.
  310.  
  311.      3.  If the first block received is an XMODEM data block then SEAlink
  312.          support may also be assumed to be absent.
  313.  
  314.     If the receiver gets a SEAlink header, it can then arbitrarily decide
  315.     which of any requested options it wishes to use.  It may not use an option
  316.     for which support is not indicated in the sender's SEAlink header block.
  317.  
  318.     The remainder of this document provides the details for a full SEAlink
  319.     implementation with Overdrive and RESYNC support.  A glossary of terms and
  320.     indicators is provided along with a full state table description of the
  321.     protocol implementation.
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.                                                                              4
  331.     This document follows the format of FTS-0001 to allow ease of
  332.     comparison of the two protocols.  This document could not have been
  333.     generated without the tremendous efforts of those whose work resulted in
  334.     FTS-0001.  FidoNet owes a great debt to those efforts.  The following
  335.     introduction is reprinted from FTS-0001.
  336.  
  337.     The layered metaphor of the ISO Open Systems Interface reference model
  338.     has been used to view FidoNet from a standard perspective.  As with most
  339.     prospective ISO/OSI descriptions, FidoNet does not always make this easy.
  340.  
  341.  
  342.    1. Basic Requirements for a FidoNet Implementation
  343.  
  344.       Compatibility is a set of abilities which, when taken as a whole, make
  345.       it safe to list a net or node in the IFNA nodelist.  In other words,
  346.       if another node should attempt contact, does it have a reasonable
  347.       chance of successful communication?  This is a social obligation, as
  348.       the calling system pays money for the attempt.  Conversely, an
  349.       implementation should be able to successfully contact other systems,
  350.       as life is not a one-way street.
  351.  
  352.       A FidoNet implementation must be able to call other nodes and transfer
  353.       messages and files in both directions.  This includes pickup and poll.
  354.  
  355.       A FidoNet implementation must be able to accept calls from other nodes
  356.       and transfer messages and files in both directions.  This includes
  357.       pickup.
  358.  
  359.       A FidoNet implementation must be able to receive and process the IFNA
  360.       format nodelist, and transfer nodelists to other nodes.  A companion
  361.       document, FTS-0005, defines the IFNA format nodelist and how to
  362.       interpret and process it.
  363.  
  364.       A FidoNet implementation must route messages which do not have files
  365.       attached through net hosts as shown in an IFNA format nodelist.
  366.  
  367.  
  368.    2. Levels of Compliance
  369.  
  370.       This documents represents an extended FidoNet implementation.  It
  371.       defines a well tested extension which is optional but provides
  372.       sufficient additional function that implementors should seriously
  373.       consider it.  SEAdog(tm), from System Enhancement Associates,
  374.       is the inspiration for this extended FidoNet implementation.
  375.       System Enhancement Associates is the creator of the SEAlink protocol.
  376.  
  377.  
  378.    3. The ISO/OSI Reference Model (cribbed from "Protocol Verification via
  379.       Executable Logic Specifications", D. P. Sidhu, in Rudin & West)
  380.  
  381.       In the ISO/OSI model, a distributed system consists of entities that
  382.       communicate with each other according to a set of rules called a
  383.       protocol.   The model is layered, and there are entities associated
  384.       with each layer of the model which provide services to higher layers
  385.       by exchanging information with their peer entities using the services
  386.       of lower layers.  The only actual physical communication between two
  387.       systems is at the lowest level.
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.                                                                              5
  397.       Several techniques have been used in the specification of such
  398.       protocols.  A common ingredient in all techniques is the notion of the
  399.       extended finite state automata or machine.  Extensions include the
  400.       addition of state variables for the storing of state information about
  401.       the protocol.  The state of an automaton can change as a result of
  402.       one of the following events:
  403.  
  404.       o Request from an upper network layer for service
  405.  
  406.       o Response to the upper layer
  407.  
  408.       o Request to the lower network layer to perform a service
  409.  
  410.       o Response from the lower layer
  411.  
  412.       o Interaction with the system and environment in which the protocol is
  413.         implemented (e.g. timeouts, host operating system aborts, ...)
  414.  
  415.       A protocol specification, in a large part, consists of specifying
  416.       state changes in automata which model protocol entities and in
  417.       describing the data which they exchange.
  418.  
  419.       For historical reasons, the term packet is used in FidoNet to
  420.       represent a bundle of messages, as opposed to the more common use as a
  421.       unit of communication, which is known as a block in FidoNet.
  422.  
  423.  
  424.    4. Data Description
  425.  
  426.       A language specific notation was avoided.  Please help stamp out
  427.       environmental dependencies.   Don't panic, there are rectangular record
  428.       layouts too.  The following defines the data description language used.
  429.  
  430.       (* non-terminals *)
  431.       UpperCaseName - to be defined further on
  432.  
  433.       (* literals *)
  434.       "ABC"         - ASCII character string, no termination implied
  435.       nnH           - byte in hexadecimal
  436.  
  437.       (* terminals *)
  438.       someName      - 16-bit integer, low order byte first (8080 style)
  439.       someName[n]   - field of n bytes
  440.       someName[.n]  - field of n bits
  441.       someName(n)   - Null terminated string allocated n chars (incl Null)
  442.       someName{max} - Null terminated string of up to max chars (incl Null)
  443.       someName<max> - String of up to max chars, NOT null terminated
  444.  
  445.       (* punctuation *)
  446.       a b           - one 'a' followed by one 'b'
  447.       ( a | b )     - either 'a' or 'b', but not both
  448.       { a }         - zero or more 'a's
  449.       [ b ]         - zero or one 'b'
  450.       (* comment *) - ignored
  451.  
  452.       (* predeclared constant *)
  453.       Null          = 00H
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.                                                                              6
  463.  5. Finite State Machine Notation
  464.  
  465.     ┌─────┬──────────┬─────────────────────────┬─────────────────────────┬─────┐
  466.     │State│ State    │ Predicate(s)            │ Action(s)               │ Next│
  467.     │  #  │ Name     │                         │                         │ St  │
  468.     ├─────┼──────────┼─────────────────────────┼─────────────────────────┼─────┤
  469.     │ fnn*│          │                         │                         │     │
  470.     └─────┴──────────┴─────────────────────────┴─────────────────────────┴─────┘
  471.  
  472.     State #      - Number of this state (e.g. R13).
  473.                    f  - FSM initial (Window, Sender, Receiver, ...)
  474.                    nn - state number
  475.                    *  - state which represents a lower level protocol  which
  476.                         is represented by yet another automation.
  477.  
  478.     State Name   - Descriptive name of this state.
  479.  
  480.     Predicate(s) - Conditions which terminate the state.  If predicates are
  481.                    non-exclusive, consider them ordered.
  482.  
  483.     Action(s)    - Action(s) corresponding to predicate(s)
  484.  
  485.     Next State   - Subsequent state corresponding to predicate(s)
  486.  
  487.     Ideally, there should be a supporting section for each state which
  488.     should give a prose description of the state, its predicates, actions,
  489.     etc.  So much for ideals.  The following is a list of all of the terms
  490.     and variables used in the following state machine descriptions:
  491.  
  492.  
  493.                      Glossary of variables and terms
  494.  
  495.     SEAlink - Flag indicating SEAlink or XMODEM mode
  496.  
  497.     SLO - Flag indicating overdrive if in SEAlink mode
  498.  
  499.     RESYNC - Flag indicating whether transmitting end can honor RESYNC
  500.              file positioning requests or only NAKs
  501.  
  502.     MACFLOW - Flag indicating whether the sender supports the Macintosh flow
  503.               control option.  This is an optional feature used by TABBY
  504.               because the Macintosh serial port does not support RTS/CTS.
  505.  
  506.     CRC - Flag indicating whether block check is done using CRC or Checksum
  507.  
  508.     T1 and T2 - Timeout Timers which run asynchronously with the code
  509.  
  510.     WINDOW - Number of unacknowledged blocks which may be transmitted
  511.  
  512.     SendBLK - Next 128 byte block number in file to send.  May not occur in
  513.               sequential order, so file positioning may be necessary when
  514.               it is time to send this block
  515.  
  516.     ACKBLK - Highest block number in file which has been acknowledged by
  517.              the receiver as received without error
  518.  
  519.     Last Blk - Block number of last 128 byte block (or partial block) in the
  520.                file being sent.
  521.  
  522.     NumNAK - Number of NAKs received since last ACK
  523.  
  524.     ACKs Rcvd - Number of ACKs received since the start of this file send
  525.  
  526.  
  527.  
  528.                                                                              7
  529.                      Glossary of variables and terms (cont.)
  530.  
  531.     ACKST - State of ACK/NAK machine during auto-detect of SEAlink or XMODEM
  532.             style ACK/NAK block receipt
  533.  
  534.     RESYNC BLK# - Block number in file requested by a received RESYNC packet
  535.  
  536.     ARBLK8 - Block # (0-255) received in a SEAlink style ACK/NAK packet
  537.  
  538.     ARBLK - Block # in file (calculated from ARBLK8) which is the actual
  539.             block being referenced in the SEAlink ACK/NAK packet
  540.  
  541.     blocknum - Block # (0-255) sent in a SEAlink style ACK/NAK packet
  542.  
  543.     WriteBLK - Block # in file to write next correctly received data block.
  544.                Note: Block 1 is the first byte of the file.
  545.  
  546.     CHR - Temp holding variable for received character during send operation
  547.  
  548.  
  549.  B. Application Layer : the System from the User's View
  550.  
  551.     This is unchanged from FTS-0001.
  552.  
  553.  
  554.  C. Presentation Layer : the User from the System's View
  555.  
  556.     This is unchanged from FTS-0001.
  557.  
  558.  
  559.  D. Session Layer Protocol : Connecting to Another FidoNet Machine
  560.  
  561.     A session is a connection between two FidoNet machines.  It is currently
  562.     assumed to be over the DDD telephone network via modems.  The calling
  563.     machine starts out as the sender and the called machine as the receiver.
  564.     The pickup feature is described by the sender and receiver changing
  565.     roles midway through the session, after the sender has transferred the
  566.     message packet and any attached files.  Due to the lack of security in
  567.     the pickup protocol (danger of pickup by a fake node), extensions to the
  568.     basic Session protocol have been developed.  This document describes only
  569.     the minimum Session Layer protocol (as in FTS-0001).
  570.  
  571.     Once a connection has been established, each system should ensure that
  572.     the physical connection remains throughout the session.  For physical
  573.     layers implemented through modems, this means monitoring the carrier
  574.     detect signal, and terminating the session if it is lost.
  575.  
  576.     Error detection at the physical layer should be monitored for both sent
  577.     and received characters.  Parity, framing, and other physical errors
  578.     should be detected.
  579.  
  580.     The only change to the Session Layer state tables from FTS-0001 is in the
  581.     Sender state "S1", Predicate "1" (S1.1) entry.
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.                                                                              8
  595.     Sender
  596.  
  597.     ┌─────┬──────────┬─────────────────────────┬─────────────────────────┬─────┐
  598.     │State│ State    │ Predicate(s)            │ Action(s)               │ Next│
  599.     │  #  │ Name     │                         │                         │ St  │
  600.     ├─────┼──────────┼─────────────────────────┼─────────────────────────┼─────┤
  601.     │ S0  │ SendInit │                         │ dial modem              │ S1  │
  602.     ├─────┼──────────┼─┬───────────────────────┼─────────────────────────┼─────┤
  603.     │ S1  │ WaitCxD  │1│ carrier detected      │ delay 1-5 seconds       │ S2  │
  604.     │     │  (*1)    │ │                       │ Set SLO if > 2400bps,   │     │
  605.     │     │          │ │                       │ Reset SLO if <= 2400bps │     │
  606.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  607.     │     │          │2│ busy, etc.            │ report no connection    │ exit│
  608.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  609.     │     │          │3│ voice                 │ report no carrier       │ exit│
  610.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  611.     │     │          │4│ carrier not detected  │ report no connection    │ exit│
  612.     │     │          │ │ within 60 seconds     │                         │     │
  613.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  614.     │ S2  │ WhackCRs │1│ over 30 seconds       │ report no response <cr> │ exit│
  615.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  616.     │     │          │2│ ?? <cr>s received     │ delay 1 sec             │ S3  │
  617.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  618.     │     │          │3│ <cr>s not received    │ send <cr> <sp> <cr> <sp>│ S2  │
  619.     │     │          │ │                       │   delay ??? secs        │     │
  620.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  621.     │ S3  │ WaitClear│1│ no input for 0.5 secs │ send TSYNCH = AEH       │ S4  │
  622.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  623.     │     │          │2│ over 60 seconds       │ hang up, report garbage │ exit│
  624.     │     │          │ │ and line not clear    │                         │     │
  625.     ├─────┼──────────┼─┴───────────────────────┼─────────────────────────┼─────┤
  626.     │ S4* │ SendMail │                         │ (XMODEM send packet XS0)│ S5  │
  627.     ├─────┼──────────┼─┬───────────────────────┼─────────────────────────┼─────┤
  628.     │ S5  │ CheckMail│1│ XMODEM successful     │ (Fido registers success)│ S6  │
  629.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  630.     │     │          │2│ XMODEM fail or timeout│ hang up, report mail bad│ exit│
  631.     ├─────┼──────────┼─┴───────────────────────┼─────────────────────────┼─────┤
  632.     │ S6* │ SendFiles│                         │ (BATCH send files BS0)  │ S7  │
  633.     ├─────┼──────────┼─┬───────────────────────┼─────────────────────────┼─────┤
  634.     │ S7  │ CheckFile│1│ BATCH send successful │                         │ S8  │
  635.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  636.     │     │          │2│ BATCH send failed     │ hang up, rept files fail│ exit│
  637.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  638.     │ S8  │ TryPickup│1│ wish to pickup        │ note send ok            │ R2* │
  639.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  640.     │     │          │2│ no desire to pickup   │ delay 5 secs            │ exit│
  641.     │     │          │ │                       │   hang up, rept send ok │     │
  642.     └─────┴──────────┴─┴───────────────────────┴─────────────────────────┴─────┘
  643.     Although the above shows the sender emitting only one TSYNCH, it is
  644.     recommended that a timeout of 5-20 seconds should initiate another TSYNCH.
  645.     The receiver should tolerate multiple TSYNCHs.
  646.  
  647.     *1 - The action for (S1.1) is the only change from the corresponding
  648.          FTS-0001 state table.
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.                                                                              9
  661.     Receiver
  662.  
  663.     The receiving FSM is given an external timer, the expiration of which
  664.     will cause termination with a result of 'no calls' (R0.2).
  665.  
  666.     ┌─────┬──────────┬─────────────────────────┬─────────────────────────┬─────┐
  667.     │State│ State    │ Predicate(s)            │ Action(s)               │ Next│
  668.     │  #  │ Name     │                         │                         │ St  │
  669.     ├─────┼──────────┼─┬───────────────────────┼─────────────────────────┼─────┤
  670.     │ R0  │ WaitCxD  │1│ carrier detected      │                         │ R1  │
  671.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  672.     │     │          │2│ external timer expires│ report no calls         │ exit│
  673.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  674.     │ R1  │ WaitBaud │1│ baud rate detected    │ send signon with <cr>s  │ R2  │
  675.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  676.     │     │          │2│ no detect in ?? secs  │ hang up, report no baud │ exit│
  677.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  678.     │ R2  │ WaitTsync│1│ TSYNCH received       │ ignore input not TSYNCH │ R3  │
  679.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  680.     │     │          │2│ 60 seconds timeout    │ hang up, report not Fido│ exit│
  681.     ├─────┼──────────┼─┴───────────────────────┼─────────────────────────┼─────┤
  682.     │ R3* │ RecMail  │                         │ (XMODEM rec packet XR0) │ R4  │
  683.     ├─────┼──────────┼─┬───────────────────────┼─────────────────────────┼─────┤
  684.     │ R4  │ XRecEnd  │1│ XMODEM successful     │ delay 1 second          │ R5  │
  685.     │     │          │ │                       │   flush input           │     │
  686.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  687.     │     │          │2│ XMODEM failed         │ hang up, rept mail fail │ exit│
  688.     ├─────┼──────────┼─┴───────────────────────┼─────────────────────────┼─────┤
  689.     │ R5* │ RecFiles │                         │ (BATCH rec files BR0)   │ R6  │
  690.     ├─────┼──────────┼─┬───────────────────────┼─────────────────────────┼─────┤
  691.     │ R6  │ ChkFiles │1│ BATCH recv successful │ delay 2 secs            │ R7  │
  692.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  693.     │     │          │2│ BATCH recv failed     │ hang up, report bad file│ exit│
  694.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  695.     │ R7  │ AllowPkup│1│ have pickup for sender│ receiver becomes sender │ S3* │
  696.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  697.     │     │          │2│ nothing to pickup     │ hang up, rept recv ok   │ exit│
  698.     └─────┴──────────┴─┴───────────────────────┴─────────────────────────┴─────┘
  699.  
  700.     There is no change in the Session Layer Receiver state table from FTS-0001.
  701.  
  702.  
  703.  E. Transport Layer : ?????
  704.  
  705.     This is unchanged from FTS-0001.
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.                                                                             10
  727.  F. Network Layer : the Network's View of the System, Routing and Packets
  728.  
  729.    1. Network Layer Data Definition : the Packet Header
  730.  
  731.       This is unchanged from FTS-0001.
  732.  
  733.  
  734.    2. Network Layer Data Description : a File with Attributes
  735.  
  736.       The BATCH protocol uses the MODEM7 filename and/or SEAlink/TeLink/XMODEM
  737.       file transfer protocols to transfer the file with attributes.
  738.  
  739.       When a file is transferred via FidoNet, an attempt is made to also
  740.       pass the operating system's attributes for the file such as length,
  741.       modification date, etc.  FidoNet does this via a special prefix block
  742.       to the XMODEM file transfer using a protocol known as TeLink.  As the
  743.       TeLink protocol relies on a modification to the XMODEM file transfer
  744.       protocol, it is documented at the data link layer level.  Optionally,
  745.       if both sender and receiver implement the SEAlink extension, file
  746.       information is passed using the SEAlink header block which also
  747.       contains feature negotiation information.
  748.  
  749.       The MODEM7 file name is redundant if there is also a TeLink or SEAlink
  750.       block, in which case the name may be taken from either or both.  In this
  751.       extended implementation, the MODEM7 file name is never required.  It
  752.       is sent, however, if it appears that the other node is using a strict
  753.       FTS-0001 implementation.  This implementation will adapt to an FTS-0001
  754.       variant which only sends the TeLink header without the MODEM7 filename
  755.       also so that it is compatible with all know variants of FTS-0001 which
  756.       are currently in the FidoNet network.
  757.  
  758.  
  759.                           FileName as Sent by MODEM7
  760.        Offset
  761.       dec hex
  762.               ┌───────────────────────────────────────────────┐
  763.         0   0 │                   fileName                    │
  764.               ~                   8  bytes                    ~
  765.               │           left adjusted blank filled          │
  766.               ├───────────────────────────────────────────────┤
  767.         8   8 │                    fileExt                    │
  768.               ~                    3  bytes                   ~
  769.               │           left adjusted blank filled          │
  770.               └───────────────────────────────────────────────┘
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.                                                                             11
  793.  3. Network Layer Protocol : BATCH File Finite State Machines
  794.  
  795.     BATCH File Sender
  796.  
  797.     ┌─────┬──────────┬─────────────────────────┬─────────────────────────┬─────┐
  798.     │State│ State    │ Predicate(s)            │ Action(s)               │ Next│
  799.     │  #  │ Name     │                         │                         │ St  │
  800.     ├─────┼──────────┼─┬───────────────────────┼─────────────────────────┼─────┤
  801.     │ BS0 │ MoreFiles│1│ more files to send    │                         │ BS1 │
  802.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  803.     │     │          │2│ no more files to send │                         │ BS4 │
  804.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  805.     │ BS1 │ WaitType │1│ rec NAK               │ (MODEM7 FName send MS0) │ BS2 │
  806.     │     │    (*1)  ├─┼───────────────────────┼─────────────────────────┼─────┤
  807.     │     │          │2│ rec 'C'               │ (SEAlink send file XS0) │ BS3 │
  808.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  809.     │     │          │3│ rec other char        │ eat character           │ BS1 │
  810.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  811.     │     │          │4│ > 20 sec in BS1       │ report name send bad    │ exit│
  812.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  813.     │ BS2 │ CheckFNm │1│ MODEM7 Filename ok    │ (TeLink send file XS0T) │ BS3 │
  814.     │     │    (*2)  ├─┼───────────────────────┼─────────────────────────┼─────┤
  815.     │     │          │2│ MODEM7 Filename bad   │ report name send bad    │ exit│
  816.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  817.     │ BS3 │ CheckFile│1│ File send ok          │                         │ BS0 │
  818.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  819.     │     │          │2│ File send bad         │ report file send bad    │ exit│
  820.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  821.     │ BS4 │ EndSend  │1│ rec NAK or 'C'        │ send EOT, report send ok│ exit│
  822.     │     │    (*3)  ├─┼───────────────────────┼─────────────────────────┼─────┤
  823.     │     │          │2│ 10 secs no NAK or 'C' │ send EOT, report no NAK │ exit│
  824.     └─────┴──────────┴─┴───────────────────────┴─────────────────────────┴─────┘
  825.  
  826.     *1 - Note: Filenames must be upper case ASCII.  The data link layer uses
  827.          lower case "u" as a control character during MODEM7 name transmission.
  828.  
  829.     *2 - Note: SEAdog (through version 4.51b) does not possess a state "XS0T".
  830.          It therefore calls XS0 from state BS2, resulting in a MODEM7 file name
  831.          being sent with no TeLink header on batch file transmissions when it
  832.          is not in SEAlink mode.
  833.  
  834.     *3 - When no files remain, the sender responds to the receiver's NAK with
  835.          an EOT.  The EOT is not ACK/NAKed by the receiver.
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.                                                                             12
  859.    BATCH File Receiver
  860.  
  861.     ┌─────┬──────────┬─────────────────────────┬─────────────────────────┬─────┐
  862.     │State│ State    │ Predicate(s)            │ Action(s)               │ Next│
  863.     │  #  │ Name     │                         │                         │ St  │
  864.     ├─────┼──────────┼─────────────────────────┼─────────────────────────┼─────┤
  865.     │ BR0 │ TestSL   │                         │ Send 'C',               │ BR1 │
  866.     │     │          │                         │   Set T1 to 10 sec      │     │
  867.     │     │          │                         │   Set T2 to 120 sec     │     │
  868.     ├─────┼──────────┼─┬───────────────────────┼─────────────────────────┼─────┤
  869.     │ BR1 │ CheckSL  │1│ > 2 sec with no data  │ Send 'C'                │ BR1 │
  870.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  871.     │     │          │2│ Timer T2 expired      │ (MODEM7 FName recv MR0) │ BR2 │
  872.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  873.     │     │          │3│ Character Waiting     │ "Peek" char to CHR (*1) │ BR4 │
  874.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  875.     │     │          │4│ Timer T1 expired      │ (MODEM7 FName recv MR0) │ BR2 │
  876.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  877.     │ BR2 │ CheckFNm │1│ no more files         │ report files recd ok    │ exit│
  878.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  879.     │     │          │2│ Filename ok           │ (Rcv file Telink XR0)   │ BR3 │
  880.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  881.     │     │          │3│ Filename bad          │ report name recv bad    │ exit│
  882.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  883.     │ BR3 │ CheckFile│1│ File received ok      │                         │ BR0 │
  884.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  885.     │     │          │2│ File received bad     │ report file recv bad    │ exit│
  886.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  887.     │ BR4 │ FindType │1│ CHR = NUL             │ eat character,          │ BR1 │
  888.     │     │          │ │                       │   Reset T1 to 20 secs   │     │
  889.     │     │   (*2)   ├─┼───────────────────────┼─────────────────────────┼─────┤
  890.     │     │          │2│ CHR = SOH             │ (Rcv File SEAlink XR0B) │ BR3 │
  891.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  892.     │     │          │3│ CHR = SYN             │ (Rcv File Telink XR0B)  │ BR3 │
  893.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  894.     │     │          │4│ CHR = EOT or          │ eat character,          │ exit│
  895.     │     │          │ │ CHR = SUB             │   report files recd ok  │     │
  896.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  897.     │     │          │5│ CHR = Other char      │ eat character           │ BR1 │
  898.     └─────┴──────────┴─┴───────────────────────┴─────────────────────────┴─────┘
  899.  
  900.     *1 - "Peek" a character means to place it in CHR but leave it in the input
  901.          buffer so the next read operation will re-read it.
  902.  
  903.     *2 - "Eat" a character means to remove it from the input buffer.
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.                                                                             13
  925.  G. Data Link Layer : Error-Free Data Transfer
  926.  
  927.    1. Data Link Layer Data Definition : XMODEM/TeLink/SEAlink Blocks
  928.  
  929.       XMODEM transfers are in blocks of 128 uninterpreted data bytes
  930.       preceded by a three byte header and followed by either a one byte
  931.       checksum or a two byte crc remainder.  XMODEM makes no provision  for
  932.       data streams which are not an integral number of blocks long.
  933.       Therefore, the sender pads streams whose length is not a multiple of
  934.       128 bytes with the end-of-file character (^Z for MS-DOS), and uses some
  935.       other means to convey the true data length to the receiver (e.g.
  936.       SEAlink or TeLink file info header block).
  937.  
  938.       Data blocks contain sequence numbers so the receiver can ensure it has
  939.       the correct block.  Data block numbers are sequential unsigned eight bit
  940.       integers beginning with 01H and wrapping to 00H.  A TeLink or SEAlink
  941.       header block is given sequence number 00H.
  942.  
  943.       For files which are attached to the mail packet (but not the mail packet
  944.       itself), if the sending system is aware of the file attributes as they
  945.       are known to the operating system, then the first block of the XMODEM
  946.       transfer may be a special TeLink block to transfer that information.
  947.       This block differs in that the first byte is a SYN character as
  948.       opposed to an SOH, and it is always sent checksum as opposed to CRC.
  949.       Should the receiver be unwilling to handle such information, after four
  950.       NAKs (or "C"s), the sender skips this special block and goes on to the
  951.       data itself.
  952.  
  953.       In this extended protocol the TeLink header block may be replaced by
  954.       the SEAlink header block which conveys protocol negotiation information
  955.       in addition to the file attributes if both nodes implement SEAlink.
  956.  
  957.  
  958.  
  959.                         XMODEM Data Block (CRC mode)
  960.        Offset
  961.       dec hex
  962.               ┌───────────────────────────────────────────────┐
  963.         0   0 │        SOH  -  Start Of Header -  01H         │
  964.               ├───────────────────────────────────────────────┤
  965.         1   1 │                 BlockNumber                   │
  966.               ├───────────────────────────────────────────────┤
  967.         2   2 │               BlockComplement                 │
  968.               ├───────────────────────────────────────────────┤
  969.         3   3 │                128 bytes  of                  │
  970.               ~                uninterpreted                  ~
  971.               │                    data                       │
  972.               ├───────────────────────────────────────────────┤
  973.       131  83 │             CRC high order byte               │
  974.               ├───────────────────────────────────────────────┤
  975.       132  84 │             CRC  low order byte               │
  976.               └───────────────────────────────────────────────┘
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.                                                                             14
  991.                       XMODEM Data Block (Checksum mode)
  992.        Offset
  993.       dec hex
  994.               ┌───────────────────────────────────────────────┐
  995.         0   0 │        SOH  -  Start Of Header -  01H         │
  996.               ├───────────────────────────────────────────────┤
  997.         1   1 │                 BlockNumber                   │
  998.               ├───────────────────────────────────────────────┤
  999.         2   2 │               BlockComplement                 │
  1000.               ├───────────────────────────────────────────────┤
  1001.         3   3 │                128 bytes  of                  │
  1002.               ~                uninterpreted                  ~
  1003.               │                    data                       │
  1004.               ├───────────────────────────────────────────────┤
  1005.       131  83 │                Checksum byte                  │
  1006.               └───────────────────────────────────────────────┘
  1007.  
  1008.  
  1009.                        TeLink File Descriptor Block
  1010.        Offset
  1011.       dec hex
  1012.               ┌───────────────────────────────────────────────┐
  1013.         0   0 │       SYN  -  File Info Header -  16H         │
  1014.               ├───────────────────────────────────────────────┤
  1015.         1   1 │                     00H                       │
  1016.               ├───────────────────────────────────────────────┤
  1017.         2   2 │                     FFH                       │  dec  hex
  1018.               ├───────────────────────────────────────────────┤
  1019.         3   3 │     File Length, least significant byte       │  0    0
  1020.               ├───────────────────────────────────────────────┤
  1021.         4   4 │ File Length, second to least significant byte │  1    1
  1022.               ├───────────────────────────────────────────────┤
  1023.         5   5 │  File Length, second to most significant byte │  2    2
  1024.               ├───────────────────────────────────────────────┤
  1025.         6   6 │      File Length, most significant byte       │  3    3
  1026.               ├───────────────────────────────────────────────┤
  1027.         7   7 │            Creation Time of File              │  4    4
  1028.               │                "DOS Format"                   │
  1029.               ├───────────────────────────────────────────────┤
  1030.         9   9 │            Creation Date of File              │  6    6
  1031.               │                "DOS Format"                   │
  1032.               ├───────────────────────────────────────────────┤
  1033.        11   B │                 File  Name                    │  8    8
  1034.               ~                  16 chars                     ~
  1035.               │        left justified  blank filled           │
  1036.               ├───────────────────────────────────────────────┤
  1037.        27  1B │                    00H                        │ 24   18
  1038.               ├───────────────────────────────────────────────┤
  1039.        28  1C │            Sending Program Name               │ 25   19
  1040.               ~                  16 chars                     ~
  1041.               │         left justified  Null filled           │
  1042.               ├───────────────────────────────────────────────┤
  1043.        44  2B │            01H (for CRC) or 00H               │ 41   29
  1044.               ├───────────────────────────────────────────────┤
  1045.        45  2C │                    fill                       │ 42   2A
  1046.               ~                  86 bytes                     ~
  1047.               │                  all zero                     │
  1048.               ├───────────────────────────────────────────────┤
  1049.       131  83 │                Checksum byte                  │
  1050.               └───────────────────────────────────────────────┘
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.                                                                             15
  1057.       Offset           SEAink File Descriptor Block
  1058.       dec hex
  1059.               ┌───────────────────────────────────────────────┐
  1060.         0   0 │       SOH  -  Start of Header -   01H         │
  1061.               ├───────────────────────────────────────────────┤
  1062.         1   1 │                     00H                       │
  1063.               ├───────────────────────────────────────────────┤
  1064.         2   2 │                     FFH                       │  dec  hex
  1065.               ├───────────────────────────────────────────────┤
  1066.         3   3 │         File Length, (4 bytes, LSB first)     │  0    0
  1067.               ├───────────────────────────────────────────────┤
  1068.         7   7 │            Creation Date/Time of File         │  4    4
  1069.               │   (4 bytes, LSB first, seconds since 1979)    │
  1070.               ├───────────────────────────────────────────────┤
  1071.        11   B │                 File  Name                    │  8    8
  1072.               ~                  17 chars                     ~
  1073.               │        left justified   Null filled           │
  1074.               ├───────────────────────────────────────────────┤
  1075.        28  1C │            Sending Program Name               │ 25   19
  1076.               ~                  15 chars                     ~
  1077.               │         left justified  Null filled           │
  1078.               ├───────────────────────────────────────────────┤
  1079.        43  2B │            > 0 if SLO Requested               │ 40   28
  1080.               ├───────────────────────────────────────────────┤
  1081.        44  2C │           > 0 if RESYNC Supported             │ 41   29
  1082.               ├───────────────────────────────────────────────┤
  1083.        45  2D │           > 0 if MACFLOW Supported            │ 42   2A
  1084.               ├───────────────────────────────────────────────┤
  1085.        46  2E │                    fill                       │ 43   2B
  1086.               ~                  85 bytes                     ~
  1087.               │                  all zero                     │
  1088.               ├───────────────────────────────────────────────┤
  1089.       131  83 │            CRC high order byte                │
  1090.               ├───────────────────────────────────────────────┤
  1091.       132  84 │            CRC  low order byte                │
  1092.               └───────────────────────────────────────────────┘
  1093.   
  1094.  
  1095.       Offset                SEAlink RESYNC packet
  1096.       dec hex
  1097.               ┌───────────────────────────────────────────────┐
  1098.         0   0 │       SYN - Start of RESYNC packet - 16H      │
  1099.               ├───────────────────────────────────────────────┤
  1100.         1   1 │     ASCII Decimal 128 byte block number in    │
  1101.               ~     file to restart sending.  (No leading     ~
  1102.         n     │     or trailing blanks, MSD first).           │
  1103.               ├───────────────────────────────────────────────┤
  1104.         n+1   │       ETX -  End of RESYNC packet  - 03H      │
  1105.               ├───────────────────────────────────────────────┤
  1106.         n+2   │     (*1)     CRC  low order byte              │
  1107.               ├───────────────────────────────────────────────┤
  1108.         n+3   │     (*1)     CRC high order byte              │
  1109.               └───────────────────────────────────────────────┘
  1110.  
  1111.               *1 - CRC does not include the SYN or ETX and is
  1112.                    in the reverse byte order from the CRC in a
  1113.                    normal XMODEM data packet.  The following is
  1114.                    a sample RESYNC packet for file block 27 (1BH).
  1115.  
  1116.                      SYN   '2'   '7'   ETX  CRCLO CRCHI 
  1117.                    ┌─────┬─────┬─────┬─────┬─────┬─────┐
  1118.                    │ 16H │ 32H │ 37H │ 03H │ 43H │ 25H │
  1119.                    └─────┴─────┴─────┴─────┴─────┴─────┘
  1120.  
  1121.  
  1122.                                                                             16
  1123.     Data Description language definitions of block types:
  1124.  
  1125.       XMODEMData   =   XMODEMBlock    (* block of data with hdr and trailer *)
  1126.                      | SEALinkBlock   (* SEALink File Descriptor Block *)
  1127.                      | TeLinkBlock    (* TeLink File Descriptor Block *)
  1128.                      | ReSyncBlock    (* SEAlink RESYNC request packet *)
  1129.                      | ACK            (* acknowledge data received ok *)
  1130.                      | NAK            (* negative ACK & poll 1st block *)
  1131.                      | SEAlinkACK     (* acknowledge data received ok *)
  1132.                      | SEAlinkNAK     (* negative ACK & poll 1st block *)
  1133.                      | EOT            (* end of xfer, after last block *)
  1134.                      | "C"            (* 43H *)
  1135.  
  1136.  
  1137.       XMODEMBlock  = SOH              (* Start of Header, XMODEM Block *)
  1138.                      blockNumber[1]   (* sequence, i'=mod( i+1, 256 ) *)
  1139.                      blockCompl[1]    (* one's complement of blockNumber *)
  1140.                      data[128]        (* uninterpreted user data block *)
  1141.                      (CRC | Checksum) (* error detect/correction code *)
  1142.  
  1143.  
  1144.       TeLinkBlock  = SYN              (* File Info Header *)
  1145.                      00H              (* block no, must be first block *)
  1146.                      FFH              (* one's complement of block no *)
  1147.                      fileLength[4]    (* length of data in bytes *)
  1148.                 (*2) CreationTime[2]  (* time file last modified or zero *)
  1149.                 (*2) CreationDate[2]  (* date file last modified or zero *)
  1150.                      fileName(16)     (* name of file, not vol or dir *)
  1151.                      00H              (* header version number *)
  1152.                      sendingProg(16)  (* name of program on send side *)
  1153.                 (*1) crcMode[1]       (* 01H for CRC 00H for Checksum *)
  1154.                      fill[87]         (* zeroed *)
  1155.                      Checksum         (* error detect/correction code *)
  1156.  
  1157.     *1 -  Note that the crcMode is always set to 01H in current implementations
  1158.           as all TeLink/XMODEM implementations use the CRC method.  Therefore,
  1159.           it is always set to 01H by the sender, and is ignored by the receiver.
  1160.  
  1161.     *2 -  CreationDate and CreationTime are MS-DOS format as follows:
  1162.  
  1163.       CreationDate = year[.7]         (* 7 bits, years since 1980, 0-127  *)
  1164.                      month[.4]        (* 4 bits, month of year, 1-12 *)
  1165.                      day[.5]          (* 5 bits, day of month, 1-31 *)
  1166.  
  1167.       CreationTime = hour[.5]         (* 5 bits, hour of day, 0-23 *)
  1168.                      minute[.6]       (* 6 bits, minute of hour, 0-60 *)
  1169.                      biSeconds[.2]    (* 6 bits, seconds/2, 0-29 *)
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.                                                                             17
  1189.     Data Description Language definition of the block types added by this
  1190.     extended protocol specification:
  1191.  
  1192.      SEALinkBlock  = SOH              (* File Info Header *)
  1193.                      00H              (* block no, must be first block *)
  1194.                      FFH              (* one's complement of block no *)
  1195.                      fileLength[4]    (* length of data in bytes *)
  1196.               (*1)   Creation[4]      (* Seconds since 1979 file last chgd *)
  1197.                      fileName(17)     (* name of file, not vol or dir *)
  1198.                      sendingProg(15)  (* name of program on send side *)
  1199.                      SLO[1]           (* 01H for Overdrive supported *)
  1200.                      RESYNC[1]        (* 01H for file Restart supported *)
  1201.                      MACFLOW[1]       (* 01H for Macintosh flow supported *)
  1202.                      fill[85]         (* zeroed *)
  1203.                      CRC              (* error detect/correction code *)
  1204.  
  1205.     *1 - Creation is a long integer number of seconds since January 1, 1979.
  1206.  
  1207.      SEAlinkACK    = ACK              (* indicator data block received ok *)
  1208.                      blockNumber[1]   (* sequence, i'=mod( i+1, 256 ) *)
  1209.                      blockCompl[1]    (* one's complement of blockNumber *)
  1210.  
  1211.      SEAlinkNAK    = NAK              (* indicator block not received ok *)
  1212.                      blockNumber[1]   (* sequence, i'=mod( i+1, 256 ) *)
  1213.                      blockCompl[1]    (* one's complement of blockNumber *)
  1214.  
  1215.      ReSyncBlock   = SYN              (* File Restart Position *)
  1216.                 (*1) RestartBlock<20> (* ASCII decimal file block # *)
  1217.                      ETX              (* End of block number text *)
  1218.                      CRC(rev order)   (* error detection code *)
  1219.  
  1220.      *1 - RestartBlock is a text ASCII version of the decimal block number
  1221.           in the file desired.  Note:  The first block of the file is block 1.
  1222.  
  1223.  
  1224.     Definitions of Single byte Character values used in protocol:
  1225.  
  1226.       ACK          = 06H              (* acknowledge data received ok *)
  1227.       NAK          = 15H              (* negative ACK & poll 1st block *)
  1228.       SOH          = 01H              (* start of header, begins block *)
  1229.       SYN          = 16H              (* start of TeLink file info blk *)
  1230.       EOT          = 04H              (* end of xfer, after last block *)
  1231.       ETX          = 03H              (* end of RESYNC request data field*)
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.                                                                             18
  1255.     Block Verification calculated values used by this protocol:
  1256.  
  1257.       CRC          = crc[2]           (* CCITT Cyclic Redundancy Check *)
  1258.  
  1259.       Checksum     = checksum[1]      (* low 8 bits of sum of data bytes
  1260.                                          using unsigned 8 bit arithmetic *)
  1261.  
  1262.     Calculating Checksum
  1263.     --------------------
  1264.  
  1265.     For blocks which use a checksum to do error detection, the checksum is
  1266.     calculated by initializing an accumulator to zero and doing successive
  1267.     addition of each character in the data field.  Carry is discarded on
  1268.     each addition.  The resulting 8 bit value is the checksum.
  1269.  
  1270.     Calculating CRC
  1271.     ---------------
  1272.  
  1273.     For blocks which use CRC to do error detection, the CRC is calculated
  1274.     using the CCITT V.41 generator polynomial.  An accumulator is initialized
  1275.     to zero, and then each character of the data field is processed by the
  1276.     CRC generator polynomial.  This process can be quite complex to explain,
  1277.     but is not so complex in practice.  The following CRC routine is
  1278.     given here as an aid to understanding the CRC generation process.
  1279.  
  1280.     8086 assembler routine to implement CCITT V.41 CRC algorithm
  1281.     ;---------------------------------------------------------------+
  1282.     ;       CRCUPD - Update CRC value from character in AL          |
  1283.     ;                                                               |
  1284.     ;  CRC is calculated using the CCITT V.41 generator polynomial. |
  1285.     ;    That polynomial is: X^16 + X^12 + X^5 + 1 (X^0)            |
  1286.     ;                                                               |
  1287.     ;  As an aid to understanding, remember that XOR is bitwise     |
  1288.     ;    addition without carry.                                    |
  1289.     ;---------------------------------------------------------------+
  1290.     CRCVAL  DW      0                   ;16 bit CRC accumulator
  1291.     ;
  1292.     CRCUPD: PUSH    AX                  ;All registers preserved
  1293.             PUSH    CX
  1294.             PUSH    DX
  1295.             MOV     DX,[CRCVAL]
  1296.             XOR     DH,AL               ;init X^16 term
  1297.             XOR     DL,DL
  1298.             MOV     CX,8
  1299.     CRCUP1: SHL     DX,1
  1300.             JNC     CRCUP2
  1301.             XOR     DX,1021h            ;X^12 + X^5 + 1
  1302.     CRCUP2: LOOP    CRCUP1
  1303.             XOR     DH,BYTE PTR[CRCVAL] ;finish X^16 term
  1304.             MOV     [CRCVAL],DX         ;update CRC accumulator
  1305.             POP     DX
  1306.             POP     CX
  1307.             POP     AX
  1308.             RET
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.                                                                             19
  1321.  2. Data Link Layer Protocol : XMODEM/TeLink/SEAlink Finite State Machines
  1322.  
  1323.     The protocol is receiver driven, the receiver polling the sender for
  1324.     each block.  If the receiver polls for the first block using a "C"
  1325.     (43H) as  the poll character, it would prefer to have the CRC-CCITT V.41
  1326.     polynomial remainder error detection code at the end of each block as
  1327.     opposed to a one byte unsigned checksum.  The sender will respond to
  1328.     the "C" poll if it can  comply. If the sender chooses checksum as
  1329.     opposed to CRC, it waits for the receiver to poll with  NAK (15H).
  1330.     Should the checksum method be preferable to the receiver, it polls
  1331.     with NAK rather than "C".
  1332.  
  1333.     The sender returns an EOT instead of a data block when no data remain.
  1334.  
  1335.     With this extended implementation, the sender and the receiver may send
  1336.     blocks or ACK/NAK responses while there is data being received, once the
  1337.     SEAlink protocol has been negotiated.  This full duplex operation allows
  1338.     the throughput gains of a sliding window protocol.  When SEAlink is not
  1339.     set the window size of 1 prohibits data being sent at the same time and
  1340.     restores the attributes of a standard XMODEM protocol.
  1341.  
  1342.     ------------------
  1343.     In this extended protocol, the FTS-0001 single state table
  1344.     "XMODEM Sender" is replaced by two state tables.
  1345.  
  1346.     The top level table is equivalent to the FTS-0001 XMODEM Sender table.
  1347.     It in turn calls the new state table named "Transmitter ACK/NAK Check"
  1348.     which implements the full duplex adaptive SEAlink/XMODEM dynamic switching
  1349.     along with the Overdrive and file Restart sending features of the extended
  1350.     protocol.
  1351.  
  1352.     -----------------
  1353.     In this extended protocol, the FTS-0001 single state table
  1354.     "XMODEM Receiver" is replaced by three state tables.
  1355.  
  1356.     The top level table is equivalent to the FTS-0001 XMODEM Receiver table.
  1357.     It in turn calls the two new state tables named "Send NAK" and "Send ACK"
  1358.     which implement the full duplex adaptive SEAlink/TeLink/XMODEM dynamic
  1359.     switching along with the Overdrive and file Restart receiving features of
  1360.     the extended protocol.
  1361.  
  1362.  
  1363.     Caution!!!!
  1364.     -----------
  1365.     Many current implementations keep file block numbers as 16 bit numbers.
  1366.     This limits the max file size to either 4 megabytes (if number is signed)
  1367.     or 8 megabytes (if number is unsigned).  To handle files up to the maximum
  1368.     size DOS allows (4 gigabytes) at least 25 bits plus sign are required for
  1369.     these numbers.  Good practice is to make file block numbers 32 bit values.
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.                                                                             20
  1387.     XMODEM/TeLink/SEAlink - Sender
  1388.  
  1389.     ┌─────┬──────────┬─────────────────────────┬─────────────────────────┬─────┐
  1390.     │State│ State    │ Predicate(s)            │ Action(s)               │ Next│
  1391.     │  #  │ Name     │                         │                         │ St  │
  1392.     ├─────┼──────────┼─────────────────────────┼─────────────────────────┼─────┤
  1393.     │ XS0 │ XmtStart │  Normal Entry Point     │ reset SEAlink flag,     │ XS1 │
  1394.     │     │          │  for file send          │   SendBLK=1, ACKST=0,   │     │
  1395.     │     │          │                         │   ACKBLK= -1, WINDOW=1, │     │
  1396.     │     │          │                         │   ACKs Rcvd=0,          │     │
  1397.     │     │          │                         │   NumNAK=0,             │     │
  1398.     │     │          │                         │   T1=30 seconds,        │     │
  1399.     │     │          │                    (*1) │   Build SEAlink hdr blk │     │
  1400.     ├─────┼──────────┼─────────────────────────┼─────────────────────────┼─────┤
  1401.     │ XS0T│ XmTeStrt │  Alternate entry from   │ reset SEAlink flag,     │ XS1 │
  1402.     │     │          │  Batch Send if TeLink   │   SendBLK=1, ACKST=0,   │     │
  1403.     │     │          │  mode send required     │   ACKBLK= -1, WINDOW=1, │     │
  1404.     │     │          │                         │   ACKs Rcvd=0,          │     │
  1405.     │     │          │                         │   NumNAK=0,             │     │
  1406.     │     │          │                         │   T1=30 seconds,        │     │
  1407.     │     │          │                         │   Build TeLink hdr blk  │     │
  1408.     ├─────┼──────────┼─────────────────────────┼─────────────────────────┼─────┤
  1409.     │ XS1 │ CheckACK │                         │ (Check ACK/NAK AC0)     │ XS2 │
  1410.     ├─────┼──────────┼─┬───────────────────────┼─────────────────────────┼─────┤
  1411.     │ XS2 │ SendBlk  │1│ NumNAK > 4 &          │ If header = SEAlink     │ XS0T│
  1412.     │     │   (*2)   │ │   SendBLK = 0         ├─────────────────────────┼─────┤
  1413.     │     │          │ │                       │ If header = TeLink,     │ XS2 │
  1414.     │     │          │ │                       │   NumNAK = 0,           │     │
  1415.     │     │          │ │                       │   Incr ACKBLK,          │     │
  1416.     │     │          │ │                       │   Incr SendBLK          │     │
  1417.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1418.     │     │          │2│ NumNAK > 10           │ report too many errors  │ exit│
  1419.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1420.     │     │          │3│ Timer T1 expired      │ report fatal timeout    │ exit│
  1421.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1422.     │     │          │4│ SendBLK > Last Blk+1  │                         │ XS3 │
  1423.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1424.     │     │          │5│ SendBLK >ACKBLK+Window│                         │ XS1 │
  1425.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1426.     │     │          │6│ SendBLK = Last Blk+1  │ Send EOT, Incr SendBLK, │ XS1 │
  1427.     │     │          │ │                       │   Set T1 to 30 seconds  │     │
  1428.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1429.     │     │          │7│ SLO set & SEAlink set │ Send SendBLK, (*3)      │ XS1 │
  1430.     │     │          │ │                       │   ACKBLK = SendBLK,     │     │
  1431.     │     │          │ │                       │   Incr SendBLK,         │     │
  1432.     │     │          │ │                       │   Set T1 to 60 seconds  │     │
  1433.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1434.     │     │          │8│ SLO reset or          │ Send SendBLK, (*3)      │ XS1 │
  1435.     │     │          │ │     SEAlink reset     │   Incr SendBLK,         │     │
  1436.     │     │          │ │                       │   Set T1 to 30 seconds  │     │
  1437.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  1438.     │ XS3 │ WaitEnd  │1│ ACKBLK < Last Blk+1   │                         │ XS1 │
  1439.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1440.     │     │          │2│ ACKBLK = Last Blk+1   │ report send success     │ exit│
  1441.     └─────┴──────────┴─┴───────────────────────┴─────────────────────────┴─────┘
  1442.  
  1443.     *1 - Build SEAlink Header block with RESYNC set.  Set SLO if line speed >
  1444.          2400 bps, reset SLO otherwise.
  1445.  
  1446.     *2 - State (XS2.1) allows the receiver to refuse one or both header blocks.
  1447.  
  1448.     *3 - If SendBLK = 0, then send the SEAlink (or TeLink) header block.
  1449.          If SendBLK > 0, send the corresponding 128 byte file data block where
  1450.                          block #1 begins with the first byte of the file.
  1451.  
  1452.                                                                             21
  1453.     XMODEM/TeLink/SEAlink - Transmitter ACK/NAK Check
  1454.  
  1455.     ┌─────┬──────────┬─────────────────────────┬─────────────────────────┬─────┐
  1456.     │State│ State    │ Predicate(s)            │ Action(s)               │ Next│
  1457.     │  #  │ Name     │                         │                         │ St  │
  1458.     ├─────┼──────────┼─┬───────────────────────┼─────────────────────────┼─────┤
  1459.     │ AC0 │ ChkRcvd  │1│ No character waiting  │                         │ exit│
  1460.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1461.     │     │          │2│ Character waiting     │ Read character to CHR   │ AC1 │
  1462.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  1463.     │ AC1 │ SLCheck  │1│ ACKST > 2             │                         │ AC2 │
  1464.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1465.     │     │          │2│ ACKST <=2             │                         │ AC6 │
  1466.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  1467.     │ AC2 │ SLVerify │1│ ARBLK8 = 1's comp(CHR)│ ARBLK = SendBLK -       │ AC3 │
  1468.     │     │          │ │                       │ ((SendBLK-ARBLK8)&0FFh) │     │
  1469.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1470.     │     │          │2│ ARBLK8 # 1's comp(CHR)│ Reset SEAlink flag,     │ AC6 │
  1471.     │     │          │ │                       │   WINDOW=1,             │     │
  1472.     │     │          │ │                       │   ACKST=0               │     │
  1473.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  1474.     │ AC3 │ SLACKNAK │1│ ARBLK not valid (*1)  │                         │ exit│
  1475.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1476.     │     │          │2│ ACKST = 3             │ Set SEALink flag,       │ AC5 │
  1477.     │     │     (*2) │ │                       │   WINDOW = 6,           │     │
  1478.     │     │          │ │                       │   ACKBLK = ARBLK,       │     │
  1479.     │     │          │ │                       │   Incr ACKs Rcvd,       │     │
  1480.     │     │          │ │                       │   ACKST=0               │     │
  1481.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1482.     │     │          │3│ ACKST = 4             │ SendBLK = ARBLK,        │ AC4 │
  1483.     │     │          │ │                       │   ACKST=0               │     │
  1484.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  1485.     │ AC4 │ XMCheck  │1│ NumNAK < 4            │ Set SEAlink Flag,       │ exit│
  1486.     │     │          │ │                       │   WINDOW = 6            │     │
  1487.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1488.     │     │          │2│ NumNAK >= 4           │ Reset SEAlink flag,     │ exit│
  1489.     │     │          │ │                       │   WINDOW = 1            │     │
  1490.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  1491.     │ AC5 │ SLOCheck │1│ SLO Reset             │                         │ exit│
  1492.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1493.     │     │          │2│ ACKs Rcvd < 10        │                         │ exit│
  1494.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1495.     │     │          │3│ ACKs Rcvd >= 10       │ Reset SLO               │ exit│
  1496.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  1497.     │ AC6 │ SL1Check │1│ ACKST = 1 or 2        │ ARBLK8 = CHR,           │ AC6 │
  1498.     │     │          │ │                       │   ACKST = ACKST+2       │     │
  1499.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1500.     │     │          │2│ SEAlink reset         │                         │ AC7 │
  1501.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1502.     │     │          │3│ ACKST = 0             │                         │ AC7 │
  1503.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1504.     │     │          │4│ ACKST > 2             │                         │ exit│
  1505.     └─────┴──────────┴─┴───────────────────────┴─────────────────────────┴─────┘
  1506.  
  1507.                             (Continued on next page)
  1508.  
  1509.     *1 - ARBLK is valid only if all of the following are true:
  1510.  
  1511.          a. ARBLK >= 0
  1512.          b. ARBLK <= SendBLK
  1513.          c. ARBLK >  SendBLK-128
  1514.  
  1515.     *2 - Software error if ACKST is not 3 or 4 in state AC3
  1516.  
  1517.  
  1518.                                                                             22
  1519.     XMODEM/TeLink/SEAlink - Transmitter ACK/NAK Check
  1520.  
  1521.     ┌─────┬──────────┬─────────────────────────┬─────────────────────────┬─────┐
  1522.     │State│ State    │ Predicate(s)            │ Action(s)               │ Next│
  1523.     │  #  │ Name     │                         │                         │ St  │
  1524.     ├─────┼──────────┼─┬───────────────────────┼─────────────────────────┼─────┤
  1525.     │ AC7 │ ACKNAK   │1│ CHR = ACK             │ ACKST = 1               │ AC8 │
  1526.     │     │          │ │                       │   NumNAK = 0            │     │
  1527.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1528.     │     │          │2│ CHR = NAK or 'C'      │ Set CRC/Chksm if 1st,   │ AC9 │
  1529.     │     │     (*1) │ │                       │   ACKST = 2,            │     │
  1530.     │     │          │ │                       │   Incr NumNAK,          │     │
  1531.     │     │          │ │                       │   Delay 0.6 seconds     │     │
  1532.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1533.     │     │     (*1) │3│ CHR = SYN             │ Receive RESYNC packet,  │ AC10│
  1534.     │     │          │ │                       │   ACKST = 0             │     │
  1535.     │     │     (*2) ├─┼───────────────────────┼─────────────────────────┼─────┤
  1536.     │     │          │4│ CHR = other           │                         │ exit│
  1537.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  1538.     │ AC8 │ XMACK    │1│ SEAlink set           │                         │ exit│
  1539.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1540.     │     │          │2│ SEAlink reset         │ Incr ACKBLK             │ exit│
  1541.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  1542.     │ AC9 │ XMNAK    │1│ SEAlink set           │                         │ exit│
  1543.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1544.     │     │          │2│ SEAlink reset         │ SendBLK = ACKBLK+1      │ exit│
  1545.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  1546.     │ AC10│ RESYNC   │1│ RESYNC pkt invalid    │ Send NAK                │ exit│
  1547.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1548.     │     │          │2│ RESYNC pkt valid      │ Set SEAlink flag,       │ exit│
  1549.     │     │          │ │                       │   WINDOW = 6,           │     │
  1550.     │     │          │ │                       │   SendBLK = RESYNC Blk#,│     │
  1551.     │     │          │ │                       │   ACKBLK = SendBLK-1,   │     │
  1552.     │     │          │ │                       │   Send ACK              │     │
  1553.     └─────┴──────────┴─┴───────────────────────┴─────────────────────────┴─────┘
  1554.  
  1555.     *1 - If the output is buffered in local computer memory, any characters
  1556.          which remain in the local buffer should be purged before leaving
  1557.          states (AC7.2) or (AC7.3) to aid in resynchronizing the link.
  1558.  
  1559.     *2 - If the implementation is honoring MACFLOW protocol, set the flag in
  1560.          the SEAlink header block and add the following state to (AC7):
  1561.  
  1562.     ┌─────┬────────┬───┬───────────────────────┬─────────────────────────┬─────┐
  1563.     │ AC7 │        │3.5│ CHR = ^S (13H) &      │ Delay 10 seconds or     │ exit│
  1564.     │     │        │   │   SEAlink set &       │   until ^Q (11H) rcvd   │     │
  1565.     │     │        │   │   ACKST = 0           │                         │     │
  1566.     └─────┴────────┴───┴───────────────────────┴─────────────────────────┴─────┘
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.                                                                             23
  1585.     XMODEM/TeLink/SEAlink - Receiver
  1586.  
  1587.     ┌─────┬──────────┬─────────────────────────┬─────────────────────────┬─────┐
  1588.     │State│ State    │ Predicate(s)            │ Action(s)               │ Next│
  1589.     │  #  │ Name     │                         │                         │ St  │
  1590.     ├─────┼──────────┼─────────────────────────┼─────────────────────────┼─────┤
  1591.     │ XR0 │ RecInit  │                         │ reset SEAlink flag,     │ XR1 │
  1592.     │     │          │                         │   reset SLO flag,       │     │
  1593.     │     │          │                         │   reset RESYNC flag,    │     │
  1594.     │     │          │                         │   set CRC flag,         │     │
  1595.     │     │          │                         │   set blocknum=0,       │     │
  1596.     │     │          │                         │   set WriteBLK=1,       │     │
  1597.     │     │          │                         │   reset retry cnt       │     │
  1598.     ├─────┼──────────┼─────────────────────────┼─────────────────────────┼─────┤
  1599.     │ XR0B│ BrecInit │  Alternate Entry from   │ reset SEAlink flag,     │ XR2 │
  1600.     │     │          │  Batch Receive (BR4.2)  │   reset SLO flag,       │     │
  1601.     │     │          │  or (BR4.3)             │   reset RESYNC flag,    │     │
  1602.     │     │          │                         │   set CRC flag,         │     │
  1603.     │     │          │                         │   set blocknum=0,       │     │
  1604.     │     │          │                         │   set WriteBLK=1,       │     │
  1605.     │     │          │                         │   reset retry cnt       │     │
  1606.     ├─────┼──────────┼─────────────────────────┼─────────────────────────┼─────┤
  1607.     │ XR1 │ RecStart │                         │ (Send NAK SN0)          │ XR2 │
  1608.     ├─────┼──────────┼─┬───────────────────────┼─────────────────────────┼─────┤
  1609.     │ XR2 │ WaitFirst│1│ 10 retries or 1 minute│ report receive failure  │ exit│
  1610.     │     │          │ │   w/o valid input     │                         │     │
  1611.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1612.     │     │          │2│ > 3 retries or 30 secs│ reset CRC flag          │ XR1 │
  1613.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1614.     │     │          │3│ EOT received          │ (Send ACK SA0),         │ exit│
  1615.     │     │          │ │                       │   report no file        │     │
  1616.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1617.     │     │     (*1) │4│ TeLink block recd     │ (Send ACK SA0),         │ XR3 │
  1618.     │     │          │ │                       │   reset retry cnt       │     │
  1619.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1620.     │     │     (*2) │5│ SEAlink block recd    │ set SEAlink,            │ XR4 │
  1621.     │     │          │ │                       │   set RESYNC as         │     │
  1622.     │     │          │ │                       │   indicated by header   │     │
  1623.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1624.     │     │     (*3) │6│ XMODEM data block 1   │ Write block to file,    │ XR3 │
  1625.     │     │          │ │   received            │   Incr WriteBLK,        │     │
  1626.     │     │          │ │                       │   Incr blocknum,        │     │
  1627.     │     │          │ │                       │   (Send ACK SA0),       │     │
  1628.     │     │          │ │                       │   reset retry cnt       │     │
  1629.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1630.     │     │          │7│ bad block or 2-10 secs│ incr retry count        │ XR1 │
  1631.     │     │          │ │   without input       │                         │     │
  1632.     └─────┴──────────┴─┴───────────────────────┴─────────────────────────┴─────┘
  1633.  
  1634.                               (Continued on next page)
  1635.  
  1636.     *1 - A TeLink header packet has the standard XMODEM data block format except
  1637.          that it begins with an SYN instead of an SOH character and has a block
  1638.          number of 0.  Note: SEAdog (through version 4.51b) does not possess
  1639.          (XR2.4) and therefore will consider a TeLink header a bad block and
  1640.          process it according to (XR2.7) when communicating with mailers which
  1641.          do not do SEAlink protocol.
  1642.  
  1643.     *2 - A SEAlink header packet has the standard XMODEM data block format
  1644.     *3   except that is has a block number of 0. The first block is an XMODEM
  1645.          data block if its block number is not 0.
  1646.  
  1647.  
  1648.  
  1649.  
  1650.                                                                             24
  1651.     XMODEM/TeLink/SEAlink - Receiver (cont.)
  1652.  
  1653.     ┌─────┬──────────┬─────────────────────────┬─────────────────────────┬─────┐
  1654.     │State│ State    │ Predicate(s)            │ Action(s)               │ Next│
  1655.     │  #  │ Name     │                         │                         │ St  │
  1656.     ├─────┼──────────┼─┬───────────────────────┼─────────────────────────┼─────┤
  1657.     │ XR3 │ WaitBlock│1│ 10 retries or 1 minute│ report receive failure  │ exit│
  1658.     │     │          │ │   w/o expected block  │                         │     │
  1659.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1660.     │     │          │2│ EOT received          │ reset SLO flag,         │ exit│
  1661.     │     │          │ │                       │   (Send ACK SA0)        │     │
  1662.     │     │          │ │                       │   report recd ok        │ exit│
  1663.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1664.     │     │          │3│ expected data         │ Decrement blocknum,     │ XR3 │
  1665.     │     │          │ │   block-1 received    │   (Send ACK SA0)        │     │
  1666.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1667.     │     │          │4│ expected data         │ Write block to file,    │ XR3 │
  1668.     │     │          │ │   block received      │   Incr WriteBLK,        │     │
  1669.     │     │          │ │                       │   (Send ACK SA0),       │     │
  1670.     │     │          │ │                       │   reset retry cnt       │     │
  1671.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1672.     │     │          │5│ SEAlink set &         │ Discard block - resync  │ XR3 │
  1673.     │     │          │ │   expected block+1 to │   in progress,          │     │
  1674.     │     │          │ │   expected block+127  │ Send Conditional NAK(*5)│     │
  1675.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1676.     │     │          │6│ bad block or 2-10 secs│ (Send NAK SN0),         │ XR3 │
  1677.     │     │          │ │   without input       │   incr retry cnt        │     │
  1678.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  1679.     │ XR4 │ Restart  │1│ Want entire file      │ (Send ACK SA0),         │ XR5 │
  1680.     │     │          │ │   or RESYNC not set   │ reset retry cnt         │     │
  1681.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1682.     │     │          │2│ Want to resume an     │  WriteBLK = file restart│ XR5 │
  1683.     │     │          │ │   interrupted xfer    │    block number,        │     │
  1684.     │     │          │ │   and RESYNC is set   │  blocknum=WriteBLK&0FFh,│     │
  1685.     │     │          │ │                       │    (Send NAK SN0)       │     │
  1686.     ├─────┼──────────┼─┴───────────────────────┼─────────────────────────┼─────┤
  1687.     │ XR5 │ SetOvrdr │                         │ Set SLO as indicated    │ XR3 │
  1688.     │     │          │                         │   by SEAlink header     │     │
  1689.     └─────┴──────────┴─────────────────────────┴─────────────────────────┴─────┘
  1690.     Note: The routine that receives a header/data block should do the following:
  1691.  
  1692.     1. Report a bad block if the checksum or CRC is not correct or if the
  1693.        physical layer encounters errors (e.g. parity, framing, etc.) regardless
  1694.        of checksum or CRC.  Report a bad block if the length of the block is
  1695.        less than expected (Use a 5 second timeout to detect short blocks).
  1696.     2. If the block's sequence number does not match the complement, then
  1697.        report a bad block if not in SEAlink. If in SEAlink mode don't report
  1698.        this as a bad block, just restart the block search looking for SOH.
  1699.        Check for SOH, BLK, ~BLK characters in a "sliding" fashion and keep
  1700.        cycling until a valid start of block (or timeout) is detected before
  1701.        assembling the remainder of the block.  This procedure makes a resync
  1702.        occur much more rapidly, and with far fewer errors reported.
  1703.     3. If the sequence number and block are good but not the expected number,
  1704.        report state (XR3.3) if previous block.  If not in SEAlink, abort on any
  1705.        other out of sequence block.  If in SEAlink, report back state (XR3.5)
  1706.        or (XR3.6) as indicated by the out of sequence received block number.
  1707.     4. If an EOT is received on a data block prior to the filesize specified
  1708.        in the SEAlink or TeLink header block, a NAK should be issued to ensure
  1709.        that spurious data did not cause a premature EOF.  A NAK should also
  1710.        be issued for the first EOT received in an Xmodem transfer when the
  1711.        final file size is not known.  A second EOT without intervening data
  1712.        would ensure that the file really has been sent, and should be ACK'd.
  1713.     5. If you last sent an ACK, then send a NAK here.  If you last sent a NAK
  1714.        then only NAK evry 32 blocks after the first NAK.  This allows buffer
  1715.        drain in overdrive.  Use (Send NAK SN0) to send the NAK.
  1716.                                                                             25
  1717.     XMODEM/TeLink/SEAlink - Send NAK
  1718.  
  1719.     ┌─────┬──────────┬─────────────────────────┬─────────────────────────┬─────┐
  1720.     │State│ State    │ Predicate(s)            │ Action(s)               │ Next│
  1721.     │  #  │ Name     │                         │                         │ St  │
  1722.     ├─────┼──────────┼─┬───────────────────────┼─────────────────────────┼─────┤
  1723.     │ SN0 │ ClearLine│1│ RESYNC flag set       │ Send RESYNC packet      │ SN3 │
  1724.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1725.     │     │          │2│ SEAlink flag set      │                         │ SN1 │
  1726.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1727.     │     │          │3│ > 30 sec contin data  │ report failure          │ exit│
  1728.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1729.     │     │          │4│ character waiting     │ eat character           │ SN0 │
  1730.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1731.     │     │          │5│ clear line            │                         │ SN1 │
  1732.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  1733.     │ SN1 │ SendNAK  │1│ CRC flag set          │ Send "C"                │ SN2 │
  1734.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1735.     │     │          │2│ CRC flag reset        │ send NAK                │ SN2 │
  1736.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  1737.     │ SN2 │ SEAlink  │1│ SEAlink flag reset    │                         │ exit│
  1738.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1739.     │     │          │2│ SEAlink flag set      │ send blocknum, ~blocknum│ exit│
  1740.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  1741.     │ SN3 │ AckResync│1│ Rcv ACK               │                         │ exit│
  1742.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1743.     │     │          │2│ Rcv NAK               │ Resend RESYNC packet    │ SN3 │
  1744.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1745.     │     │          │3│ Rcv Other Char        │ eat character           │ SN3 │
  1746.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1747.     │     │          │4│ No char for 10 secs   │ Resend RESYNC packet    │ SN3 │
  1748.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1749.     │     │          │5│ 30 seconds in SN3     │                         │ exit│
  1750.     └─────┴──────────┴─┴───────────────────────┴─────────────────────────┴─────┘
  1751.     Note: RESYNC packet should send WriteBLK as its desired block number.
  1752.  
  1753.  
  1754.     XMODEM/TeLink/SEAlink - Send ACK
  1755.  
  1756.     ┌─────┬──────────┬─────────────────────────┬─────────────────────────┬─────┐
  1757.     │State│ State    │ Predicate(s)            │ Action(s)               │ Next│
  1758.     │  #  │ Name     │                         │                         │ St  │
  1759.     ├─────┼──────────┼─┬───────────────────────┼─────────────────────────┼─────┤
  1760.     │ SA0 │ ClearLine│1│ SLO flag set          │                         │ SA3 │
  1761.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1762.     │     │          │2│ SEAlink flag set      │                         │ SA1 │
  1763.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1764.     │     │          │3│ > 30 sec contin data  │ report failure          │ exit│
  1765.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1766.     │     │          │4│ character waiting     │ eat character           │ SA0 │
  1767.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1768.     │     │          │5│ No char waiting       │                         │ SA1 │
  1769.     ├─────┼──────────┼─┴───────────────────────┼─────────────────────────┼─────┤
  1770.     │ SA1 │ SendACK  │                         │ Send ACK                │ SA2 │
  1771.     ├─────┼──────────┼─┬───────────────────────┼─────────────────────────┼─────┤
  1772.     │ SA2 │ SEAlink  │1│ SEAlink flag reset    │                         │ SA3 │
  1773.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1774.     │     │          │2│ SEAlink flag set      │ send blocknum, ~blocknum│ SA3 │
  1775.     ├─────┼──────────┼─┴───────────────────────┼─────────────────────────┼─────┤
  1776.     │ SA3 │ IncBlk   │                         │ Incr blocknum           │ exit│
  1777.     └─────┴──────────┴─────────────────────────┴─────────────────────────┴─────┘
  1778.  
  1779.  
  1780.  
  1781.  
  1782.                                                                             26
  1783.  3. Data Link Layer Protocol : MODEM7 Filename Finite State Machines
  1784.     (There is no change to the MODEM7 state tables from FTS-0001).
  1785.  
  1786.     MODEM7 Filename Sender
  1787.  
  1788.     ┌─────┬──────────┬─────────────────────────┬─────────────────────────┬─────┐
  1789.     │State│ State    │ Predicate(s)            │ Action(s)               │ Next│
  1790.     │  #  │ Name     │                         │                         │ St  │
  1791.     ├─────┼──────────┼─┬───────────────────────┼─────────────────────────┼─────┤
  1792.     │ MS0 │ WaitNak  │1│ 20 retries or 1 minute│ filename send failed    │ exit│
  1793.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1794.     │     │          │2│ NAK received          │ send ACK & 1st ch of fn │ MS1 │
  1795.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  1796.     │ MS1 │ WaitChAck│1│ ACK rcd, fname done   │ send SUB = 1AH          │ MS2 │
  1797.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1798.     │     │          │2│ ACK rcd, fname ~done  │ send next ch of fname   │ MS1 │
  1799.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1800.     │     │          │3│ other char or 1 sec   │ send "u", incr retry cnt│ MS0 │
  1801.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  1802.     │ MS2 │ WaitCksm │1│ cksum recd and ok     │ send ACK, report fn ok  │ exit│
  1803.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1804.     │     │          │2│ cksum recd but bad    │ send "u", incr retry cnt│ MS0 │
  1805.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1806.     │     │          │3│ no cksum in 1 sec     │ send "u", incr retry cnt│ MS0 │
  1807.     └─────┴──────────┴─┴───────────────────────┴─────────────────────────┴─────┘
  1808.  
  1809.  
  1810.     MODEM7 Filename Receiver
  1811.  
  1812.     ┌─────┬──────────┬─────────────────────────┬─────────────────────────┬─────┐
  1813.     │State│ State    │ Predicate(s)            │ Action(s)               │ Next│
  1814.     │  #  │ Name     │                         │                         │ St  │
  1815.     ├─────┼──────────┼─┬───────────────────────┼─────────────────────────┼─────┤
  1816.     │ MR0 │ SendNak  │1│ 20 tries or 1 minute  │ report filename failure │ exit│
  1817.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1818.     │     │          │2│                       │ send NAK, incr try cnt  │ MR1 │
  1819.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  1820.     │ MR1 │ WaitAck  │1│ rcd ACK               │                         │ MR2 │
  1821.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1822.     │     │          │2│ rcd EOT               │ report no files remain  │ exit│
  1823.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1824.     │     │          │3│ 5 secs & no ACK/EOT   │                         │ MR0 │
  1825.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  1826.     │ MR2 │ WaitChar │1│ recd EOT (can happen?)│ report no files remain  │ exit│
  1827.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1828.     │     │          │2│ recd SUB              │ send checksum byte      │ MR3 │
  1829.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1830.     │     │          │3│ recd "u"              │                         │ MR0 │
  1831.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1832.     │     │          │4│ recd char of name     │ send ACK                │ MR2 │
  1833.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1834.     │     │          │5│ no char in 1 second   │                         │ MR0 │
  1835.     ├─────┼──────────┼─┼───────────────────────┼─────────────────────────┼─────┤
  1836.     │ MR3 │ WaitOkCk │1│ recd ACK within 1 sec │ report recd filename ok │ exit│
  1837.     │     │          ├─┼───────────────────────┼─────────────────────────┼─────┤
  1838.     │     │          │2│ recd "u" or other char│                         │ MR0 │
  1839.     └─────┴──────────┴─┴───────────────────────┴─────────────────────────┴─────┘
  1840.  
  1841.     SUB  is the ASCII character ^Z or 1AH.  The checksum is the unsigned low
  1842.     order eight bits of the sum of the characters in the transferred filename
  1843.     including the SUB.
  1844.  
  1845.     Although 1 second timeouts are used successfully by Fido and SEAdog, some
  1846.     fear that this is too small a value for some satellite and packet networks.
  1847.  
  1848.                                                                             27
  1849.