Network Working Group                    Internet Engineering Task Force
Internet-Draft		                         Telnet Working Group
                                                       D. Borman, Editor
                                                     Cray Research, Inc.
                                                              April 1990


                     Telnet Data Compression Option

Status of this Memo

This draft document will be submitted to the RFC editor as a protocol
specification.  Distribution of this memo is unlimited.  Please send
comments to Dave Borman.

1.  Command Names and Codes

   COMPRESS       TBA
       START            0
       END              1
       SUPPORT          2
       REQUEST-START    3
       REQUEST-END      4

       ANY              0
       LZ               1

2.  Command Meanings

   IAC WILL COMPRESS

      The sender of this command is willing to send compressed data.

   IAC WONT COMPRESS

      The sender of this command refuses to send compressed data.

   IAC DO COMPRESS

      The sender of this command is willing to receive compressed data.

   IAC DONT COMPRESS

      The sender of this command refuses to accept compressed data.

   IAC SB COMPRESS START compression-type IAC SE



Telnet Working Group                                            [Page 1]

Internet-Draft Telnet Data Compression Option April 1990


      The sender of this command is stating that at this point in the
      data stream, all following data will be compressed via the
      "compression-type" method of data compression.  A "compression-
      type" value of ANY must not be used.  The current types of
      compression are listed in the current version of the Assigned
      Numbers document[1].

   IAC SB COMPRESS END IAC SE

      The sender of this command is stating that at this point in the
      data stream, all following data will no longer be compressed.

   IAC SB COMPRESS SUPPORT compression-type-list IAC SE

      The sender of this command is stating what types of compression it
      will support.

   IAC SB COMPRESS REQUEST-START compression-type IAC SE

      The sender of this command requests that the remote side begin
      compression of the telnet data stream.  The "compression-type"
      value is a request for a specific type of compression.  If no
      specific type is needed, a value of ANY may be used.

   IAC SB COMPRESS REQUEST-END IAC SE

      The sender of this command requests that the remote side stop
      compression of the telnet data stream.


3.  Default Specification

   The default specification for this option is

      WONT COMPRESS
      DONT COMPRESS

   meaning there will be no compression of the data stream.

4.  Motivation

   When large amounts of data are being generated over a Telnet connec-
   tion, and the connection is over a slow link, it is useful to provide
   some form of data compression to keep the number of bytes transmitted
   down to a minimum to improve network throughput.  This option pro-
   vides a method for compression of part or all of the data stream.

5.  Implementation Rules

   WILL and DO are used only at the beginning of the connection to ob-



Telnet Working Group                                            [Page 2]

Internet-Draft            Telnet Data Compression Option           April 1990


   tain and grant permission for future negotiations.  If compression is
   needed in both directions, then the COMPRESS option must be negotiat-
   ed in both directions.

   Once the two hosts have exchanged a WILL and a DO, the sender of the
   DO COMPRESS must send a COMPRESS SUPPORT command to let the remote
   side know what types of compression it is willing to accept.  In the
   request, a list of supported compression schemes is sent.  Only the
   sender of the DO may send a list of supported compression types ("IAC
   SB COMPRESS SUPPORT compression-type-list IAC SE").  Only the sender
   of the WILL may actually transmit compressed data.  This is initiated
   via the "IAC SB COMPRESS START compression-type IAC SE" command, and
   terminated via the "IAC SB COMPRESS END IAC SE" command.  If a START
   is received, and then a second START is received before receiving an
   END, the second START is assumed to terminate the first START com-
   mand, and then begin a (possibly) new method of compression.

   If the sender of the DO would like the remote side to begin sending
   compressed data, it can send the "IAC SB COMPRESS REQUEST-START
   compression-type IAC SE" command.  The "compression-type" may contain
   a specific type of compression that is requested, or it may contain
   ANY if no specific type of compression is preferred.  If the sender
   of the DO would like the remote side to stop sending compressed data,
   it can send the "IAC SB COMPRESS REQUEST-STOP IAC SE" command.

   The current list of compression types are listed in the current As-
   signed Numbers RFC [1].

   If the receiver of the SUPPORT command does not support any of the
   compression types listed in the SUPPORT command, it should send an
   IAC WONT COMPRESS command to turn off the COMPRESS option.

   If the receiver of a REQUEST-START receives a compression type that
   is not supported, it may choose to use any other type of compression
   that was received in the initial SUPPORT command.

   The order of the compression types may be ordered to indicate a
   preference for different compression types, the first type being the
   most preferred, and the last type the least preferred.

   Only the user data is compressed.  Telnet options and commands are
   inserted into the data stream after the user data has been
   compressed, and removed from the data stream before the data is un-
   compressed.

   If the COMPRESS option has been enabled, and compressed data is being
   received, the receipt of an "IAC WONT COMPRESS" implies the receipt
   of an "IAC SB COMPRESS END IAC SE", e.g., compression of the data
   stream is terminated.




Telnet Working Group                                            [Page 3]

Internet-Draft            Telnet Data Compression Option           April 1990


   The following is an example of use of the option:

       Host1                            Host2
       IAC DO COMPRESS
                                        IAC WILL COMPRESS
       IAC SB COMPRESS SUPPORT 1 2 3
       IAC SE
       [ Host2 is now free to send compressed data ]
       IAC SB COMPRESS REQUEST-START 1
       IAC SE
                                        IAC SB COMPRESS START 2 IAC SE
       [ Host2 did not support compression type 1, so it chose type 2.
         All data from Host2 to Host1 is now compressed ]
                                        IAC SB COMPRESS START 3 IAC SE
       [ Host2 has now stopped using compression type 2, and is now us-
         ing compression type 3.  ]
                                        IAC SB COMPRESS END IAC SE
       [ All data from Host2 to Host1 is now uncompressed again ]

   It is expected that any implementation that supports the Telnet
   COMPRESS option will support all of this specification.

6.  References


   [1] Reynolds, Joyce, and Postel, Jon, "Assigned Numbers", RFC 993,
       ISI, November 1986

Author's Address

   David A. Borman, Editor
   Cray Research, Inc.
   1440 Northland Drive
   Mendota Heights, MN 55120

   Phone: (612) 681-3398

   Mailing List: telnet-ietf@CRAY.COM
   EMail: dab@CRAY.COM














Telnet Working Group                                            [Page 4]