home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / FSC.ZIP / FSC-0001.TXT < prev    next >
Text File  |  1987-12-27  |  66KB  |  1,585 lines

  1. FSC-0001
  2.  
  3.  
  4.  
  5.  
  6.                     A Basic FidoNet(tm) Technical Standard
  7.                       Draft FSC001-9   December 27, 1987
  8.                       Randy Bush,  Pacific Systems Group
  9.  
  10.  
  11.  Copyright 1986,7,8, International FidoNet Association.  All rights reserved.
  12.  
  13.   Duplication and or distribution permitted for noncommercial purposes only.
  14.              For use in other circumstances, please contact IFNA.
  15.  
  16.  
  17.  A. Introduction
  18.  
  19.     FidoNet  has  grown  beyond  most  peoples' fantasies, and  new  FidoNet
  20.     implementations  are appearing regularly.  Unfortunately, the  scattered
  21.     nature of the documentation and absence of clear testing procedures have
  22.     made  implementation difficult.   The International FidoNet  Association
  23.     (IFNA),  in its desire to promote and encourage FidoNet implementations,
  24.     suggested a project to create a technical standard for FidoNet.  This is
  25.     the first draft document from that effort.
  26.  
  27.     This  document defines the  data structures and communication  protocols
  28.     which a FidoNet implementation must provide.  The implementor of FidoNet
  29.     compatible systems is the intended audience of this document.
  30.  
  31.     The  layered metaphor of the ISO Open Systems Interface reference  model
  32.     has been used to view FidoNet from a standard perspective.  As with most
  33.     prospective  ISO/OSI  descriptions, FidoNet  does not always  make  this
  34.     easy.
  35.  
  36.     The  content of this document  was gleaned from the references given  at
  37.     the  end.  This is not a a proposal,  nor is it yet a standard; it is  a
  38.     plea for correction, more information, and other reference documents.
  39.  
  40.     Please direct technical comments and errata to
  41.       Randy Bush                       FidoNet : 1:105/6
  42.       Pacific Systems Group            Usenet  : ..!tektronix!oresoft!randy
  43.       9501 S.W. Westhaven Drive        Telemail: RBush
  44.       Portland, Oregon  US-97225
  45.     and administrative enquiries to
  46.       Don Daniels, VP-Technical        FidoNet : 1:1/0
  47.       International FidoNet Association
  48.       PO Box 41143
  49.       St. Louis, Missouri  US-63141
  50.  
  51.  
  52.    1. Basic Requirements for a FidoNet Implementation
  53.  
  54.       Compatibility is a set of abilities which, when taken as a whole, make
  55.       it  safe to list a net or node in the IFNA nodelist.  In other  words,
  56.       if  another  node should attempt  contact, does it have  a  reasonable
  57.       chance  of successful communication?  This is a social obligation,  as
  58.       the  calling  system  pays  money  for the  attempt.   Conversely,  an
  59.       implementation  should be able to successfully contact other  systems,
  60.       as life is not a one-way street.
  61.  
  62.       A FidoNet implementation must be able to call other nodes and transfer
  63.       messages and files in both directions.  This includes pickup and poll.
  64.  
  65.  
  66.                                                                            1
  67.  
  68.  
  69.       A FidoNet implementation must be able to accept calls from other nodes
  70.       and  transfer  messages and  files in both directions.  This  includes
  71.       pickup.
  72.  
  73.       A  FidoNet implementation must be able to receive and process the IFNA
  74.       format  nodelist, and transfer nodelists to other nodes.  A  companion
  75.       document,  FSC002,  defines  the  IFNA  format  nodelist  and  how  to
  76.       interpret and process it.
  77.  
  78.       A  FidoNet implementation must route messages which do not have  files
  79.       attached through net hosts as shown in an IFNA format nodelist.
  80.  
  81.  
  82.    2. Levels of Compliance
  83.  
  84.       This  documents represents the  most basic FidoNet implementation.   A
  85.       future  document will define well tested extensions which are optional
  86.       but  provide sufficient  additional function that implementors  should
  87.       seriously   consider   them.   SEAdog(tm),  from  System   Enhancement
  88.       Associates,  is  an  excellent  example  of such an  extended  FidoNet
  89.       implementation.
  90.  
  91.  
  92.    3. The ISO/OSI Reference Model (cribbed from "Protocol Verification via
  93.       Executable Logic Specifications", D. P. Sidhu, in Rudin & West)
  94.  
  95.       In  the ISO/OSI model, a distributed system consists of entities  that
  96.       communicate  with  each other  according  to a set of rules  called  a
  97.       protocol.   The  model is  layered, and there are entities  associated
  98.       with  each layer of the model which provide services to higher  layers
  99.       by  exchanging information with their peer entities using the services
  100.       of  lower layers.  The only actual physical communication between  two
  101.       systems is at the lowest level.
  102.  
  103.       Several  techniques  have  been  used  in the  specification  of  such
  104.       protocols.  A common ingredient in all techniques is the notion of the
  105.       extended  finite  state automata  or machine.  Extensions include  the
  106.       addition of state variables for the storing of state information about
  107.       the  protocol.  The state of an  automation can change as a result  of
  108.       one of the following events:
  109.  
  110.       o Request from an upper network layer for service
  111.  
  112.       o Response to the upper layer
  113.  
  114.       o Request to the lower network layer to perform a service
  115.  
  116.       o Response from the lower layer
  117.  
  118.       o Interaction with the system and environment in which the protocol is
  119.         implemented (e.g. timeouts, host operating system aborts, ...)
  120.  
  121.       A  protocol  specification, in  a large part, consists  of  specifying
  122.       state  changes  in  automata  which  model protocol  entities  and  in
  123.       describing the data which they exchange.
  124.  
  125.       For  historical  reasons,  the  term  packet  is used  in  FidoNet  to
  126.       represent a bundle of messages, as opposed to the more common use as a
  127.       unit of communication, which is known as a block in FidoNet.
  128.  
  129.  
  130.  
  131.  
  132.                                                                            2
  133.  
  134.  
  135.    4. Data Description
  136.  
  137.       A  language  specific  notation  was avoided.  Please help  stamp  out
  138.       environmental  dependencies.   Only  you  can  prevent  PClone  market
  139.       dominance.  Don't panic, there are rectangular record layouts too.
  140.  
  141.       (* non-terminals *)
  142.       UpperCaseName - to be defined further on
  143.  
  144.       (* literals *)
  145.       "ABC"         - ASCII character string, no termination implied
  146.       nnH           - byte in hexadecimal
  147.  
  148.       (* terminals *)
  149.       someName      - 16-bit integer, low order byte first (8080 style)
  150.       someName[n]   - field of n bytes
  151.       someName[.n]  - field of n bits
  152.       someName(n)   - Null terminated string allocated n chars (incl Null)
  153.       someName{max} - Null terminated string of up to max chars (incl Null)
  154.  
  155.       (* punctuation *)
  156.       a b           - one 'a' followed by one 'b'
  157.       ( a | b )     - either 'a' or 'b', but not both
  158.       { a }         - zero or more 'a's
  159.       [ b ]         - zero or one 'b'
  160.       (* comment *) - ignored
  161.  
  162.       (* predeclared constant *)
  163.       Null          = 00H
  164.  
  165.  
  166.  
  167.  5. Finite State Machine Notation
  168.  
  169.     .-----+----------+-------------------------+-------------------------+-----.
  170.     |State| State    | Predicate(s)            | Action(s)               | Next|
  171.     |  #  | Name     |                         |                         |  St |
  172.     |-----+----------+-------------------------+-------------------------+-----|
  173.     | fnn*|          |                         |                         |     |
  174.     `-----+----------+-------------------------+-------------------------+-----'
  175.  
  176.     State #      - Number of this state (e.g. R13).
  177.                    f  - FSM initial (Window, Sender, Receiver, ...)
  178.                    nn - state number
  179.                    *  - state which represents a lower level protocol  which
  180.                         is represented by yet another automation.
  181.  
  182.     State Name   - Descriptive name of this state.
  183.  
  184.     Predicate(s) - Conditions which terminate the state.  If predicates are
  185.                    non-exclusive, consider them ordered.
  186.  
  187.     Action(s)    - Action(s) corresponding to predicate(s)
  188.  
  189.     Next State   - Subsequent state corresponding to predicate(s)
  190.  
  191.     Ideally,  there  should be  a  supporting section for each  state  which
  192.     should  give a prose discription of the state, its predicates,  actions,
  193.     etc.  So much for ideals.
  194.  
  195.  
  196.  
  197.  
  198.                                                                            3
  199.  
  200.  
  201.  B. Application Layer : the System from the User's View
  202.  
  203.     The application layer is outside the domain of a FidoNet standard, as it
  204.     is the layer that the user's application sees as opposed to what FidoNet
  205.     sees.   In  recent  months,  there  has been  sufficient  confusion  and
  206.     discussion  about  the  format  of  data at this level  to  warrant  the
  207.     description  of the data structure, the message as it is stored by Fido,
  208.     SEAdog, and Rover.
  209.  
  210.     Perfectly valid FidoNet systems may be implemented whose stored messages
  211.     differ greatly from this format.
  212.  
  213.  
  214.    1. Application Layer Data Definition : a Stored Message
  215.  
  216.                                Stored Message
  217.  
  218.        Offset
  219.       dec hex
  220.               .-----------------------------------------------.
  221.         0   0 |                                               |
  222.               ~                 fromUserName                  ~
  223.               |                   36 bytes                    |
  224.               +-----------------------+-----------------------+
  225.        36  24 |                                               |
  226.               ~                  toUserName                   ~
  227.               |                   36 bytes                    |
  228.               +-----------------------+-----------------------+
  229.        72  48 |                                               |
  230.               ~                    subject                    ~
  231.               |                   72  bytes                   |
  232.               +-----------------------+-----------------------+
  233.       144  90 |                                               |
  234.               ~                    dateTime                   ~
  235.               |                    20 bytes                   |
  236.               +-----------------------+-----------------------+
  237.       164  A4 | timesRead (low order) | timesRead (high order)|
  238.               +-----------------------+-----------------------+
  239.       166  A6 | destNode (low order)  | destNode (high order) |
  240.               +-----------------------+-----------------------+
  241.       168  A8 | origNode (low order)  | origNode (high order) |
  242.               +-----------------------+-----------------------+
  243.       170  AA |   cost (low order)    |   cost (high order)   |
  244.               +-----------------------+-----------------------+
  245.       172  AC | origNet (low order)   | origNet (high order)  |
  246.               +-----------------------+-----------------------+
  247.       174  AE | destNet (low order)   | destNet (high order)  |
  248.               +-----------------------+-----------------------+
  249.       176  B0 |                     fill                      |
  250.               ~                    8 bytes                    ~
  251.               +-----------------------+-----------------------+
  252.       184  B8 |  replyTo (low order)  |  replyTo (high order) |
  253.               +-----------------------+-----------------------+
  254.       186  BA | Attribute (low order) | Attribute (high order)|
  255.               +-----------------------+-----------------------+
  256.       188  BC | nextReply (low order) | nextReply (high order)|
  257.               +-----------------------+-----------------------+
  258.       190  BE |                      text                     |
  259.               ~                    unbounded                  ~
  260.               |                 null terminated               |
  261.               `-----------------------------------------------'
  262.  
  263.  
  264.                                                                            4
  265.  
  266.  
  267.       Message    = fromUserName(36)  (* Null terminated *)
  268.                    toUserName(36)    (* Null terminated *)
  269.                    subject(72)       (* see FileList below *)
  270.                    DateTime          (* message body was last edited *)
  271.                    timesRead
  272.                    destNode          (* of message *)
  273.                    origNode          (* of message *)
  274.                    cost              (* in lowest unit of originator's
  275.                                         currency *)
  276.                    origNet           (* of message *)
  277.                    destNet           (* of message *)
  278.                    fill[8]
  279.                    replyTo           (* msg to which this replies *)
  280.                    AttributeWord
  281.                    nextReply         (* msg which replies to this *)
  282.                    text(unbounded)   (* Null terminated *)
  283.  
  284.       DateTime   = (* a character string 20 characters long *)
  285.                                      (* 01 Jan 86  02:34:56 *)
  286.                    DayOfMonth " " Month " " Year " "
  287.                    " " HH ":" MM ":" SS
  288.                    Null
  289.  
  290.       DayOfMonth = "01" | "02" | "03" | ... | "31"   (* Fido 0 fills *)
  291.       Month      = "Jan" | "Feb" | "Mar" | "Apr" | "May" | "Jun" |
  292.                    "Jul" | "Aug" | "Sep" | "Oct" | "Nov" | "Dec"
  293.       Year       = "01" | "02" | .. | "85" | "86" | ... | "99" | "00"
  294.       HH         = "00" | .. | "23"
  295.       MM         = "00" | .. | "59"
  296.       SS         = "00" | .. | "59"
  297.  
  298.       AttributeWord   bit       meaning
  299.                       ---       --------------------
  300.                         0  +    Private
  301.                         1  + s  Crash
  302.                         2       Recd
  303.                         3       Sent
  304.                         4  +    FileAttached
  305.                         5       InTransit
  306.                         6       Orphan
  307.                         7       KillSent
  308.                         8       Local
  309.                         9    s  HoldForPickup
  310.                        10  +    unused
  311.                        11    s  FileRequest
  312.                        12  + s  ReturnReceiptRequest
  313.                        13  + s  IsReturnReceipt
  314.                        14  + s  AuditRequest
  315.                        15    s  FileUpdateReq
  316.  
  317.                              s - this bit is supported by SEAdog only
  318.                            + - this bit is not zeroed before packeting
  319.  
  320.       Bits numbers ascend with arithmetic significance of bit position.
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.                                                                            5
  331.  
  332.  
  333.       Message Text
  334.  
  335.       Message text is unbounded and null terminated (note exception below).
  336.  
  337.       A 'hard' carriage return, 0DH,  marks the end of a paragraph, and must
  338.       be preserved.
  339.  
  340.       So   called  'soft'  carriage  returns,  8DH,  may  mark  a   previous
  341.       processor's  automatic line wrap, and should be ignored.  Beware  that
  342.       they may be followed by linefeeds, or may not.
  343.  
  344.       All  linefeeds, 0AH, should be ignored.  Systems which display message
  345.       text should wrap long lines to suit their application.
  346.  
  347.       If the first character of a physical line (e.g. the first character of
  348.       the  message text, or the character immediately after a hard  carriage
  349.       return (ignoring any linefeeds)) is a ^A (<control-A>, 01H), then that
  350.       line  is  not  displayed  as  it  contains  control  information.  The
  351.       convention for such control lines is:
  352.         o They begin with ^A
  353.         o They end at the end of the physical line (i.e. ignore soft <cr>s).
  354.         o They begin with a keyword followed by a colon.
  355.         o The keywords are uniquely assigned to applications.
  356.         o They keyword/colon pair is followed by application specific data.
  357.  
  358.       Current ^A keyword assignments are:
  359.       o TOPT <pt no> - origin point address
  360.       o FMPT <pt no> - origin point address
  361.       o INTL <dest z:n/n> <orig z:n/n> - used for inter-zone address
  362.  
  363.       In  order to provide minimal support for NAPLPS graphics, applications
  364.       should  display without interpretation  any bytes found between  ????,
  365.       ??H,  and ????, ??H.  The surrounded  data bytes may be any eight  bit
  366.       characters  with the exception of  the terminating byte, ??H.  Do  not
  367.       strip carriage returns, soft or hard, or linefeeds.
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.                                                                            6
  397.  
  398.  
  399.       File Specifications
  400.  
  401.       If  one  or more  of FileAttached, FileRequest, or  FileUpdateReq  are
  402.       asserted  in an AttributeWord, the subject{72} field is interpreted as
  403.       a  list of file specifications  which may include wildcards and  other
  404.       system-dependent data.  This list is of the form
  405.  
  406.       FileList = [ FileSpec { Sep FileSpec } ] Null
  407.  
  408.       FileSpec = (* implementation dependent file specification.  may
  409.                     not contain Null or any of the characters in Sep. *)
  410.  
  411.       Sep      = ( " " | "," )  { " " }
  412.  
  413.  
  414.  
  415.  
  416.       There are deviations from and additions to these specifications
  417.  
  418.       1  - Fido does not necessarily terminate the message text with a Null,
  419.            but uses an empty line (0DH 0AH 0DH 0AH)
  420.  
  421.       2 - SEAdog zeros the message cost field when building a message.
  422.  
  423.       4 - SEAdog uses a different format for dates, e.g.
  424.  
  425.       DateTime   = (* a character string 20 characters long *)
  426.                        (* SEAdog format Mon  1 Jan 86 02:34 *)
  427.                    DayOfWk " " DayOfMo " " Month " " Year "
  428.                    " HH ":" MM Null
  429.  
  430.       DayOfWeek  = "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat" | "Sun"
  431.       DayOfMon   = " 1" | " 2" | " 3" | ... | "31"  (* blank fill *)
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.    2. Application Layer Protocol : Schedules and Events
  439.  
  440.       At  the application level, FidoNet imposes few protocol  requirements.
  441.       An   implementation   must   automatically   originate   and   receive
  442.       node-to-node  FidoNet  connections.   Some implementations do this  in
  443.       'windows'  or  time  slots.   Routing  of  messages  will  usually  be
  444.       different and customizable for each scheduled window.
  445.  
  446.       The  ability to send to and  receive from any IFNA listed node  during
  447.       the National Mail Hour (09:00 - 10:00 UCT) is considered mandatory.
  448.  
  449.       Current  implementations assemble all data for outbound connections at
  450.       the  start of a window, and  disassemble inbound data at the end of  a
  451.       window.   Due to performance considerations on small machines, this is
  452.       considered  a valid optimization.   Observe that it somewhat  inhibits
  453.       dynamic routing.
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.                                                                            7
  463.  
  464.  
  465.  C. Presentation Layer : the User from the System's View
  466.  
  467.    1. Presentation Layer Data Definition : the Packed Message
  468.  
  469.       To  conserve space and eliminate fields which would be meaningless  if
  470.       sent  (e.g. timesRead), messages are packed for transmission.  As this
  471.       is  a data structure which is actually transferred, its definition  is
  472.       critical  to FidoNet.  A packed  message has a number of fixed  length
  473.       fields followed by four null terminated strings.
  474.  
  475.       While  most of the string fields in a stored message are fixed length,
  476.       to  conserve space strings are variable length when in a packet.   All
  477.       variable  length strings are all Null terminated, including especially
  478.       the message text.
  479.  
  480.  
  481.                                 Packed Message
  482.  
  483.        Offset
  484.       dec hex
  485.               .-----------------------------------------------.
  486.         0   0 |    0     |     2      |    0      |    0      |
  487.               +-----------------------+-----------------------+
  488.         2   2 | origNode (low order)  | origNode (high order) |
  489.               +-----------------------+-----------------------+
  490.         4   4 | destNode (low order)  | destNode (high order) |
  491.               +-----------------------+-----------------------+
  492.         6   8 | origNet (low order)   | origNet (high order)  |
  493.               +-----------------------+-----------------------+
  494.         8   8 | destNet (low order)   | destNet (high order)  |
  495.               +-----------------------+-----------------------+
  496.        10   A | Attribute (low order) | Attribute (high order)|
  497.               +-----------------------+-----------------------+
  498.        12   C |   cost (low order)    |   cost (high order)   |
  499.               +-----------------------+-----------------------+
  500.        14   E |                                               |
  501.               ~                    dateTime                   ~
  502.               |                    20 bytes                   |
  503.               +-----------------------+-----------------------+
  504.        24  18 |                  toUserName                   |
  505.               ~                  max 36 bytes                 ~
  506.               |                null terminated                |
  507.               +-----------------------+-----------------------+
  508.               |                 fromUserName                  |
  509.               ~                  max 36 bytes                 ~
  510.               |                null terminated                |
  511.               +-----------------------+-----------------------+
  512.               |                    subject                    |
  513.               ~                  max 72 bytes                 ~
  514.               |                null terminated                |
  515.               +-----------------------+-----------------------+
  516.               |                      text                     |
  517.               ~                    unbounded                  ~
  518.               |                 null terminated               |
  519.               `-----------------------------------------------'
  520.  
  521.       Due  to routing, the origin and  destination net and node of a  packet
  522.       are  often quite different from  those of the messages within it,  nor
  523.       need  the origin and destination nets and nodes of the messages within
  524.       a packet be homogenous.
  525.  
  526.  
  527.  
  528.                                                                            8
  529.  
  530.  
  531.       PakdMessage  = 02H 00H           (* message type, old type-1 is
  532.                                           obsolete *)
  533.                      origNode          (* of message *)
  534.                      destNode          (* of message *)
  535.                      origNet           (* of message *)
  536.                      destNet           (* of message *)
  537.                      AttributeWord
  538.                      cost              (* in lowest unit of originator's
  539.                                           currency *)
  540.                      DateTime          (* message body was last edited *)
  541.                      toUserName{36}    (* Null terminated *)
  542.                      fromUserName{36}  (* Null terminated *)
  543.                      subject{72}       (* Null terminated *)
  544.                      text{unbounded}   (* Null terminated *)
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  2. Presentation Layer Protocol : a Mail Window
  553.  
  554.     .-----+----------+-------------------------+-------------------------+-----.
  555.     |State| State    | Predicate(s)            | Action(s)               | Next|
  556.     |  #  | Name     |                         |                         | St  |
  557.     |-----+----------+-------------------------+-------------------------+-----|
  558.     | W0  | WindTop  | 1 end of window reached | reset modem to not answr| exit|
  559.     |     |          | 2 time remains in window| ensure modem can answer | W1  |
  560.     |-----+----------+-------------------------+-------------------------+-----|
  561.     | W1  | WindIdle | 1 incoming call         |                         | W2  |
  562.     |     |          | 2 receive-only mode     |                         | W0  |
  563.     |     |          | 3 send-only mode        |                         | W3  |
  564.     |     |          | 4 60-180 secs & no call |                         | W3  |
  565.     |-----+----------+-------------------------+-------------------------+-----|
  566.     | W2* | WindRecv |                         | (receive call R0)       | W3  |
  567.     |-----+----------+-------------------------+-------------------------+-----|
  568.     | W3  | WindCall | 1 select outgoing call  | increment try count     | W4  |
  569.     |     |          | 2 no outgoing calls     |                         | W0  |
  570.     |-----+----------+-------------------------+-------------------------+-----|
  571.     | W4* | WindSend |                         | (make call S0)          | W5  |
  572.     |-----+----------+-------------------------+-------------------------+-----|
  573.     | W5  | WindMark | 1 call successful       | remove node fr call list| W0  |
  574.     |     |          | 2 no connect            | remove if try cnt > lim | W0  |
  575.     |     |          | 3 call failed           | incr conn cnt, remove   | W0  |
  576.     |     |          |                         |   if con cnt > lim      |     |
  577.     `-----+----------+-------------------------+-------------------------+-----'
  578.  
  579.  
  580.     The  length of the inter-call delay time at W1.4 is not critical.  It is
  581.     important  that this not be a constant, so two systems calling eachother
  582.     do  not incur infinite busy signals.  Sophisticated implementations  may
  583.     vary  the  inter-call delay  depending  on number of calls to  be  made,
  584.     window width, user specification, etc.
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.                                                                            9
  595.  
  596.  
  597.  D. Session Layer Protocol : Connecting to Another FidoNet Machine
  598.  
  599.     A session is a connection between two FidoNet machines.  It is currently
  600.     assumed  to be over the  DDD telephone network via modems.  The  calling
  601.     machine starts out as the sender and the called machine as the receiver.
  602.     The  pickup  feature is described  by the sender and  receiver  changing
  603.     roles  midway through the session, after the sender has transferred  the
  604.     message  packet and any attached files.  Due to the lack of security  in
  605.     the  pickup protocol (danger of pickup by a fake node), a change in  the
  606.     protocol may be expected in the near future.
  607.  
  608.     Once  a connection has been established, each system should ensure  that
  609.     the  physical connection remains  throughout the session.  For  physical
  610.     layers  implemented  through modems,  this means monitoring the  carrier
  611.     detect signal, and terminating the session if it is lost.
  612.  
  613.     Error  detection at the physical layer should be monitored for both sent
  614.     and  received  characters.  Parity,  framing, and other physical  errors
  615.     should be detected.
  616.  
  617.     Sender
  618.  
  619.     .-----+----------+-------------------------+-------------------------+-----.
  620.     |State| State    | Predicate(s)            | Action(s)               | Next|
  621.     |  #  | Name     |                         |                         | St  |
  622.     |-----+----------+-------------------------+-------------------------+-----|
  623.     | S0  | SendInit |                         | dial modem              | S1  |
  624.     |-----+----------+-------------------------+-------------------------+-----|
  625.     | S1  | WaitCxD  | 1 carrier detected      | delay 1-5 seconds       | S2  |
  626.     |     |          | 2 busy, etc.            | report no connection    | exit|
  627.     |     |          | 3 voice                 | report no carrier       | exit|
  628.     |     |          | 4 carrier not detected  | report no connection    | exit|
  629.     |     |          |   within 60 seconds     |                         |     |
  630.     |-----+----------+-------------------------+-------------------------+-----|
  631.     | S2  | WhackCRs | 1 over 30 seconds       | report no response <cr> | exit|
  632.     |     |          | 2 ?? <cr>s received     | delay 1 sec             | S3  |
  633.     |     |          | 3 <cr>s not received    | send <cr> <sp> <cr> <sp>| S2  |
  634.     |     |          |                         |   delay ??? secs        |     |
  635.     |-----+----------+-------------------------+-------------------------+-----|
  636.     | S3  | WaitClear| 1 no input for 0.5 secs | send TSYNCH = AEH       | S4  |
  637.     |     |          | 2 over 60 seconds       | hang up, report garbage | exit|
  638.     |     |          |   and line not clear    |                         |     |
  639.     |-----+----------+-------------------------+-------------------------+-----|
  640.     | S4* | SendMail |                         | (XMODEM send packet XS0)| S5  |
  641.     |-----+----------+-------------------------+-------------------------+-----|
  642.     | S5  | CheckMail| 1 XMODEM successful     | (Fido registers success)| S6  |
  643.     |     |          | 2 XMODEM fail or timeout| hang up, report mail bad| exit|
  644.     |-----+----------+-------------------------+-------------------------+-----|
  645.     | S6* | SendFiles|                         | (BATCH send files BS0)  | S7  |
  646.     |-----+----------+-------------------------+-------------------------+-----|
  647.     | S7  | CheckFile| 1 BATCH send successful |                         | S8  |
  648.     |     |          | 2 BATCH send failed     | hang up, rept files fail| exit|
  649.     |-----+----------+-------------------------+-------------------------+-----|
  650.     | S8  | TryPickup| 1 wish to pickup        | note send ok            | R2* |
  651.     |     |          | 2 no desire to pickup   | delay 5 secs            | exit|
  652.     |     |          |                         |   hang up, rept send ok |     |
  653.     `-----+----------+-------------------------+-------------------------+-----'
  654.  
  655.     Although  the  above  shows  the  sender  emitting only one  TSYNCH,  it  is
  656.     recommended  that a timeout of 5-20 seconds should initiate another TSYNCH.
  657.     The receiver should tolerate multiple TSYNCHs.
  658.  
  659.  
  660.                                                                            10
  661.  
  662.  
  663.     Receiver
  664.  
  665.     The  receiving FSM is given  an external timer, the expiration of  which
  666.     will cause termination with a result of 'no calls' (R0.2).
  667.  
  668.     .-----+----------+-------------------------+-------------------------+-----.
  669.     |State| State    | Predicate(s)            | Action(s)               | Next|
  670.     |  #  | Name     |                         |                         | St  |
  671.     |-----+----------+-------------------------+-------------------------+-----|
  672.     | R0  | WaitCxD  | 1 carrier detected      |                         | R1  |
  673.     |     |          | 2 external timer expires| report no calls         | exit|
  674.     |-----+----------+-------------------------+-------------------------+-----|
  675.     | R1  | WaitBaud | 1 baud rate detected    | send signon with <cr>s  | R2  |
  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.     |     |          | 2 60 seconds timeout    | hang up, report not Fido| exit|
  680.     |-----+----------+-------------------------+-------------------------+-----|
  681.     | R3* | RecMail  |                         | (XMODEM rec packet XR0) | R4  |
  682.     |-----+----------+-------------------------+-------------------------+-----|
  683.     | R4  | XRecEnd  | 1 XMODEM successful     | delay 1 second          | R5  |
  684.     |     |          |                         |   flush input           |     |
  685.     |     |          | 2 XMODEM failed         | hang up, rept mail fail | exit|
  686.     |-----+----------+-------------------------+-------------------------+-----|
  687.     | R5* | RecFiles |                         | (BATCH rec files BR0)   | R6  |
  688.     |-----+----------+-------------------------+-------------------------+-----|
  689.     | R6  | ChkFiles | 1 BATCH recv successful | delay 2 secs            | R7  |
  690.     |     |          | 2 BATCH recv failed     | hang up, report bad file| exit|
  691.     |-----+----------+-------------------------+-------------------------+-----|
  692.     | R7  | AllowPkup| 1 have pickup for sender| receiver becomes sender | S3* |
  693.     |     |          | 2 nothing to pickup     | hang up, rept recv ok   | exit|
  694.     `-----+----------+-------------------------+-------------------------+-----'
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.                                                                            11
  727.  
  728.  
  729.  E. Transport Layer : ?????
  730.  
  731.    1. Data Definitions
  732.  
  733.    2. Tranport Layer Protocol : Routing
  734.  
  735.       FidoNet   does  not  necessarily  send  a  message  directly  to   its
  736.       destination.   To reduce the number of network connections, mail to  a
  737.       subset  of  the  nodelist  may  be  routed  to one  node  for  further
  738.       distribution  within  that  subset.   In addition, custom  routing  is
  739.       possible.  Routing of a message is determined in one of three ways.
  740.  
  741.       o If there are files attached, then a message must be sent directly to
  742.         its destination.
  743.  
  744.       o Messages without attached files should be routed through the inbound
  745.         host of the destination node's subnet as specified by an IFNA format
  746.         nodelist.
  747.  
  748.       o To prevent overloading of inbound hosts, a system should provide for
  749.         host routing to be disabled for a target node, or nodes.
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.                                                                            12
  793.  
  794.  
  795.  F. Network Layer : the Network's View of the System, Routing and Packets
  796.  
  797.  
  798.    1. Network Layer Data Definition : the Packet Header
  799.  
  800.       The  packet contains messages in packed format to be transferred  over
  801.       the  net during a connection.  As this data structure is  transferred,
  802.       its definition is critical to FidoNet.
  803.  
  804.       A  packet may contain zero or more packed messages.  A packet  without
  805.       messages is often generated as a poll packet.
  806.  
  807.       Every  packet begins with a  packet header.  The fields of the  packet
  808.       header are of fixed length.
  809.  
  810.  
  811.                                 Packet Header
  812.        Offset
  813.       dec hex
  814.               .-----------------------------------------------.
  815.         0   0 | origNode (low order)  | origNode (high order) |
  816.               +-----------------------+-----------------------+
  817.         2   2 | destNode (low order)  | destNode (high order) |
  818.               +-----------------------+-----------------------+
  819.         4   4 |   year (low order)    |   year (high order)   |
  820.               +-----------------------+-----------------------+
  821.         6   6 |  month (low order)    |  month (high order)   |
  822.               +-----------------------+-----------------------+
  823.         8   8 |   day (low order)     |   day (high order)    |
  824.               +-----------------------+-----------------------+
  825.        10   A |   hour (low order)    |   hour (high order)   |
  826.               +-----------------------+-----------------------+
  827.        12   C |  minute (low order)   |  minute (high order)  |
  828.               +-----------------------+-----------------------+
  829.        14   E |  second (low order)   |  second (high order)  |
  830.               +-----------------------+-----------------------+
  831.        16  10 |   baud (low order)    |   baud (high order)   |
  832.               +-----------------------+-----------------------+
  833.        18  12 |    0     |     2      |    0      |    0      |
  834.               +-----------------------+-----------------------+
  835.        20  14 | origNet (low order)   | origNet (high order)  |
  836.               +-----------------------+-----------------------+
  837.        22  16 | destNet (low order)   | destNet (high order)  |
  838.               +-----------------------+-----------------------+
  839.        24  18 |      ProductCode      |                       |
  840.               +-----------------------+                       |
  841.               |                     fill                      |
  842.               ~                   33 bytes                    ~
  843.               +-----------------------+-----------------------+
  844.        58  3A |                 zero or more                  |
  845.               ~                    packed                     ~
  846.               |                   messages                    |
  847.               +-----------------------+-----------------------+
  848.               |    0     |     0      |    0      |    0      |
  849.               `-----------------------------------------------'
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.                                                                            13
  859.  
  860.  
  861.       Packet       = PacketHeader  { PakdMessage }  00H 00H
  862.  
  863.       PacketHeader = origNode   (* of packet, not of messages in packet *)
  864.                      destNode   (* of packet, not of messages in packet *)
  865.                      year       (* of packet creation, e.g. 1986 *)
  866.                      month      (* of packet creation, 0-11 for Jan-Dec *)
  867.                      day        (* of packet creation, 1-31 *)
  868.                      hour       (* of packet creation, 0-23 *)
  869.                      minute     (* of packet creation, 0-59 *)
  870.                      second     (* of packet creation, 0-59 *)
  871.                      baud       (* max baud rate of orig and dest, 0=SEA *)
  872.                      PacketType (* old type-1 packets now obsolete *)
  873.                      origNet    (* of packet, not of messages in packet *)
  874.                      destNet    (* of packet, not of messages in packet *)
  875.                      ProductCode(* 0 for both Fido and SEAdog *)
  876.                      fill[33]
  877.  
  878.       PacketType   = 02H 00H  (* 01H 00H was used by Fido versions before 10
  879.                                  which did not support local nets.  The
  880.       packed
  881.                                  message header was also different for those
  882.                                  versions *)
  883.  
  884.       ProductCode  = (  00H      (* Unassigned *)
  885.                      |  01H      (* Rover *)
  886.                      |  02H      (* SEAdog *)
  887.                      |  03H      (* reserved *)
  888.                      |  04H      (* reserved *)
  889.                      |  05H      (* Opus *)
  890.                      |  06H      (* Dutchie *)
  891.                      |  ??H      (* Please apply for new codes *)
  892.                      )
  893.  
  894.  
  895.       The  remainder of the packet consists of packed messages.  Each packed
  896.       message  begins  with  a  message type word 0200H.   A  pseudo-message
  897.       beginning with the word 0000H signifies the end of the packet.
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.                                                                            14
  925.  
  926.  
  927.    2. Network Layer Data Description : a File with Attributes
  928.  
  929.       The  BATCH  protocol uses  the MODEM7 filename and TeLink/XMODEM  file
  930.       transfer protocols to transfer the file with attributes.
  931.  
  932.       When  a  file is transferred via  FidoNet, an attempt is made to  also
  933.       pass  the operating system's attributes  for the file such as  length,
  934.       modification  date, etc.  FidoNet does this via a special prefix block
  935.       to  the XMODEM file transfer using a protocol known as TeLink.  As the
  936.       TeLink  protocol relies on a modification to the XMODEM file  transfer
  937.       protocol, it is documented at the data link layer level.
  938.  
  939.       The  MODEM7 file name is redundant if there is also a TeLink block, in
  940.       which case the name may be taken from either or both.
  941.  
  942.                               FileName as Sent
  943.        Offset
  944.       dec hex
  945.               .-----------------------------------------------.
  946.         0   0 |                   fileName                    |
  947.               ~                   8  bytes                    ~
  948.               |           left adjusted blank filled          |
  949.               +-----------------------+-----------------------+
  950.         8   8 |                    fileExt                    |
  951.               ~                    3  bytes                   ~
  952.               |           left adjusted blank filled          |
  953.               `-----------------------------------------------'
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.                                                                            15
  991.  
  992.  
  993.  3. Network Layer Protocol : BATCH File Finite State Machines
  994.  
  995.  
  996.     BATCH File Sender
  997.  
  998.     .-----+----------+-------------------------+-------------------------+-----.
  999.     |State| State    | Predicate(s)            | Action(s)               | Next|
  1000.     |  #  | Name     |                         |                         | St  |
  1001.     |-----+----------+-------------------------+-------------------------+-----|
  1002.     | BS0*| MoreFiles| 1 more files to send    | (MODEM7 FName send MS0) | BS1 |
  1003.     |     |          | 2 no more files to send |                         | BS3 |
  1004.     |-----+----------+-------------------------+-------------------------+-----|
  1005.     | BS1 | CheckFNm | 1 MODEM7 Filename ok    | (TeLink send file XS0)  | BS2 |
  1006.     |     |          | 2 MODEM7 Filename bad   | report name send bad    | exit|
  1007.     |-----+----------+-------------------------+-------------------------+-----|
  1008.     | BS2 | CheckFile| 1 TeLink send ok        |                         | BS0 |
  1009.     |     |          | 2 TeLink send bad       | report file send bad    | exit|
  1010.     |-----+----------+-------------------------+-------------------------+-----|
  1011.     | BS3 | EndSend  | 1 rec NAK for next file | send EOT, report send ok| exit|
  1012.     |     |          | 2 10 seconds no NAK     | send EOT, report no NAK | exit|
  1013.     `-----+----------+-------------------------+-------------------------+-----'
  1014.  
  1015.     When  no files remain, the sender responds to the receiver's NAK with an
  1016.     EOT.  The EOT is not ACK/NAKed by the reciver.
  1017.  
  1018.     Filenames  must be upper case ASCII.  The data link layer uses "u" as  a
  1019.     control character.
  1020.  
  1021.  
  1022.     BATCH File Receiver
  1023.  
  1024.     .-----+----------+-------------------------+-------------------------+-----.
  1025.     |State| State    | Predicate(s)            | Action(s)               | Next|
  1026.     |  #  | Name     |                         |                         | St  |
  1027.     |-----+----------+-------------------------+-------------------------+-----|
  1028.     | BR0*| RecvName |                         | (MODEM7 FName recv MR0) | BR1 |
  1029.     |-----+----------+-------------------------+-------------------------+-----|
  1030.     | BR1 | CheckFNm | 1 MODEM7 no more files  | report files recd ok    | exit|
  1031.     |     |          | 2 MODEM7 Filename ok    | (TeLink recv file XR0)  | BR2 |
  1032.     |     |          | 2 MODEM7 Filename bad   | report name recv bad    | exit|
  1033.     |-----+----------+-------------------------+-------------------------+-----|
  1034.     | BR2 | CheckFile| 1 TeLink recv ok        |                         | BR0 |
  1035.     |     |          | 2 TeLink recv bad       | report file recv bad    | exit|
  1036.     `-----+----------+-------------------------+-------------------------+-----'
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.                                                                            16
  1057.  
  1058.  
  1059.  G. Data Link Layer : Error-Free Data Transfer
  1060.  
  1061.    1. Data Link Layer Data Definition : XMODEM/TeLink Blocks
  1062.  
  1063.       XMODEM  transfers  are  in  blocks  of 128  uninterpreted  data  bytes
  1064.       preceeded  by  a three byte header  and followed by either a one  byte
  1065.       checksum  or a two byte crc remainder.  XMODEM makes no provision  for
  1066.       data  streams  which  are  not  an  integral number  of  blocks  long.
  1067.       Therefore,  the sender pads streams whose length is not a multiple  of
  1068.       128 bytes with the end-of-file character (^Z for MS-DOS), and use some
  1069.       other  means  to convey  the  true data length to the  receiver  (e.g.
  1070.       TeLink file info block).
  1071.  
  1072.       Data blocks contain sequence numbers so the receiver can ensure it has
  1073.       the  correct block.  Block  numbers are sequential unsigned eight  bit
  1074.       integers  beginning with 01H and wrapping to 00H, except that a TeLink
  1075.       block is given sequence number 00H.
  1076.  
  1077.       For  files which are attached to the mail packet, not the mail  packet
  1078.       itself,  if the sending system is aware of the file attributes as they
  1079.       are  known to the operating system, then the first block of the XMODEM
  1080.       transfer  may be a special TeLink block to transfer that  information.
  1081.       This  block  differs  in that  the  first byte is a SYN  character  as
  1082.       opposed  to an SOH, and it is always sent checksum as opposed to CRC.
  1083.       Should the receiver be unwilling to handle such information, after two
  1084.       NAKs (or "C"s), the sender skips this special block and goes on to the
  1085.       data itself.
  1086.  
  1087.  
  1088.  
  1089.                         XMODEM Data Block (CRC mode)
  1090.        Offset
  1091.       dec hex
  1092.               .-----------------------------------------------.
  1093.         0   0 |        SOH  -  Start Of Header -  01H         |
  1094.               +-----------------------------------------------+
  1095.         1   1 |                 BlockNumber                   |
  1096.               +-----------------------------------------------+
  1097.         2   2 |               BlockComplement                 |
  1098.               +-----------------------------------------------+
  1099.         3   3 |                128 bytes  of                  |
  1100.               ~                uninterpreted                  ~
  1101.               |                    data                       |
  1102.               +-----------------------------------------------+
  1103.       131  83 |             CRC high order byte               |
  1104.               +-----------------------------------------------+
  1105.       132  84 |             CRC  low order byte               |
  1106.               `-----------------------------------------------'
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.                                                                            17
  1123.  
  1124.  
  1125.  
  1126.                       XMODEM Data Block (Checksum mode)
  1127.        Offset
  1128.       dec hex
  1129.               .-----------------------------------------------.
  1130.         0   0 |        SOH  -  Start Of Header -  01H         |
  1131.               +-----------------------------------------------+
  1132.         1   1 |                 BlockNumber                   |
  1133.               +-----------------------------------------------+
  1134.         2   2 |               BlockComplement                 |
  1135.               +-----------------------------------------------+
  1136.         3   3 |                128 bytes  of                  |
  1137.               ~                uninterpreted                  ~
  1138.               |                    data                       |
  1139.               +-----------------------------------------------+
  1140.       131  83 |                Checksum byte                  |
  1141.               `-----------------------------------------------'
  1142.  
  1143.  
  1144.                        TeLink File Descriptor Block
  1145.        Offset
  1146.       dec hex
  1147.               .-----------------------------------------------.
  1148.         0   0 |       SYN  -  File Info Header -  16H         |
  1149.               +-----------------------------------------------+
  1150.         1   1 |                     00H                       |
  1151.               +-----------------------------------------------+ data offset
  1152.         2   2 |                     FFH                       |  dec  hex
  1153.               +-----------------------------------------------+
  1154.         3   3 |     File Length, least significant byte       |  0    0
  1155.               +-----------------------------------------------+
  1156.         4   4 | File Length, second to least significant byte |  1    1
  1157.               +-----------------------------------------------+
  1158.         5   5 |  File Length, second to most significant byte |  2    2
  1159.               +-----------------------------------------------+
  1160.         6   6 |      File Length, most significant byte       |  3    3
  1161.               +-----------------------------------------------+
  1162.         7   7 |            Creation Time of File              |  4    4
  1163.               |                "DOS Format"                   |
  1164.               +-----------------------------------------------+
  1165.         9   9 |            Creation Date of File              |  6    6
  1166.               |                "DOS Format"                   |
  1167.               +-----------------------------------------------+
  1168.        11   B |                 File  Name                    |  8    8
  1169.               ~                  16 chars                     ~
  1170.               |        left justified  blank filled           |
  1171.               +-----------------------------------------------+
  1172.        27  1B |                    00H                        | 24   18
  1173.               +-----------------------------------------------+
  1174.        28  1C |            Sending Program Name               | 25   19
  1175.               ~                  16 chars                     ~
  1176.               |         left justified  Null filled           |
  1177.               +-----------------------------------------------+
  1178.        44  2B |            01H (for CRC) or 00H               | 41   29
  1179.               +-----------------------------------------------+
  1180.        45  2C |                    fill                       | 42   2A
  1181.               ~                  86 bytes                     ~
  1182.               |                  all zero                     |
  1183.               +-----------------------------------------------+
  1184.       132  83 |                Checksum byte                  |
  1185.               `-----------------------------------------------'
  1186.  
  1187.  
  1188.                                                                            18
  1189.  
  1190.  
  1191.  
  1192.       XMODEMData   = XMODEMBlock      (* block of data with header and
  1193.                                          trailer *)
  1194.                      | TeLinkBlock    (* TeLink File Descriptor Block *)
  1195.                      | ACK            (* acknowledge data received ok *)
  1196.                      | NAK            (* negative ACK & poll 1st block *)
  1197.                      | EOT            (* end of xfer, after last block *)
  1198.                      | "C"            (* 43H *)
  1199.  
  1200.       XMODEMBlock  = SOH              (* Start of Header, XMODEM Block *)
  1201.                      blockNumber[1]   (* sequence, i'=mod( i+1, 256 ) *)
  1202.                      blockCompl[1]    (* one's compl of BlockNumber *)
  1203.                      data[128]        (* uninterpreted user data block *)
  1204.                      (CRC | Checksum) (* error detect/correction code *)
  1205.  
  1206.       TeLinkBlock  = SYN              (* File Info Header *)
  1207.                      00H              (* block no, must be first block *)
  1208.                      FFH              (* one's complement of block no *)
  1209.                      fileLength[4]    (* length of data in bytes *)
  1210.                      CreationTime[2]  (* time file last modified or zero *)
  1211.                      CreationDate[2]  (* date file last modified or zero *)
  1212.                      fileName(16)     (* name of file, not vol or dir *)
  1213.                      00H              (* header version number *)
  1214.                      sendingProg(16)  (* name of program on send side *)
  1215.                      crcMode[1]       (* 01H for CRC 00H for Checksum *)
  1216.                      fill[87]         (* zeroed *)
  1217.                      Checksum         (* error detect/correction code *)
  1218.  
  1219.       ACK          = 06H              (* acknowledge data received ok *)
  1220.       NAK          = 15H              (* negative ACK & poll 1st block *)
  1221.       SOH          = 01H              (* start of header, begins block *)
  1222.       SYN          = 16H              (* start of TeLink file info blk *)
  1223.       EOT          = 04H              (* end of xfer, after last block *)
  1224.  
  1225.       CRC          = crc[2]           (* CCITT Cyclic Redundancy Check *)
  1226.  
  1227.       Checksum     = checksum[1]      (* low 8 bits of sum of data bytes
  1228.                                          using unsigned 8 bit arithmetic *)
  1229.  
  1230.       CreationDate = year[.7]         (* 7 bits, years since 1980, 0-127  *)
  1231.                      month[.4]        (* 4 bits, month of year, 1-12 *)
  1232.                      day[.5]          (* 5 bits, day of month, 1-31 *)
  1233.  
  1234.       CreationTime = hour[.5]         (* 5 bits, hour of day, 0-23 *)
  1235.                      minute[.6]       (* 6 bits, minute of hour, 0-60 *)
  1236.                      biSeconds[.2]    (* 6 bits, seconds/2, 0-29 *)
  1237.  
  1238.  
  1239.       Note  that the crcMode is always set to 01H in current implementations
  1240.       as  all TeLink/XMODEM implementations use the CRC method.   Therefore,
  1241.       it is always set to 01H by the sender, and is ignored by the reciever.
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.                                                                            19
  1255.  
  1256.  
  1257.  2. Data Link Layer Protocol : XMODEM/TeLink Finite State Machines
  1258.  
  1259.     The  protocol is receiver driven, the receiver polling the sender  for
  1260.     each  block.   If the receiver polls  for the first block using a  "C"
  1261.     (43H)  as  the poll character,  it would prefer to have the  CRC-CCITT
  1262.     polynomial  remainder error detection code at the end of each block as
  1263.     opposed  to a one byte unsigned checksum.  The sender will respond  to
  1264.     the  "C"  poll iff it can  comply.  If the sender chooses checksum  as
  1265.     opposed  to  CRC, it waits for  the receiver to poll with  NAK  (15H).
  1266.     Should  the  checksum method be  preferable to the receiver, it  polls
  1267.     with NAK rather than "C".
  1268.  
  1269.     The sender returns an EOT instead of a data block when no data remain.
  1270.  
  1271.     Neither  the  sender nor the  receiver should send the block or  ACK/NAK
  1272.     response  while there is data being received.  They should wait for  the
  1273.     line to settle, and possibly time out.
  1274.  
  1275.     It  is  suggested that one's  input buffer be cleared immediately  after
  1276.     sending  block or ACK/NAK response, before waiting for the response from
  1277.     the  other  end.  This  clears  any line garbage which  occurred  during
  1278.     transmit.
  1279.  
  1280.  
  1281.     XMODEM/TeLink Sender
  1282.  
  1283.     .-----+----------+-------------------------+-------------------------+-----.
  1284.     |State| State    | Predicate(s)            | Action(s)               | Next|
  1285.     |  #  | Name     |                         |                         | St  |
  1286.     |-----+----------+-------------------------+-------------------------+-----|
  1287.     | XS0 | WaitTeLnk| 1 over 40-60 seconds    | report sender timeout   | exit|
  1288.     |     |          | 2 over 2 tries          | note TeLink block failed| XS1 |
  1289.     |     |          | 3 NAK or "C" received   | send TeLink, incr tries | XS0 |
  1290.     |     |          | 4 ACK received          | TeLink ok, set crc/cksm | XS2 |
  1291.     |-----+----------+-------------------------+-------------------------+-----|
  1292.     | XS1 | WaitStart| 1 over 40-60 seconds    | report sender timeout   | exit|
  1293.     |     |          | 2 over 20 tries         | report send failed      | exit|
  1294.     |     |          | 3 NAK received          | set checksum mode       | XS2 |
  1295.     |     |          | 4 "C" recd, I can crc   | set crc mode            | XS2 |
  1296.     |     |          | 5 "C" recd, I can't crc |                         | XS1 |
  1297.     |-----+----------+-------------------------+-------------------------+-----|
  1298.     | XS2 | SendBlock| 1 more data available   | send next data block    | XS3 |
  1299.     |     |          |                         |   as checksum or crc    |     |
  1300.     |     |          | 2 last block has gone   | send EOT                | XS4 |
  1301.     |-----+----------+-------------------------+-------------------------+-----|
  1302.     | XS3 | WaitACK  | 1 10 retries or 1 minute| report send failed      | exit|
  1303.     |     |          | 2 ACK received          |                         | XS2 |
  1304.     |     |          | 3 NAK (or C if 1st blk) | resend last block       | XS3 |
  1305.     |-----+----------+-------------------------+-------------------------+-----|
  1306.     | XS4 | WaitEnd  | 1 10 retries or 1 minute| report send failed      | exit|
  1307.     |     |          | 2 ACK received          | report send successful  | exit|
  1308.     |     |          | 3 NAK received          | resend EOT              | XS4 |
  1309.     `-----+----------+-------------------------+-------------------------+-----'
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.                                                                            20
  1321.  
  1322.  
  1323.     XMODEM/TeLink Receiver
  1324.  
  1325.     .-----+----------+-------------------------+-------------------------+-----.
  1326.     |State| State    | Predicate(s)            | Action(s)               | Next|
  1327.     |  #  | Name     |                         |                         | St  |
  1328.     |-----+----------+-------------------------+-------------------------+-----|
  1329.     | XR0 | RecStart | 1 prefer crc mode       | Send "C"                | XR1 |
  1330.     |     |          | 2 want checksum mode    | send NAK                | XR1 |
  1331.     |-----+----------+-------------------------+-------------------------+-----|
  1332.     | XR1 | WaitFirst| 1 10 retries or 1 minute| report receive failure  | exit|
  1333.     |     |          | 2 > 3 retries or 30 secs| set want checksum mode  | XR0 |
  1334.     |     |          | 3 EOT received          | send ACK, report no file| exit|
  1335.     |     |          | 4 TeLink block recd     | send ACK, set crc/cksm  | XR2 |
  1336.     |     |          | 5 data block recd       | send ACK, set crc/cksm  | XR2 |
  1337.     |     |          | 6 bad block or 2-10 secs| incr retry count        | XR0 |
  1338.     |-----+----------+-------------------------+-------------------------+-----|
  1339.     | XR2 | WaitBlock| 1 10 retries or 1 minute| report receive failure  | exit|
  1340.     |     |          | 2 EOT received          | send ACK, report recd ok| exit|
  1341.     |     |          | 3 data block received   | send ACK                | XR2 |
  1342.     |     |          | 4 bad block or 2-10 secs| send NAK, incr retry cnt| XR2 |
  1343.     `-----+----------+-------------------------+-------------------------+-----'
  1344.  
  1345.  
  1346.     A  number of checks should be made to ensure a valid data block has been
  1347.     received.
  1348.  
  1349.     o  The  physical  layer  should  have encountered no errors,  e.g.  parity,
  1350.        framing, etc.
  1351.  
  1352.     o  The length of the block should not be less than expected.
  1353.  
  1354.     o  If  the blocks sequence  number does not match the  complement,  then
  1355.        respond with a NAK and attempt to read the block again.
  1356.  
  1357.     o  If the block's sequence number is one previous (remember wrap around)
  1358.        to that of the expected block, respond with an ACK and read again.
  1359.  
  1360.     o  If the sequence number fits neither of the above criteria, and is yet
  1361.        not the expected sequence number, abort the receive.
  1362.  
  1363.     o  The checksum or CRC should be correct.
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.                                                                            21
  1387.  
  1388.  
  1389.  3. Data Link Layer Protocol : MODEM7 Filename Finite State Machines
  1390.  
  1391.  
  1392.     MODEM7 Filename Sender
  1393.  
  1394.     .-----+----------+-------------------------+-------------------------+-----.
  1395.     |State| State    | Predicate(s)            | Action(s)               | Next|
  1396.     |  #  | Name     |                         |                         |  St |
  1397.     |-----+----------+-------------------------+-------------------------+-----|
  1398.     | MS0 | WaitNak  | 1 20 retries or 1 minute| filename send failed    | exit|
  1399.     |     |          | 2 NAK received          | send ACK & 1st ch of fn | MS1 |
  1400.     |-----+----------+-------------------------+-------------------------+-----|
  1401.     | MS1 | WaitChAck| 1 ACK rcd, fname done   | send SUB = 1AH          | MS2 |
  1402.     |     |          | 2 ACK rcd, fname ~done  | send next ch of fname   | MS1 |
  1403.     |     |          | 3 other char or 1 sec   | send "u", incr retry cnt| MS0 |
  1404.     |-----+----------+-------------------------+-------------------------+-----|
  1405.     | MS2 | WaitCksm | 1 cksum recd and ok     | send ACK, report fn ok  | exit|
  1406.     |     |          | 2 cksum recd but bad    | send "u", incr retry cnt| MS0 |
  1407.     |     |          | 3 no cksum in 1 sec     | send "u", incr retry cnt| MS0 |
  1408.     `-----+----------+-------------------------+-------------------------+-----'
  1409.  
  1410.  
  1411.     MODEM7 Filename Receiver
  1412.  
  1413.     .-----+----------+-------------------------+-------------------------+-----.
  1414.     |State| State    | Predicate(s)            | Action(s)               | Next|
  1415.     |  #  | Name     |                         |                         |  St |
  1416.     |-----+----------+-------------------------+-------------------------+-----|
  1417.     | MR0 | SendNak  | 1 20 tries or 1 minute  | report filename failure | exit|
  1418.     |     |          | 2                       | send NAK, incr try cnt  | MR1 |
  1419.     |-----+----------+-------------------------+-------------------------+-----|
  1420.     | MR1 | WaitAck  | 1 rcd ACK               |                         | MR2 |
  1421.     |     |          | 2 rcd EOT               | report no files remain  | exit|
  1422.     |     |          | 3 5 secs & no ACK/EOT   |                         | MR0 |
  1423.     |-----+----------+-------------------------+-------------------------+-----|
  1424.     | MR2 | WaitChar | 1 recd EOT (can happen?)| report no files remain  | exit|
  1425.     |     |          | 2 recd SUB              | send checksum byte      | MR3 |
  1426.     |     |          | 3 recd "u"              |                         | MR0 |
  1427.     |     |          | 4 recd char of name     | send ACK                | MR2 |
  1428.     |     |          | 5 no char in 1 second   |                         | MR0 |
  1429.     |-----+----------+-------------------------+-------------------------+-----|
  1430.     | MR3 | WaitOkCk | 1 recd ACK within 1 sec | report recd filename ok | exit|
  1431.     |     |          | 2 recd "u" or other char|                         | MR0 |
  1432.     `-----+----------+-------------------------+-------------------------+-----'
  1433.  
  1434.  
  1435.     SUB  is the ASCII character ^Z or 1AH.  The checksum is the unsigned low
  1436.     oder eight bits of the sum of the characters in the transferred filename
  1437.     including the SUB.
  1438.  
  1439.     Although  one second timeouts are used successfully by Fido and  SEAdog,
  1440.     some fear that this is too small a timeout for some satellite and packet
  1441.     network links.
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.                                                                            22
  1453.  
  1454.  
  1455.  
  1456.  H. Physical Layer : the Actual Connection of Two FidoNet Systems
  1457.  
  1458.     Will  one of the more hardware-oriented comm types give me some idea  of
  1459.     what's needed here?  Can we leave it open enough to allow implementation
  1460.     over a non-dial net?  Thanks.
  1461.  
  1462.  
  1463.  I. The Node List
  1464.    1. Node List Format
  1465.    2. Node List Processing
  1466.    3. Node Diff Format
  1467.    4. Node Diff Processing
  1468.  
  1469.  
  1470.  J. Tests to Validate an Implementation
  1471.     o It would be ideal if validation were automatic
  1472.     o Implementors could use in last stages of development
  1473.     o Program(s)? Test scripts? Remote Fidos? Bad line conditions?
  1474.  
  1475.  
  1476.  K. Example programs
  1477.     o Bob Pritchett has offered
  1478.     o Free to implementors et al
  1479.     o Likely in C
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  L. Acknowledgements
  1490.  
  1491.     Ben  Baker,  Thom  Henderson,  Tom  Jennings, and  Gee  Wong  suggested,
  1492.     informed,  reviewed,  and  encouraged.   Thom  and Tom gave me  all  the
  1493.     basics,  and  even allowed me to  look at actual code.  Bob Hartman  was
  1494.     foolish  enough  to implement  the specification, and was generous  with
  1495.     useful feedback.
  1496.  
  1497.     My employer, Pacific Systems Group was kind enough to donate my time to
  1498.     research and to write this document.
  1499.  
  1500.     Fido and FidoNet are trademarks of Tom Jennings.
  1501.  
  1502.     SEAdog is a trademark of System Enhancement Associates.
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.                                                                            23
  1519.  
  1520.  
  1521.  M. Bibliography
  1522.  
  1523.     Documentation  for the protocols  and data formats are scattered.   Some
  1524.     are  unattributed, some even untitled.  Filenames indicate that softcopy
  1525.     is available from Fido 122/6 and likely many others.
  1526.  
  1527.     Anonymous, changes to MODEM to impmlement CRC option  XMDM-CRC.TXT
  1528.  
  1529.     Christensen, Ward, "MODEM Protocol Overview" of 1 January 82  XMODEM.TXT
  1530.  
  1531.     Henderson, Thom, "SEAdog Electronic Mail System Version 3" of April 86
  1532.  
  1533.     International  Standards Organization,  "Data Processing - Open  Systems
  1534.     Interconnection - Basic Reference Model"  ISO/DIS 7498  April 82
  1535.  
  1536.     Jennings,   Tom,  "FidoNet  Electronic  Mail  Protocol"  8  February  85
  1537.     FIDOMAIL.DOC
  1538.  
  1539.     Jennings,   Tom,  "Fido's  Internal  Structures"  of  13  September  85
  1540.     STRUCT.TXT aka STRUCT.APX
  1541.  
  1542.     Jennings, Tom, "Extending XMODEM/MODEM File Transfer Protocol to support
  1543.     DOS" 20 September 83   FILEXFER.DOC
  1544.  
  1545.     Jordan, Larry, "XMODEM File Transfer Protocol"  XMDM-LJ.TXT
  1546.  
  1547.     Rudin,   H   and   West,  C,  "Protocol  Specification,   Testing,   and
  1548.     Verification,  III" Proceedings of  the IFIP WG 6.1 Third  International
  1549.     Workshop   on   Protocol  Specification,  Testing,   and   Verification,
  1550.     Rueschlikon Switzerland 31 May - 2 June 1983.
  1551.  
  1552.     Tanenbaum, Andrew, "Computer Networks" Prentice Hall 1981
  1553.  
  1554.     Messages generated by Fido 11w, SEAdog 3.8, and ARCmail 0.37
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.                                                                            24
  1585.