home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / rfc / 1900s / rfc1974.txt < prev    next >
Text File  |  1996-08-08  |  45KB  |  1,124 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                          R. Friend
  8. Request for Comments: 1974                              Stac Electronics
  9. Category: Informational                                       W. Simpson
  10.                                                               DayDreamer
  11.                                                              August 1996
  12.  
  13.  
  14.                    PPP Stac LZS Compression Protocol
  15.  
  16. Status of this Memo
  17.  
  18.    This memo provides information for the Internet community.  This memo
  19.    does not specify an Internet standard of any kind.  Distribution of
  20.    this memo is unlimited.
  21.  
  22. Abstract
  23.  
  24.    The Point-to-Point Protocol (PPP) [1] provides a standard method for
  25.    transporting multi-protocol datagrams over point-to-point links.
  26.  
  27.    The PPP Compression Control Protocol [2] provides a method to
  28.    negotiate and utilize compression protocols over PPP encapsulated
  29.    links.
  30.  
  31.    This document describes the use of the Stac LZS data compression
  32.    algorithm, with single or multiple compression histories, for
  33.    compressing PPP encapsulated packets.
  34.  
  35. Table of Contents
  36.  
  37.      1.     Introduction ..........................................    2
  38.         1.1       Licensing .......................................    2
  39.         1.2       Specification of Requirements ...................    3
  40.      2.     LZS Packets ...........................................    3
  41.         2.1       Padding .........................................    4
  42.         2.2       Zero Deletion/Insertion .........................    4
  43.         2.3       Reliability and Sequencing ......................    4
  44.            2.3.1  Reset-Request and Reset-Ack Packet Formats.......    5
  45.         2.4       Data Expansion ..................................    6
  46.         2.5       Packet Format ...................................    6
  47.            2.5.1  PPP Protocol ....................................    7
  48.            2.5.2  History Number ..................................    7
  49.            2.5.3  Check Value .....................................    7
  50.               2.5.3.1  LCB ........................................    7
  51.               2.5.3.2  CRC ........................................    7
  52.               2.5.3.3  Sequence Number ............................    8
  53.                  2.5.3.3.1  History Synchronization with Sequence
  54.                              Numbers Example ......................    9
  55.  
  56.  
  57.  
  58. Friend & Simpson             Informational                      [Page 1]
  59.  
  60. RFC 1974                        Stac LZS                     August 1996
  61.  
  62.  
  63.            2.5.4  History Synchronization Procedure ...............   10
  64.            2.5.5  Compressed Data .................................   11
  65.      3.     Sending Compressed Datagrams ..........................   12
  66.         3.1       Transmitter Process .............................   12
  67.         3.2       Receiver Process ................................   12
  68.         3.3       History Maintenance .............................   13
  69.         3.4       History Resynchronization Mechanism .............   14
  70.      4.     Configuration Option Format ...........................   14
  71.      5.     Definition of Extended Mode ...........................   16
  72.         5.1       Extended Mode Packet Format .....................   16
  73.         5.2       Extended Mode Transmitter Process ...............   18
  74.         5.3       Extended Mode Receiver Process ..................   18
  75.         5.4       Extended Mode Synchronization ...................   19
  76.      SECURITY CONSIDERATIONS ......................................   19
  77.      REFERENCES ...................................................   20
  78.      CHAIR'S ADDRESS    ...........................................   20
  79.      AUTHORS' ADDRESSES............................................   20
  80.  
  81. 1.  Introduction
  82.  
  83.    Starting with a sliding window compression history, similar to LZ1
  84.    [3], Stac Electronics developed a new, enhanced compression algorithm
  85.    identified as Stac LZS.  The LZS algorithm is optimized to compress
  86.    all file types as efficiently as possible.  Even string matches as
  87.    short as two octets are effectively compressed.
  88.  
  89.    The Stac LZS compression algorithm supports both single compression
  90.    history communication and multiple compression history communication.
  91.  
  92.    A single compression history will require the minimum amount of
  93.    memory to implement, but may not provide as much compression as a
  94.    multiple history implementation.
  95.  
  96.    Often, many streams of information are interleaved over the same
  97.    link.  Each virtual link will transmit data that is independent of
  98.    other virtual links.  Using multiple compression histories can
  99.    improve the compression ratio of a communication link by associating
  100.    separate compression histories with separate virtual links of
  101.    communication.
  102.  
  103. 1.1.  Licensing
  104.  
  105.    Source and object licenses are available on a non-discriminatory
  106.    basis.  Hardware implementations are also available.  Contact Stac
  107.    Electronics at the address and phone number listed with the author's
  108.    address for further information.
  109.  
  110.  
  111.  
  112.  
  113.  
  114. Friend & Simpson             Informational                      [Page 2]
  115.  
  116. RFC 1974                        Stac LZS                     August 1996
  117.  
  118.  
  119. 1.2.  Specification of Requirements
  120.  
  121.    In this document, several words are used to signify the requirements
  122.    of the specification.  These words are often capitalized.
  123.  
  124.    MUST      This word, or the adjective "required", means that the
  125.              definition is an absolute requirement of the specification.
  126.  
  127.    MUST NOT  This phrase means that the definition is an absolute
  128.              prohibition of the specification.
  129.  
  130.    SHOULD    This word, or the adjective "recommended", means that there
  131.              may exist valid reasons in particular circumstances to
  132.              ignore this item, but the full implications MUST be
  133.              understood and carefully weighed before choosing a
  134.              different course.
  135.  
  136.    MAY       This word, or the adjective "optional", means that this
  137.              item is one of an allowed set of alternatives.  An
  138.              implementation which does not include this option MUST be
  139.              prepared to interoperate with another implementation which
  140.              does include the option.
  141.  
  142. 2.  LZS Packets
  143.  
  144.    Before any LZS packets may be communicated, PPP must reach the
  145.    Network-Layer Protocol phase.
  146.  
  147.    When the Compression Control Protocol (CCP) has reached the Opened
  148.    state, and LZS is negotiated as the primary compression algorithm,
  149.    exactly one Stac LZS datagram is encapsulated in the PPP Information
  150.    field, where the PPP Protocol field indicates type hex 00FD
  151.    (compressed datagram) or type hex 00FB (Individual link compressed
  152.    datagram).  Type hex 00FD is used when compression is negotiated over
  153.    a single physical link or when compression is negotiated over a
  154.    single bundle consisting of multiple physical links.  Type hex 00FB
  155.    is used when compression is negotiated separately over individual
  156.    physical links to the same destination.  For more information, please
  157.    refer to PPP Compression Control Protocol.
  158.  
  159.    When CCP has not successfully reached the Opened state, or LZS is not
  160.    the primary compression algorithm, exactly one LZS datagram is
  161.    encapsulated in the PPP Information field, where the PPP Protocol
  162.    field indicates type hex 4021 (Stac LZS).
  163.  
  164.       Note that in the latter case, use of LZS is terminated by the PPP
  165.       LCP Protocol-Reject.  The default format is used: a single history
  166.       with no History Number field and no Check Value field (as if the
  167.  
  168.  
  169.  
  170. Friend & Simpson             Informational                      [Page 3]
  171.  
  172. RFC 1974                        Stac LZS                     August 1996
  173.  
  174.  
  175.       negotiated history count were 1).
  176.  
  177.    The maximum length of the Stac LZS datagram transmitted over a PPP
  178.    link is the same as the maximum length of the Information field of a
  179.    PPP encapsulated packet.
  180.  
  181.    Prior to compression, the uncompressed data begins with the PPP
  182.    Protocol ID Field.  Protocol-Field-Compression MAY be used on this
  183.    value, if it has been successfully negotiated for the link.
  184.  
  185.    The PPP Protocol ID Field is followed by the original Information
  186.    field. The length of the uncompressed data field is limited only by
  187.    the allowed size of the compressed data field and the higher protocol
  188.    layers.
  189.  
  190.    PPP Link Control Protocol packets MUST NOT be sent within Stac LZS
  191.    packets.  PPP Network Control Protocol packets MUST NOT be sent
  192.    within Stac LZS packets.
  193.  
  194. 2.1.  Padding
  195.  
  196.    The LZS Information field always ends with the last compressed data
  197.    byte (also known as the <end marker>), which is used to disambiguate
  198.    padding.  This allows trailing bits as well as octets to be
  199.    considered padding.
  200.  
  201. 2.2  Zero Deletion/Insertion
  202.  
  203.    When the sender does not add Padding [1], any trailing zero octets
  204.    MAY be removed prior to transmission.  A single trailing zero octet
  205.    MUST be appended upon receipt, after removal of any framing FCS.
  206.  
  207. 2.3.  Reliability and Sequencing
  208.  
  209.    When no Compression History is kept, the algorithm does not depend on
  210.    a reliable link, and does not require that packets be delivered in
  211.    sequence.  However, per packet compression results in a lower
  212.    compression ratio than it could be on a stream.
  213.  
  214.    Some reasons for resetting the history on a per packet basis include:
  215.  
  216.       -  The link has a high error rate.
  217.       -  The resources of the transmitter or receiver limit the ability
  218.          to maintain a compression history between packets.
  219.  
  220.    When more than 1 Compression History is negotiated, the packet
  221.    sequence MUST be preserved within specific History Numbers.  There is
  222.    no sequence requirement between different History Numbers.
  223.  
  224.  
  225.  
  226. Friend & Simpson             Informational                      [Page 4]
  227.  
  228. RFC 1974                        Stac LZS                     August 1996
  229.  
  230.  
  231.    When one or more compression histories is negotiated on the link, the
  232.    implementation MUST implement either a lower layer reliable link
  233.    protocol, or keep the compressor and decompressor histories in
  234.    synchronization, or both.
  235.  
  236.    To maintain history synchronization, the implementation MUST use the
  237.    Reset-Request and Reset-Ack messages of the Compression Control
  238.    Protocol and MUST use an Option 17 check mode value of sequence
  239.    numbers (and MAY implement other check mode values other than none).
  240.    In this case the Data field of the CCP Reset-Request and Reset-Ack
  241.    MUST contain the two octet History Number to be reset, most
  242.    significant octet first.
  243.  
  244.    If neither of these conditions are met on the data link, then the
  245.    compression histories MUST be reset after transmitting each datagram.
  246.  
  247.    The transmitter MAY clear a Compression History at any time.  The
  248.    receiver is implicitly notified of this event, and the decompression
  249.    history will automatically be affected.
  250.  
  251.    The transmitter MUST reset a history after a CCP Reset-Request for
  252.    the given History Number.
  253.  
  254.    2.3.1  Reset-Request and Reset-Ack Packet Formats
  255.  
  256.       A summary of the CCP Reset-Request and Reset-Ack packet formats
  257.       for Stac LZS compressed links are shown below.  The fields are
  258.       transmitted from left to right.
  259.  
  260.     0                   1                   2                   3
  261.     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  262.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  263.    |     Code      |  Identifier   |            Length             |
  264.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  265.    |              Data             |
  266.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  267.  
  268.  
  269.    Code
  270.  
  271.       14 for Reset-Request;
  272.  
  273.       15 for Reset-Ack.
  274.  
  275.    Identifier
  276.  
  277.       On transmission, the Identifier field MUST be changed whenever the
  278.       content of the Data field changes, and whenever a valid reply has
  279.  
  280.  
  281.  
  282. Friend & Simpson             Informational                      [Page 5]
  283.  
  284. RFC 1974                        Stac LZS                     August 1996
  285.  
  286.  
  287.       been received for a previous request.  For retransmissions, the
  288.       Identifier MAY remain unchanged.
  289.  
  290.       On reception, the Identifier field of the Reset-Request is copied
  291.       into the Identifier field of the Reset-Ack packet.
  292.  
  293.    Data
  294.  
  295.       The Data field contains the two octet History Number of the
  296.       compression history that is to be reset, most significant octet
  297.       first.  This History Number value is 1 when no history number is
  298.       present.
  299.  
  300. 2.4.  Data Expansion
  301.  
  302.    The maximum expansion of Stac LZS is 12.5%.
  303.  
  304.    A Maximum Receive Unit (MRU) MAY be negotiated that is 12.5% larger
  305.    than the size of a normal packet.  Then, packets can always be sent
  306.    compressed regardless of expansion.
  307.  
  308.    When the expansion plus compression header exceeds the size of the
  309.    peer's MRU for the link, the PPP packet MUST be sent without
  310.    compression, in the original PPP packet form with the "native" PPP
  311.    Protocol ID number.  The transmitter MUST reset the affected history.
  312.  
  313.    If it is detected that most packets are expanding (for example, due
  314.    to the use of already compressed data), then the transmitter SHOULD
  315.    stop sending compressed packets, and reset the appropriate history.
  316.    Data compression MAY be resumed on this data link later.
  317.  
  318. 2.5.  Packet Format
  319.  
  320.    A summary of the Stac LZS packet format is shown below.  The fields
  321.    are transmitted from left to right.
  322.  
  323.     0                   1                   2                   3
  324.     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  325.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  326.    |         PPP Protocol          |       (History Number*)       |
  327.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  328.    |        (Check Value*)         |       Compressed Data ...
  329.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  330.     * Note: these fields are variable length fields as described below.
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338. Friend & Simpson             Informational                      [Page 6]
  339.  
  340. RFC 1974                        Stac LZS                     August 1996
  341.  
  342.  
  343.    2.5.1.  PPP Protocol
  344.  
  345.       The PPP Protocol field is a 2 octet field described in the Point-
  346.       to-Point Protocol Encapsulation [1].
  347.  
  348.       When the Stac LZS compression protocol is successfully negotiated
  349.       by the PPP Compression Control Protocol [2], the value is 00FD hex
  350.       or 00FB hex as described in section 2.  This value MAY be
  351.       compressed when Protocol-Field-Compression is negotiated.
  352.  
  353.    2.5.2.  History Number
  354.  
  355.       The history number field comprises 0, 1, or 2 octets.
  356.  
  357.       The number of the compression history which was used, ranging from
  358.       2 to the negotiated History Count.  By default a History Count of
  359.       value 1 is supported and this field is not present.
  360.  
  361.       If the negotiated History Count is less than 2, this field is
  362.       removed.  There is no need for the field when no history is kept,
  363.       or only a single history is kept.
  364.  
  365.       If the negotiated History Count is 2 or more, but less than
  366.       256,this field is 1 octet.  If 256 or more histories are
  367.       negotiated, this field is 2 octets, most significant octet first.
  368.  
  369.    2.5.3.  Check Value
  370.  
  371.       The check value field comprises 0, 1, or 2 octets.  By default,
  372.       sequence number check is added to the packet (the field comprises
  373.       1 octet).
  374.  
  375.       2.5.3.1.  LCB
  376.  
  377.          A simple one octet Longitudinal Check Byte (LCB) MAY be used,
  378.          after successful negotiation of the LCB option.  The LCB is the
  379.          Exclusive-OR of FF(hex) and each octet of the uncompressed
  380.          datagram (prior to the compression operation).  On receipt, the
  381.          receiver computes the Exclusive-OR of FF(hex) and each octet of
  382.          the decompressed packet.  If this value does not match the
  383.          received LCB, then a receive failure for that history has
  384.          occurred.  The receive failure is handled according to the
  385.          history synchronization procedure in section 2.5.4.
  386.  
  387.       2.5.3.2.  CRC
  388.  
  389.          A two octet Cyclic Redundancy Check (CRC) MAY be used, instead
  390.          of the LCB, after successful negotiation of the CRC option.
  391.  
  392.  
  393.  
  394. Friend & Simpson             Informational                      [Page 7]
  395.  
  396. RFC 1974                        Stac LZS                     August 1996
  397.  
  398.  
  399.          The transmitter MUST initialize the CRC value to FFFF(hex) at
  400.          the beginning of each packet.  The CRC computation is based on
  401.          the HDLC FCS-16 polynomial:
  402.  
  403.             x**16 + x**12 + x**5 + 1
  404.  
  405.          The ones complement of the CRC is transmitted least significant
  406.          octet first, which contains the coefficient of the highest
  407.          term. On receipt, the receiver initializes the CRC to FFFF
  408.          (hex), and computes the CRC based on the formula above for each
  409.          octet of the decompressed packet.  If the received CRC value
  410.          does not match the transmitted CRC value, then a receive
  411.          failure for that history has occurred.  The receive failure is
  412.          handled according to the history synchronization procedure in
  413.          section 2.5.4.
  414.  
  415.       2.5.3.3.  Sequence Number
  416.  
  417.          A one octet Sequence Number MAY be used, instead of a LCB or
  418.          CRC, after successful negotiation of the Sequence Number
  419.          option.  After CCP has reached the open state, the transmitter
  420.          MUST set the value of the sequence number field (the sequence
  421.          number of the packet) to "1" and increment modulo 256 on
  422.          successive packets that contain data fields.  The sequence
  423.          number is relative to the history number used.
  424.  
  425.          After CCP has reached the open state, the receiver MUST set its
  426.          internal reference value of the next expected sequence number
  427.          (the sequence number of next packet to be received) to "1".
  428.  
  429.          After a packet is received, the receiver MUST set the value of
  430.          its internal reference value of the next expected sequence
  431.          number for that history to the value of the sequence number
  432.          field of the received packet plus 1 modulo 256.
  433.  
  434.          If the sequence number of the received packet is not equal to
  435.          the internal reference value of the expected sequence number
  436.          for the same history, a receive failure for that history has
  437.          occurred.  The receiver MUST silently discard the out of order
  438.          packet, and handle the failure according to the history
  439.          synchronization procedure in section 2.5.4.
  440.  
  441.          The sequence number MUST NOT be reset by the transmitter when a
  442.          packet containing a Reset-Req is received. The receiver MUST
  443.          always maintain its sequence number references for all
  444.          supported histories.
  445.  
  446.  
  447.  
  448.  
  449.  
  450. Friend & Simpson             Informational                      [Page 8]
  451.  
  452. RFC 1974                        Stac LZS                     August 1996
  453.  
  454.  
  455.       2.5.3.3.1  History Synchronization with Sequence Numbers Example
  456.  
  457.       Compressing Sender                Decompressing Receiver
  458.       ....                              ....
  459.       send seq 101     ----------->     recv seq 101
  460.                                         is 101 == 101?  Ok.
  461.                                         forward packet for processing
  462.                                         set internal reference to 102
  463.  
  464.       send seq 102     ----------->     recv seq 102
  465.                                         is 102 == 102?  Ok.
  466.                                         forward packet for processing
  467.                                         set internal reference to 103
  468.  
  469.       send seq 103     ------X          (packet lost)
  470.  
  471.       send seq 104     ----------->     recv seq 104
  472.                                         is 104 == 103?  Send reset req!
  473.                                         silently discard packet
  474.                                         set internal reference to 105
  475.  
  476.       (packet lost)        X-------     send reset request (ID=200)
  477.                                         post-increment the identifier.
  478.  
  479.       send seq 105     ----------->     recv seq 105
  480.                                         is 105 == 105?  Ok.
  481.                                         was reset ack received?  No!
  482.                                         silently discard packet
  483.                                         set internal reference to 106
  484.  
  485.                        <-----------     send reset request again(ID=200)
  486.                                         (e.g. reset-ack time out)
  487.  
  488.       send seq 106     ------X          (packet lost)
  489.  
  490.       recv reset req   <-----------
  491.       (after line delay)
  492.          (ID=200)
  493.  
  494.       reset compression
  495.          history
  496.       send reset ack   ----------->     recv reset ack (ID=200)
  497.          (ID=200)
  498.  
  499.       send seq 107     ----------->     recv seq 107
  500.                                         is 107 == 106?  Send reset req!
  501.                                         silently discard packet
  502.                                         set internal reference to 108
  503.  
  504.  
  505.  
  506. Friend & Simpson             Informational                      [Page 9]
  507.  
  508. RFC 1974                        Stac LZS                     August 1996
  509.  
  510.  
  511.       recv reset req   <-----------     send reset request (ID=201)
  512.          (ID=201)                       post-increment the identifier.
  513.  
  514.       send seq 108     ----------->     recv seq 108
  515.                                         is 108 == 108?  Ok.
  516.                                         was reset ack received?  No!
  517.                                         silently discard packet
  518.                                         set internal reference to 109
  519.  
  520.       send seq 109     ----------->     recv seq 109
  521.                                         is 109 == 109?  Ok.
  522.                                         was reset ack received?  No!
  523.                                         silently discard packet
  524.                                         set internal reference to 110
  525.  
  526.       reset compression
  527.          history
  528.       send reset ack   ----------->     recv reset ack (ID=201)
  529.          (ID=201)
  530.  
  531.       send seq 110     ----------->     recv seq 110
  532.                                         is 110 == 110?  Ok.
  533.                                         forward packet for processing
  534.                                         set internal reference to 111
  535.  
  536.       send seq 111     ----------->     recv seq 111
  537.                                         is 111 == 111?  Ok.
  538.                                         forward packet for processing
  539.                                         set internal reference to 112
  540.       ....                              ....
  541.  
  542.    2.5.4.  History Synchronization Procedure
  543.  
  544.       On receipt, if Sequence Number one (1) follows any other number
  545.       than zero (0), or is otherwise out of sequence, or the LCB or CRC
  546.       is invalid, a CCP Reset-Request MUST be sent, containing the two
  547.       octet History Number (most significant octet first, and which is
  548.       the value 1 when no History Number is present), with a CCP
  549.       Identifier.  Identifiers are incremented on each occurrence of an
  550.       out of sequence packet.
  551.  
  552.       Upon receipt of the Reset-Request, the transmitter MUST reset the
  553.       affected compression history, and transmit a CCP Reset-Ack packet
  554.       with the Identifier field and data (history number) field set to
  555.       the corresponding values of the Reset-Request.  However, the
  556.       Sequence Number (if implemented) is not reset.
  557.  
  558.  
  559.  
  560.  
  561.  
  562. Friend & Simpson             Informational                     [Page 10]
  563.  
  564. RFC 1974                        Stac LZS                     August 1996
  565.  
  566.  
  567.       For each packet that generates a receive failure, the receiver
  568.       MUST increment the Identifier and transmit a CCP Reset-Request.
  569.       For re-transmissions of existing receive failures, the Identifier
  570.       MUST NOT be incremented.
  571.  
  572.       After transmitting the Reset-Request packet, the receiver MUST
  573.       continue silently discarding valid compressed packets for the
  574.       corresponding history, until the correct CCP Reset-Ack Identifier
  575.       (corresponding to the Reset-Request) for that History Number is
  576.       received.  Note that if sequence numbers are used, the receiver
  577.       MUST process the sequence number of a received packet according to
  578.       the procedures in section 2.5.4.
  579.  
  580.    2.5.5.  Compressed Data
  581.  
  582.       The data field MUST contain only one datagram in compressed form.
  583.       The length of this field is always an integer number of octets.
  584.       There MUST BE only one end marker per block of compressed data.
  585.  
  586.       The form of the data field is one block of compressed data as
  587.       defined in 3.2 of X3.241-1994, and is repeated here for
  588.       informational purposes ONLY.
  589.  
  590.    <Compressed Stream> := [<Compressed String>] <End Marker>
  591.    <Compressed String> := 0 <Raw Byte> | 1 <Compressed Bytes>
  592.    <Raw Byte> := <b><b><b><b><b><b><b><b>          (8-bit byte)
  593.    <Compressed Bytes> := <Offset> <Length>
  594.  
  595.    <Offset> := 1 <b><b><b><b><b><b><b> |           (7-bit offset)
  596.                0 <b><b><b><b><b><b><b><b><b><b><b> (11-bit offset)
  597.    <End Marker> := 110000000
  598.  
  599. <b> := 1 | 0
  600.  
  601.    <Length> :=
  602.    00        = 2     1111 0110      = 14
  603.    01        = 3     1111 0111      = 15
  604.    10        = 4     1111 1000      = 16
  605.    1100      = 5     1111 1001      = 17
  606.    1101      = 6     1111 1010      = 18
  607.    1110      = 7     1111 1011      = 19
  608.    1111 0000 = 8     1111 1100      = 20
  609.    1111 0001 = 9     1111 1101      = 21
  610.    1111 0010 = 10    1111 1110      = 22
  611.    1111 0011 = 11    1111 1111 0000 = 23
  612.    1111 0100 = 12    1111 1111 0001 = 24
  613.    1111 0101 = 13     ...
  614.  
  615.  
  616.  
  617.  
  618. Friend & Simpson             Informational                     [Page 11]
  619.  
  620. RFC 1974                        Stac LZS                     August 1996
  621.  
  622.  
  623. 3.  Sending Compressed Datagrams
  624.  
  625.    The reliable and efficient transport of datagrams on the data link
  626.    depends on the following processes.
  627.  
  628. 3.1.  Transmitter Process
  629.  
  630.    When a network datagram is received, it is assigned to a particular
  631.    history buffer and processed according to ANSI X3.241-1994 to form
  632.    compressed data.  Prior to the compression operation, if a Reset-
  633.    Request is outstanding for the history buffer to be used or if the
  634.    negotiated history count for this data link is 0, the history buffer
  635.    is cleared.
  636.  
  637.    Uncompressed data MUST be sent (in the original PPP packet form with
  638.    the "native" PPP Protocol ID number) if compression causes enough
  639.    expansion to cause the data compression datagram size to exceed the
  640.    Information field's MRU.  In this case, since the compressor has
  641.    modified the history buffer before sending an uncompressed datagram,
  642.    the history buffer MUST be cleared before the next datagram is
  643.    processed.
  644.  
  645.    The output of the compression operation is placed in the information
  646.    field of the datagram.  If the sequence number field is present
  647.    according the value of the check mode field, the sequence number
  648.    counter for the applicable history number MUST be incremented and its
  649.    value placed in the sequence number field.  If the LCB field is
  650.    present according the value of the check mode field, the LCB value
  651.    MUST be computed as specified in section 2.5.3.1. and the resultant
  652.    value placed in the LCB field.  If the CRC field is present according
  653.    the value of the check mode field, the CRC value MUST be computed as
  654.    specified in section 2.5.3.2.  and the resultant value placed in the
  655.    LCB field.  Upon reception of a CCP Reset-Request packet, the
  656.    transmitting compressor MUST be cleared to an initial state, which
  657.    includes clearing the history buffer.  In addition to the reset of
  658.    the compressor, a CCP Reset-Ack packet MUST be transmitted.  The data
  659.    field of this packet MUST be filled with the corresponding two octet
  660.    history number, most significant octet first.
  661.  
  662. 3.2.  Receiver Process
  663.  
  664.    If a CCP Reset-Request packet is received, the local compression
  665.    engine MUST be signaled that a Reset-Request has been received for
  666.    the history number specified in the data field.  If a CCP Reset-Ack
  667.    packet is received, any outstanding receive failure for the specified
  668.    history MUST be cleared.  If no receive failure is outstanding, and
  669.    the sequence number field is present, its value is checked.  If a
  670.    receive failure has occurred, it MUST be handled according to the
  671.  
  672.  
  673.  
  674. Friend & Simpson             Informational                     [Page 12]
  675.  
  676. RFC 1974                        Stac LZS                     August 1996
  677.  
  678.  
  679.    history resynchronization mechanism described below, and the
  680.    remainder of the datagram is discarded.
  681.  
  682.    If no receive failure is detected, the data is assigned to the
  683.    indicated decompression history buffer and the compressed data block
  684.    MUST be decompressed according to ANSI X3.241-1994.  If the LCB or
  685.    CRC fields are present on the received datagram, an LCB or CRC for
  686.    the uncompressed data MUST be computed and checked against the
  687.    received LCB or CRC according to sections 2.5.3.1. or 2.5.3.2.,
  688.    respectively.  If a receive failure has occurred, it MUST be handled
  689.    according to the History Resynchronization Mechanism described in
  690.    section 3.4.
  691.  
  692.    If a CCP Reset-Ack packet is received, the receiving decompressor's
  693.    corresponding history MAY be reset to an initial state.  (However,
  694.    due to the characteristics of the Stac LZS algorithm, a decompressor
  695.    history reset is not required).  After reset, any compressed or
  696.    uncompressed data contained in the packet is processed.
  697.  
  698.    On the occurrence of a receive failure, an implementation MUST
  699.    transmit a CCP Reset-Request packet with the data field containing
  700.    the two octet history number (most significant octet first) matching
  701.    the history that had the failure.  Once a receive failure has
  702.    occurred, the data in any subsequent packets received for that
  703.    history MUST be discarded until a CCP Reset-Ack packet containing a
  704.    valid Identifier matching the Identifier that was sent with the last
  705.    CCP Reset-Request packet is received.  It is the responsibility of
  706.    the receiver to ensure the reliability of the Reset-Request/Ack
  707.    mechanism.  This may require the transmission of additional CCP
  708.    Reset-Request packets before a CCP Reset-Ack packet is received.
  709.  
  710. 3.3.  History Maintenance
  711.  
  712.    The History Count field determines the number of history buffers to
  713.    be maintained for the compression protocol.  For example, each
  714.    history buffer could represent a separate logical connection between
  715.    the data compression peers.  When maintaining a history, the peers
  716.    MUST use link error detection and signaling to ensure that both the
  717.    compressor and decompressor copies of each history buffer are always
  718.    identical.
  719.  
  720.    Setting the History Count field to the value "0" indicates that the
  721.    compression is to be on a connectionless basis.  In this case, a
  722.    single history buffer is used and MUST be cleared at the beginning of
  723.    every datagram.
  724.  
  725.    When the History Count field is set to the value "1", a single
  726.    history buffer is maintained by each of the data compression peers.
  727.  
  728.  
  729.  
  730. Friend & Simpson             Informational                     [Page 13]
  731.  
  732. RFC 1974                        Stac LZS                     August 1996
  733.  
  734.  
  735.    (A single logical connection.)
  736.  
  737.    When the History Count field is set to a value greater than "1",
  738.    separate history buffers, error detection states, and signaling
  739.    states are maintained by the decompressing entity for each history.
  740.    The compressing peer may transmit data on any number of separate
  741.    histories, up to the value of the History Count field.
  742.  
  743. 3.4.  History Resynchronization Mechanism
  744.  
  745.    The Stac LZS protocol utilizes CCP Reset-Request/Reset-Ack mechanism
  746.    in order to provide a mechanism for indicating a receiver failure in
  747.    one direction of a compressed link without affecting traffic in the
  748.    other direction.  A receive failure is determined using the LCB, CRC,
  749.    or sequence number mechanisms, according to the value of the check
  750.    mode field.
  751.  
  752.    Reset-Requests and Reset-Acks are specific to the history number of
  753.    the packet containing them.
  754.  
  755.    Reset-Request/Reset-Ack history synchronization signaling is provided
  756.    to recover from a loss of synchronization between peers, especially
  757.    in unreliable transport layers.  As with all compression algorithms,
  758.    the decompressor can not recover from dropped, erroneous, or mis-
  759.    ordered datagrams, and will propagate errors catastrophically until
  760.    both peers are reset to an initial state.
  761.  
  762.    The Stac LZS protocol provides a means to detect these error
  763.    conditions: LCB or CRC for erroneous datagrams, and sequence number
  764.    for dropped or mis-ordered datagrams.  There is a means for
  765.    correcting a loss of synchronization: clear both the failing
  766.    compression and decompression histories, and follow the transmitter
  767.    and receiver processes in sections 3.1. and 3.2.
  768.  
  769. 4.  Configuration Option Format
  770.  
  771. Description
  772.  
  773.       The CCP Stac LZS Configuration Option negotiates the use of
  774.       Stac LZS on the link.  By ultimate disagreement, no compression is
  775.       used.
  776.  
  777.       All implementations must support the default values.
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786. Friend & Simpson             Informational                     [Page 14]
  787.  
  788. RFC 1974                        Stac LZS                     August 1996
  789.  
  790.  
  791.    A summary of the Stac LZS Configuration Option format is shown
  792.    below.  The fields are transmitted from left to right.
  793.  
  794.     0                   1                   2                   3
  795.     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  796.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  797.    |     Type      |    Length     |        History Count          |
  798.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  799.    |   Check Mode  |
  800.    +-+-+-+-+-+-+-+-+
  801.  
  802.  
  803.    Type
  804.  
  805.       17
  806.  
  807.    Length
  808.  
  809.       5
  810.  
  811.    History Count
  812.  
  813.       The History Count field is two octets, most significant octet
  814.       first, and specifies the maximum number of Compression Histories.
  815.  
  816.       The value 0 indicates that the implementation expects the peer to
  817.       clear the Compression History at the beginning of every packet.
  818.  
  819.       The value 1 is the default value, and is used to indicate that
  820.       only one history is maintained.
  821.  
  822.       Other valid values range from 2 to 65535.  The peer is not
  823.       required to send as many histories as the implementation indicates
  824.       that it can accept.  However, it should be noted that resources
  825.       are allocated in each peer to support the number of negotiated
  826.       histories in this field.
  827.  
  828.    Check Mode
  829.  
  830.       The Check Mode field indicates support of LCB, CRC or Sequence
  831.       checking, and other future extensions to this standard.  This
  832.       field comprises 2 sub-fields, and is considered to be bit-mapped.
  833.       The 3 least significant bits comprise 5 mutually exclusive values.
  834.       The upper 5 bits are all "Reserved" bit locations must be set to
  835.       "0" to allow for future backward-compatible extensions to this
  836.       standard.
  837.  
  838.  
  839.  
  840.  
  841.  
  842. Friend & Simpson             Informational                     [Page 15]
  843.  
  844. RFC 1974                        Stac LZS                     August 1996
  845.  
  846.  
  847.       For compatibility, Sequence Numbers MUST be implemented; the other
  848.       four check modes MAY be implemented.
  849.  
  850. Defined values:
  851.  
  852.          0    None             (MAY be implemented; however, MUST
  853.                                 implement history count of zero)
  854.          1    LCB              (MAY be implemented)
  855.          2    CRC              (MAY be implemented)
  856.          3    Sequence Number  (MUST be implemented)
  857.          4    Extended Mode    (MAY be implemented)
  858.  
  859.           0       1        2        3     4     5     6     7
  860.       +-------+-------+----------+-----+-----+-----+-----+-----+
  861.       |    LCB/CRC/Seq#/Ext'd    | Res | Res | Res | Res | Res |
  862.       +-------+-------+----------+-----+-----+-----+-----+-----+
  863.  
  864. 5. Definition of Extended Mode
  865.  
  866.    When Check Mode 4 (Extended Mode) is successfully negotiated, the
  867.    packet format is different from the format described above. The
  868.    Extended Mode format is described below.  Extended Mode only supports
  869.    a history count of 1.
  870.  
  871. 5.1. Extended Mode Packet Format
  872.  
  873.     0                   1                   2                   3
  874.     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  875.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  876.    |         PPP Protocol          |A|B|C|D| Coherency Count       |
  877.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  878.    |        Compressed Data...
  879.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  880.  
  881.    PPP Protocol
  882.  
  883.       The PPP Protocol field is described in the Point-to-Point Protocol
  884.       Encapsulation [1].
  885.  
  886.       When a compression protocol is successfully negotiated by
  887.       the PPP Compression Control Protocol [2], the value is hex 00FD.
  888.       Protocol-Field-Compression MUST NOT be used on this value when
  889.       extended mode is negotiated on the link, even if Protocol-Field-
  890.       Compression was successfully negotiated before data compression.
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898. Friend & Simpson             Informational                     [Page 16]
  899.  
  900. RFC 1974                        Stac LZS                     August 1996
  901.  
  902.  
  903.    Bit A - PACKET_FLUSHED
  904.  
  905.       This bit indicates that the history buffer has just been reset
  906.       before this packet was generated.  Thus, this packet can ALWAYS
  907.       be decompressed because it is not based on any previous history.
  908.       This bit is typically sent to inform the peer that it has reset
  909.       its history buffer and that the peer can accept this packet
  910.       and re-synchronize.
  911.  
  912.    Bit B
  913.  
  914.       This bit is not used with Stac LZS compression.
  915.  
  916.    Bit C - PACKET_COMPRESSED
  917.  
  918.       This bit is used to indicate that the packet is compressed.  A
  919.       value of 0 indicates uncompressed data, and a value of 1 indicates
  920.       compressed data.
  921.  
  922.    Bit D
  923.  
  924.       This bit is not used with Stac LZS compression.
  925.  
  926.    Coherency Count
  927.  
  928.       The coherency count is used to assure that the packets are sent in
  929.       proper order and that no packet has been dropped.  This count is
  930.       initialized to the value 0x000, and is always increased by 1 after
  931.       each PPP packet is sent.  When all bits are 1, the count returns
  932.       to 0.
  933.  
  934.       The coherency count is 12 bits so the decompressor must handle the
  935.       rollover case.
  936.  
  937.    Compressed Data
  938.  
  939.       The compressed data begins with the protocol field.  For example,
  940.       an IP packet may contain 0021 followed by an IP header. The
  941.       compressor will first try to compress the 0021 protocol field and
  942.       then move on to the IP header.
  943.  
  944.       Protocol-Field-Compression MUST NOT be used on this value when
  945.       extended mode is negotiated on the link, even if Protocol-Field-
  946.       Compression was successfully negotiated before data compression.
  947.  
  948.       Zero deletion/insertion described in section 2.2 MUST NOT be
  949.       performed when extended mode is negotiated.
  950.  
  951.  
  952.  
  953.  
  954. Friend & Simpson             Informational                     [Page 17]
  955.  
  956. RFC 1974                        Stac LZS                     August 1996
  957.  
  958.  
  959. 5.2. Extended Mode Transmitter Process
  960.  
  961.    When a network datagram is received, it is processed according to
  962.    ANSI X3.241-1994 to form compressed data.  If a CCP Reset-Request has
  963.    been received from the decompressor, the compressor must clear its
  964.    history buffer before sending the next packet.
  965.  
  966.    Uncompressed data MUST be sent if the compression operation causes
  967.    the compressed datagram to expand.  In this case, since the
  968.    compressor has modified the history buffer before sending an
  969.    uncompressed datagram, the history buffer MUST be cleared before the
  970.    next datagram is processed.  The uncompressed data is placed in the
  971.    information field of the datagram, and Bit-A MUST be set (indicating
  972.    the history was cleared) and Bit-C MUST be clear (indicating
  973.    uncompressed data) in the current packet's header. The value of the
  974.    coherency counter is placed in the coherency count field and then the
  975.    coherency counter is incremented.
  976.  
  977.    If the compression operation does not cause the compressed datagram
  978.    to expand and if a received Reset-Request is outstanding, then the
  979.    output of the compression operation is placed in the information
  980.    field of the datagram, and Bit-A MUST be set (indicating the history
  981.    was cleared) and Bit-C MUST be set (indicating compressed data) in
  982.    the current packet's header. The value of the coherency counter is
  983.    placed in the coherency count field and then the coherency counter is
  984.    incremented.
  985.  
  986.    If the compression operation does not cause the compressed datagram
  987.    to expand and there is not a Reset-Request outstanding, then the
  988.    output of the compression operation is placed in the information
  989.    field of the datagram, and Bit-A MUST be clear (indicating the
  990.    history was not cleared) and Bit-C MUST be set (indicating compressed
  991.    data) in the current packet's header. The value of the coherency
  992.    counter is placed in the coherency count field and then the coherency
  993.    counter is incremented.
  994.  
  995.    Upon reception of a CCP Reset-Request packet, the transmitting
  996.    compressor MUST be cleared to an initial state, which includes
  997.    clearing the history buffer.  In addition to the reset of the
  998.    compressor, the PACKET_FLUSHED bit MUST be set in the header of the
  999.    next transmitted data packet.
  1000.  
  1001. 5.3. Extended Mode Receiver Process
  1002.  
  1003.    When a data compression datagram is received from the peer, Bit-A and
  1004.    Bit-C MUST be checked.  Prior to the decompression operation, if
  1005.    Bit-A is set, then the coherency count MUST be resynchronized to the
  1006.    received value in the coherency count field of the received packet,
  1007.  
  1008.  
  1009.  
  1010. Friend & Simpson             Informational                     [Page 18]
  1011.  
  1012. RFC 1974                        Stac LZS                     August 1996
  1013.  
  1014.  
  1015.    and the receiving decompressor's corresponding history MAY be reset
  1016.    to an initial state.  (However, due to the characteristics of the
  1017.    Stac LZS algorithm, a decompressor history reset is not required).
  1018.    After reset, any compressed or uncompressed data contained in the
  1019.    packet is processed, depending on the state of Bit-C.
  1020.  
  1021.    Prior to the decompression operation, if Bit-C is clear (indicating
  1022.    uncompressed data), then the decompression history buffer must not be
  1023.    modified and the decompressor is not involved with deencapsulation.
  1024.    If Bit-C is set (indicating compressed data) then the received packet
  1025.    is decompressed according to ANSI X3.241-1994.
  1026.  
  1027.    If the received packet is corrupt, then a Reset-Request is sent and
  1028.    this packet is discarded.  If the received packet contains an
  1029.    incorrect coherency count, a Reset-Request is sent and this packet is
  1030.    discarded.
  1031.  
  1032. 5.4. Extended Mode Synchronization
  1033.  
  1034.    Packets may be lost during transfer. If the decompressor maintained
  1035.    coherency count does not match the coherency count received in the
  1036.    compressed packet or if the decompressor detects that a received
  1037.    packet is corrupted, the decompressor drops the packet and sends a
  1038.    CCP Reset-Request packet. The compressor on receiving this packet
  1039.    resets the history buffer and sets the PACKET_FLUSHED bit in the next
  1040.    frame it sends. The decompressor on receiving a packet with its
  1041.    PACKET_FLUSHED bit set, resets its history buffer and sets its
  1042.    coherency count to the one shipped by the compressor in that packet.
  1043.  
  1044.    Thus synchronization is achieved without a Reset-Ack packet.
  1045.  
  1046. Security Considerations
  1047.  
  1048.    Security issues are not discussed in this memo.
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066. Friend & Simpson             Informational                     [Page 19]
  1067.  
  1068. RFC 1974                        Stac LZS                     August 1996
  1069.  
  1070.  
  1071. References
  1072.  
  1073.    [1]   Simpson, W., Editor, "The Point-to-Point Protocol (PPP)", STD
  1074.          51, RFC 1661, Daydreamer, July 1994.
  1075.  
  1076.    [2]   Rand, D., "The PPP Compression Control Protocol (CCP)", RFC
  1077.          1962, July 1996.
  1078.  
  1079.    [3]   Lempel, A. and Ziv, J., "A Universal Algorithm for Sequential
  1080.          Data Compression", IEEE Transactions On Information Theory,
  1081.          Vol. IT-23, No. 3, May 1977.
  1082.  
  1083.    [4]   Rand, D., "PPP Reliable Transmission", RFC 1663, Novell, July
  1084.          1994.
  1085.  
  1086. Chair's Address
  1087.  
  1088.    The working group can be contacted via the current chair:
  1089.  
  1090.       Karl F. Fox
  1091.       Ascend Communications
  1092.       3518 Riverside Dr., Suite 101
  1093.       Columbus, Ohio  43221
  1094.  
  1095.       (614) 451-1883
  1096.  
  1097.       EMail: karl@ascend.Com
  1098.  
  1099. Authors' Addresses
  1100.  
  1101.    Questions about this memo can also be directed to:
  1102.  
  1103.       Robert Friend
  1104.       Stac Technology
  1105.       12636 High Bluff Drive
  1106.       San Diego, CA  92130
  1107.       (619) 794-4542
  1108.       EMail: rfriend@stac.com
  1109.  
  1110.  
  1111.       William Allen Simpson
  1112.       Daydreamer
  1113.       Computer Systems Consulting Services
  1114.       1384 Fontaine
  1115.       Madison Heights, Michigan  48071
  1116.       Bill.Simpson@um.cc.umich.edu
  1117.           bsimpson@MorningStar.com (preferred)
  1118.  
  1119.  
  1120.  
  1121.  
  1122. Friend & Simpson             Informational                     [Page 20]
  1123.  
  1124.