home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / FSC.ZIP / FSC-0019.TXT < prev    next >
Text File  |  1987-08-27  |  14KB  |  363 lines

  1. FSC-0019
  2.                                      SEALINK
  3.  
  4.                              File Transfer Protocol
  5.  
  6.                                  August 24, 1987
  7.  
  8.  
  9.  
  10.             Copyright 1986,87 by System Enhancement Associates, Inc.
  11.  
  12.  
  13.  
  14.      This  document  describes  briefly  the SEAlink file transfer protocol
  15.      developers' package.  SEAlink is a sliding  window  protocol  that  is
  16.      fully backwards compatible with XMODEM in all tested implementations.
  17.  
  18.      The intent of SEAlink is to provide a file transfer protocol that does
  19.      not  suffer  from  propagation  delays,  such  as  are  introduced  by
  20.      satellite relays or packet switched  networks,  while  retaining  full
  21.      compatibility with XMODEM.  Unlike other high-speed protocols, SEAlink
  22.      does not "side step" to avoid using XMODEM,  but instead works with an
  23.      XMODEM driver to establish the fastest possible  link,  thus  reducing
  24.      startup delays in both SEAlink and XMODEM transfers.
  25.  
  26.      Actual  tests  of  the  enclosed  routines  has  shown that SEAlink is
  27.      capable of virtually eliminating  propagation  delays  and  turnaround
  28.      delays.  File transfers between New Jersey and Hawaii,  which normally
  29.      suffer a degradation of 50% or more due to satellite  relays,  proceed
  30.      as  fast as local transfers.  Even transfers within the local exchange
  31.      are speeded up by up to  20%  at  2400  baud  by  the  elimination  of
  32.      turnaround delays.  Large volume tests show that SEAlink is capable of
  33.      coming to within 2% of the theoretical minimum time for data transfer.
  34.  
  35.  
  36.  
  37.      The developers' package contains the following files:
  38.  
  39.          SEALINK.DOC    This document.
  40.          SEALINK.C      A set of C routines for implementing SEAlink.
  41.          CLINK.EXE      A sample TTY program that implements SEAlink.
  42.  
  43.  
  44.  
  45.      You are granted a license to use this code in your  programs,  and  to
  46.      adapt  it to your particular situation and needs,  subject only to the
  47.      following conditions:
  48.  
  49.       1) You  must  refer to it as the SEAlink protocol,  and you must give
  50.          credit to System Enhancement Associates.
  51.  
  52.       2) If you modify it in such a way that your version  cannot  converse
  53.          with the original code as supplied by us, then you should refer to
  54.          it as "SEAlink derived", or as a "variation of SEAlink",  or words
  55.          to that effect.
  56.  
  57.      In  short,  we're not asking for any money,  but we'd like to get some
  58.      credit for our work.
  59.  
  60.  
  61.  
  62.      This document is  not  meant  to  be  a  rigorous  definition  of  the
  63.      protocol.  The  code provided should serve to document the details and
  64.      fine points of implementing  SEAlink.  We  will,  however,  present  a
  65.      brief synopsis of how SEAlink adds sliding windows to XMODEM,  and why
  66.      XMODEM doesn't mind.
  67.  
  68.      First of all,  SEAlink adds a block number to the ACK and NAK used  in
  69.      XMODEM.(1)  We  thus  create  "ACK/NAK  packets",  with  the following
  70.      structure:
  71.  
  72.          Byte 0:   ACK, NAK, or C
  73.          Byte 1:   Block number
  74.          Byte 2:   One's compliment of block number
  75.  
  76.      This is identical in form to the first three bytes of a  data  packet,
  77.      except that the SOH has been replaced with an ACK or NAK.(2)
  78.  
  79.      From  the  receiver's point of view,  it does not matter if the trans-
  80.      mitter is using sliding window or not.  The receiver simply sends  ACK
  81.      and NAK packets as appropriate.  Any XMODEM driver tested to date will
  82.      simply ignore this excess data behind the ACK or NAK.
  83.  
  84.      From  the  transmitter's point of view,  it just barely matters if the
  85.      receiver can handle sliding window.  The transmitter always acts as if
  86.      it is sending sliding window,  but varies the window size.  If  it  is
  87.      seeing  valid  block numbers and check values behind the received ACKs
  88.      and NAKs,  it sets the window size to six blocks.  Otherwise,  it sets
  89.      the  window  size  to  one  block.  The  result is that it only "sends
  90.      ahead" if the receiver can handle it.
  91.  
  92.      It should be a fairly simple matter to apply  the  underlying  SEAlink
  93.      logic to almost any variant of XMODEM.
  94.  
  95.  
  96.      The  SEAlink  routines  provided  in  this package are also capable of
  97.      passing system dependent information,  such as true file size and time
  98.      of  last modification.  This data is passed in a special header block.
  99.      The header block looks exactly like any other block, except that it is
  100.      block number zero.
  101.  
  102.      This is still backwards compatible with XMODEM,  as a SEAlink receiver
  103.      does  not  mind if block zero is missing,  and any XMODEM receiver yet
  104.      tested will regard block zero as a duplicate block and ACK it.
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.      (1) XMODEM/CRC uses a "C" in place of a  NAK  to  indicate  CRC  error
  118.          detection.  SEAlink  follows this convention,  and supports either
  119.          checksum or CRC.  For brevity, this document will use the term NAK
  120.          to mean either a true NAK (hex 15) or a C (hex 43).
  121.      (2) See previous footnote.
  122.      The data portion of block zero contains the following fields:
  123.  
  124.  
  125.          Offset    Size      Contents
  126.          ======    ====      ========
  127.  
  128.             0        4       Original file length.
  129.             4        4       Date and  time  file  was  last  mofified,  in
  130.                              seconds since 1979.
  131.             8       17       Original  file  name,  as  a  null  terminated
  132.                              string.
  133.            25       15       Name  of  transmitting  program,   as  a  null
  134.                              terminated string.
  135.            40        1       Overdrive flag.
  136.            41       87       Null filler and expansion area.
  137.  
  138.  
  139.      Any  field  which  the transmitter cannot support should be set to all
  140.      zeros.  Conversly,  the receiver should ignore any  null  fields.  The
  141.      receiver may ignore any field which he cannot support.
  142.  
  143.      Of special interest is the byte flag at offset 40 in block zero.  This
  144.      is  the  "Overdrive  flag",  and is used to trigger streaming mode for
  145.      high-speed,  half duplex modems.  In Overdrive mode the receiver stops
  146.      sending  ACKs  for  the  bulk of the file transfer,  thus facilitating
  147.      transfers over a half-duplex connection.  Overdrive is never  required
  148.      over a full duplex connection.  Overdrive requires that the basic link
  149.      be effectively error free.
  150.  
  151.      Overdrive is disengaged in either of the following conditions:
  152.  
  153.        o  The  transmitter will disengaged overdrive if it detects that the
  154.           receiver has dropped  out  of  overdrive,  or  does  not  support
  155.           overdrive.
  156.  
  157.        o  The   receiver  will  disengage  overdrive  if  it  finds  itself
  158.           receiving  an  excessive  number  of  bad  blocks,  as  Overdrive
  159.           requires an error-free link.
  160.  
  161.  
  162.  
  163.      The  routines  enclosed  in  this package should be reasonably easy to
  164.      implement in your application.  We have attempted to exclude  compiler
  165.      dependent and system dependent logic from these routines.
  166.  
  167.  
  168.      You  will need to alter our references to our communications driver to
  169.      conform to your own driver.  The communications  related  routines  we
  170.      use are:
  171.  
  172.          com_putc(c)         Output character c to comm port.
  173.  
  174.          int com_getc(t)     Get  character  from comm port within t tenths
  175.                              of  a  second.   Return  EOF  if  time   limit
  176.                              expires.
  177.  
  178.          com_dump()          Discard any pending output without sending it.
  179.  
  180.  
  181.  
  182.      In  addition,  we  use  the  following  routines for controlling timed
  183.      loops:
  184.  
  185.          long timerset(t)    Set a timer.  Returns a timer value which will
  186.                              expire in t tenths of a second.
  187.  
  188.          int timeup(z)       Check a timer.  Returns true if  timer  z  has
  189.                              expired yet, or false otherwise.
  190.  
  191.  
  192.      These  routines  also  make  reference  to the following functions for
  193.      system dependent information, which is optional:
  194.  
  195.          filestat(name,&fs)  Read directory entry for  a  file  and  return
  196.                              system dependent information.
  197.  
  198.          setstamp(f,dtg)     Set a file's date/time of last modification.
  199.  
  200.  
  201.      The  SEAlink  implementation  provided  in  this  package  is  used by
  202.      invoking the two primary routines:
  203.  
  204.          int xmtfile(name)             /* transmit a file */
  205.          char *name;                   /* name of file to transmit */
  206.  
  207.      This routine is used to send a file.  One file is sent at a  time.  If
  208.      the  name  is blank (name is null or *name points to a null),  then an
  209.      end of transmission marker is sent.
  210.  
  211.      This routine returns a one if the file is successfully transmitted, or
  212.      a zero if a fatal error occurs.
  213.  
  214.          char *rcvfile(name)           /* receive a file */
  215.          char *name;                   /* name of file (optional) */
  216.  
  217.      This routine is used to receive a file.  One file is  received.  If  a
  218.      name is specified for the file,  then that name WILL be used,  and any
  219.      name sent by the transmitter will be ignored.  If the  name  is  blank
  220.      (name  is  null or *name points to a null),  then the transmitter must
  221.      provide a name for the file.
  222.  
  223.      This routine returns a pointer to  the  name  of  the  file  that  was
  224.      received.  If the file transfer is not successful, then a null pointer
  225.      is returned.
  226.  
  227.      The  pointer  returned  by  rcvfile()  points to a static data buffer.
  228.      This does not have to be freed (and should not be),  but  it  will  be
  229.      overwritten the next time rcvfile() is called.
  230.  
  231.      The  rcvfile()  function  works  on a temporary file whose name is the
  232.      same as the final file,  but with a dash ("-") added at the beginning.
  233.      If  a  file  transfer  is  aborted,  then  this temporary file will be
  234.      retained.  An aborted file transfer will not harm a pre-existing  file
  235.      of the same name.
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.      In  addition,  this set of routines includes two global variables that
  243.      may be set to affect the SEAlink driver.  These are:
  244.  
  245.          int ackless;        This is used  to  control  the  overdrive.  It
  246.                              should  be  set  to  a  non-zero  value before
  247.                              calling the SEAlink transmitter  if  overdrive
  248.                              is  desired.  We  recommend using overdrive at
  249.                              link rates greater  than  2400  bps,  and  not
  250.                              otherwise.
  251.  
  252.          char *progname;     This  is used to set the "name of transmitting
  253.                              program" field in block  zero.  It  should  be
  254.                              set to point to a string constant.
  255.  
  256.  
  257.      The  SEAlink  routines  can be used for either single or multiple file
  258.      transfers.
  259.  
  260.      To send multiple files,  send each file one  by  one  until  either  a
  261.      transmit  fails  or  all files are sent.  If all files are sent,  then
  262.      signal the end by calling xmtfile() with a null pointer.
  263.  
  264.      To receive multiple files,  call rcvfile() repeatedly until it returns
  265.      a null pointer.
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.      This  package includes a demonstration program named CLINK (pronounced
  303.      "clink"),  which is a  simple  TTY  program  for  doing  SEAlink  file
  304.      transfers.  CLINK  does  not  perform  any  sort of terminal emulation
  305.      whatsoever.  However,  she will make use of the ANSI.SYS screen driver
  306.      if you have it installed.
  307.  
  308.      CLINK  may be used in either of two ways:  interactive mode or command
  309.      mode.
  310.  
  311.      To use CLINK in the interactive mode, give the command "CLINK" with no
  312.      arguments.  Press the "ESCape" key to give a  command  to  CLINK.  The
  313.      command  "?" (question mark) instructs CLINK to tell you what commands
  314.      she understands.
  315.  
  316.      To use CLINK in the command mode,  give the command  "CLINK"  with  an
  317.      argument.  There are three arguments you can give CLINK in the command
  318.      mode.  These are:
  319.  
  320.       1) Receive files;  Do this with a command of the form:
  321.  
  322.               CLINK R
  323.  
  324.          CLINK  will  attempt  to receive one or more files from COM1,  and
  325.          will terminate as soon as all files  are  received,  or  when  the
  326.          transfer aborts.
  327.  
  328.       2) Transmit files; Do this with a command of the form:
  329.  
  330.               CLINK T <filename> ...
  331.  
  332.          CLINK  will  attempt  to transmit the listed files over COM1,  and
  333.          will terminate as soon as all files are sent,  or the transfer  is
  334.          aborted.  <filename> may be one or more file names with or without
  335.          drive and path specifiers.  Wildcards may be used.
  336.  
  337.       3) Give help;  If you type:
  338.  
  339.               CLINK ?
  340.  
  341.          or any invalid command,  CLINK will display a  brief  reminder  of
  342.          what arguments she understands in command mode.
  343.  
  344.  
  345.      When CLINK is invoked in the command mode it normally uses COM1,  does
  346.      not  alter  the  baud  rate,  and does not transmit in Overdrive mode.
  347.      This can be altered by using any or all of the following command  line
  348.      switches:
  349.  
  350.          /P1       to use COM1: (default)
  351.          /P2       to use COM2:
  352.          /B<baud>  to set baud rate
  353.          /O        for Overdrive
  354.  
  355.  
  356.      CLINK comes with her own serial driver built in for the IBM PC  family
  357.      and true compatibles,  but she is capable of using any standard FOSSIL
  358.      driver.
  359.  
  360.  
  361.  
  362.  
  363.