home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / rfc / 600s / rfc640.txt < prev    next >
Text File  |  1992-10-14  |  40KB  |  762 lines

  1.  
  2.     NWG/RFC# 640                               JBP NJN 5-JUN-74 16:07  30843
  3.     Revised FTP Reply Codes
  4.  
  5.  
  6.  
  7.                                                            Jon Postel
  8.                                                             19 JUN 75
  9.  
  10.  
  11.                           Revised FTP Reply Codes                          1
  12.  
  13.  
  14.  
  15.  
  16.     This document describes a revised set of reply codes for the File
  17.     Transfer Protocol.                                                     2
  18.  
  19.     The aim of this revision is to satisfy the goal of using reply
  20.     codes to enable the command issuing process to easily determine
  21.     the outcome of each command. The user protocol interpreter should
  22.     be able to determine the success or failure of a command by
  23.     examining the first digit of the reply code.                           3
  24.  
  25.     An important change in the sequencing of commands and replies
  26.     which may not be obvious in the following documents concerns the
  27.     establishment of the data connection.                                  4
  28.  
  29.        In the previous FTP specifications when an actual transfer
  30.        command (STOR, RETR, APPE, LIST, NLIST, MLFL) was issued the
  31.        preliminary reply was sent after the data connection was
  32.        established. This presented a problem for some user protocol
  33.        interpreters which had difficulty monitoring two connections
  34.        asynchronously.                                                    4a
  35.  
  36.        The current specification is that the preliminary reply to the
  37.        actual transfer commands indicates that the file can be
  38.        transferred and either the connection was previously
  39.        established or an attempt is about to be made to establish the
  40.        data connection.                                                   4b
  41.  
  42.     This reply code revision is a modification of the protocol in
  43.     described in RFC 542, that is to say that the protocol
  44.     implementation associated with socket number 21 (decimal) is the
  45.     protocol specified by the combination of RFC 542 and this RFC.         5
  46.  
  47.     A note of thanks to those who contributed to this work: Ken
  48.     Pogran, Mark Krilanovich, Wayne Hathway, and especially Nancy
  49.     Neigus.                                                                6
  50.  
  51.     NWG/RFC# 640                               JBP NJN 5-JUN-74 16:07  30843
  52.     
  53.                                                          Nancy Neigus
  54.                                                            Ken Pogran
  55.                                                            Jon Postel
  56.                                                             19 JUN 75
  57.  
  58.  
  59.  
  60.                      A New Schema for FTP Reply Codes                      7
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.     Replies to File Transfer Protocol commands were devised to ensure
  68.     the synchronization of requests and actions in the process of
  69.     file transfer, and to guarantee that the user process always
  70.     knows the state of the Server. Every command must generate at
  71.     least one reply, although there may be more than one; in the
  72.     latter case, the multiple replies must be easily distinguished.
  73.     In addition, some commands occur in sequential groups, such as
  74.     USER, PASS and ACCT, or RNFR and RNTO.  The replies show the
  75.     existence of an intermediate state if all preceding commands have
  76.     been successful.  A failure at any point in the sequence
  77.     necessitates the repetition of the entire sequence from the
  78.     beginning.                                                             8
  79.  
  80.        Details of the command-reply sequence will be made explicit in
  81.        a state diagram.                                                   8a
  82.  
  83.     An FTP reply consists of a three digit number (transmitted as
  84.     three alphanumeric characters) followed by some text.  The number
  85.     is intended for use by automata to determine what state to enter
  86.     next; the text is intended for the human user.  It is intended
  87.     that the three digits contain enough encoded information that the
  88.     user-process (the User-PI described in RFC 542) will not need to
  89.     examine the text and may either discard it or pass it on to the
  90.     user, as appropriate.  In particular, the text may be
  91.     server-dependent, so there are likely to be varying texts for
  92.     each reply code.                                                       9
  93.  
  94.     Formally, a reply is defined to contain the 3-digit code,
  95.     followed by Space <SP>, followed by one line of text (where some
  96.     maximum line length has been specified), and terminated by the
  97.     TELNET end-of-line code.  There will be cases, however, where the
  98.     text is longer than a single line.  In these cases the complete
  99.     text must be bracketed so the User-process knows when it may stop
  100.     reading the reply (i.e. stop processing input on the TELNET
  101.     connection) and go do other things.  This requires a special
  102.     format on the first line to indicate that more than one line is
  103.     coming, and another on the last line to designate it as the last.
  104.     At least one of these must contain the appropriate reply code to
  105.  
  106.     NWG/RFC# 640                               JBP NJN 5-JUN-74 16:07  30843
  107.     Neigus                                       FTP Reply Codes  [3]
  108.  
  109.  
  110.  
  111.     indicate the state of the transaction.  To satisfy all factions
  112.     it was decided that both the first and last line codes should be
  113.     the same.                                                             10
  114.  
  115.        Thus the format for multi-line replies is that the first line
  116.        will begin with the exact required reply code, followed
  117.        immediately by a Hyphen, "-" (also known as Minus), followed
  118.        by text.  The last line will begin with the same code,
  119.        followed immediately by Space <SP>, optionally some text, and
  120.        TELNET <eol>.                                                     10a
  121.  
  122.           For example:
  123.                                123-First line
  124.                                Second line
  125.                                  234 A line beginning with numbers
  126.                                123 The last line                        10a1
  127.  
  128.        The user-process then simply needs to search for the second
  129.        occurrence of the same reply code, followed by <SP> (Space),
  130.        at the beginning of a line, and ignore all intermediary lines.
  131.        If an intermediary line begins with a 3-digit number, the
  132.        Server must pad the front to avoid confusion.                     10b
  133.  
  134.           This scheme allows standard system routines to be used for
  135.           reply information (such as for the STAT reply), with
  136.           "artificial" first and last lines tacked on.  In the rare
  137.           cases where these routines are able to generate three
  138.           digits and a Space at the beginning of any line, the
  139.           beginning of each text line should be offset by some
  140.           neutral text, like Space.                                     10b1
  141.  
  142.        This scheme assumes that multi-line replies may not be nested.
  143.        We  have found that, in general, nesting of replies will not
  144.        occur, except for random system messages (called spontaneous
  145.        replies in the previous FTP incarnations) which may interrupt
  146.        another reply.  Spontaneous replies are no longer defined;
  147.        system messages (i.e. those not processed by the FTP server)
  148.        will NOT carry reply codes and may occur anywhere in the
  149.        command-reply sequence.  They may be ignored by the
  150.        User-process as they are only information for the human user.     10c
  151.  
  152.     The three digits of the reply each have a special significance.
  153.     This is intended to allow a range of very simple to very
  154.     sophisticated response by the user-process.  The first digit
  155.     denotes whether the response is good, bad or incomplete.
  156.     (Referring to the state diagram) an unsophisticated user-process
  157.     will be able to determine its next action (proceed as planned,
  158.     redo, retrench, etc.) by simply examining this first digit.  A
  159.     user-process that wants to know approximately what kind of error
  160.  
  161.     NWG/RFC# 640                               JBP NJN 5-JUN-74 16:07  30843
  162.     Neigus                                       FTP Reply Codes  [4]
  163.  
  164.  
  165.  
  166.     occurred (e.g. file system error, command syntax error) may
  167.     examine the second digit, reserving the third digit for the
  168.     finest gradation of information (e.g. RNTO command without a
  169.     preceding RNFR.)                                                      11
  170.  
  171.        There are four values for the first digit of the reply code:      11a
  172.  
  173.        1yz   Positive Preliminary reply                                  11b
  174.  
  175.           The requested action is being initiated; expect another
  176.           reply before proceeding with a new command.  (The
  177.           user-process sending another command before the  completion
  178.           reply would be in violation of protocol; but server-FTP
  179.           processes should queue any commands that arrive while a
  180.           preceeding command is in progress.)  This type of reply can
  181.           be used to indicate that the command was accepted and the
  182.           user-process may now pay attention to the data connections,
  183.           for implementations where simultaneous monitoring is
  184.           difficult.                                                    11b1
  185.  
  186.        2yz   Positive Completion reply                                   11c
  187.  
  188.           The requested action has been successfully completed.  A
  189.           new request may be initiated.                                 11c1
  190.  
  191.        3yz   Positive Intermediate reply                                 11d
  192.  
  193.           The command has been accepted, but the requested action is
  194.           being held in abeyance, pending receipt of further
  195.           information.  The user should send another command
  196.           specifying this information.  This reply is used in command
  197.           sequence groups.                                              11d1
  198.  
  199.        4yz   Transient Negative Completion reply                         11e
  200.  
  201.           The command was not accepted and the requested action did
  202.           not take place, but the error condition is temporary and
  203.           the action may be requested again.  The user should return
  204.           to the beginning of the command sequence, if any.  It is
  205.           difficult to assign a meaning to "transient", particularly
  206.           when two distinct sites (Server and User-processes) have to
  207.           agree on the interpretation.  Each reply in the 4yz
  208.           category might have a slightly different time value, but
  209.           the intent is that the user-process is encouraged to try
  210.           again.  A rule of thumb in determining if a reply fits into
  211.           the 4yz or the 5yz (Permanent Negative) category is that
  212.           replies are 4yz if the commands can be repeated without any
  213.           change in command form or in properties of the User or
  214.           Server (e.g. the command is spelled the same with the same
  215.  
  216.     NWG/RFC# 640                               JBP NJN 5-JUN-74 16:07  30843
  217.     Neigus                                       FTP Reply Codes  [5]
  218.  
  219.  
  220.  
  221.           arguments used; the user does not change his file access or
  222.           user name; the server does not put up a new
  223.           implementation.)                                              11e1
  224.  
  225.        5yz   Permanent Negative Completion reply                         11f
  226.  
  227.           The command was not accepted and the requested action did
  228.           not take place.  The User-process is discouraged from
  229.           repeating the exact request (in the same sequence).  Even
  230.           some "permanent" error conditions can be corrected, so the
  231.           human user may want to direct his User-process to
  232.           reinitiate the command sequence by direct action at some
  233.           point in the future (e.g. after the spelling has been
  234.           changed, or the user has altered his directory status.)       11f1
  235.  
  236.        The following function groupings are encoded in the second
  237.        digit:                                                            11g
  238.  
  239.           x0z   Syntax - These replies refer to syntax errors,
  240.                   syntactically correct  commands that don't fit any
  241.                   functional category, unimplemented or superfluous
  242.                   commands.                                             11g1
  243.  
  244.           x1z   Information -  These are replies to requests for
  245.                   information, such as status or help.                  11g2
  246.  
  247.           x2z   Connections - Replies referring to the TELNET and
  248.                   data connections.                                     11g3
  249.  
  250.           x3z   Authentication and accounting - Replies for the logon
  251.                   process and accounting procedures.                    11g4
  252.  
  253.           x4z   Unspecified as yet                                      11g5
  254.  
  255.           x5z   File system - These replies indicate the status of
  256.                   the Server file system vis-a-vis the requested
  257.                   transfer or other file system action.                 11g6
  258.  
  259.        The third digit gives a finer gradation of meaning in each of
  260.        the function categories, specified by the second digit.  The
  261.        list of replies below will illustrate this.  Note that the
  262.        text associated with each reply is suggestive, rather than
  263.        mandatory, and may even change according to the command with
  264.        which it is associated.  The reply codes, on the other hand,
  265.        should strictly follow the specifications in the last section;
  266.        that is, Server implementations should not invent new codes
  267.        for situations that are only slightly different from the ones
  268.        described here, but rather should adapt codes already defined.
  269.  
  270.     NWG/RFC# 640                               JBP NJN 5-JUN-74 16:07  30843
  271.     Neigus                                       FTP Reply Codes  [6]
  272.  
  273.  
  274.  
  275.        If additional codes are found to be necessary, the details
  276.        should be submitted to the FTP committee, through Jon Postel.     11h
  277.  
  278.           A command such as TYPE or ALLO whose successful execution
  279.           does not offer the user-process any new information will
  280.           cause a 200 reply to be returned.  If the command is not
  281.           implemented by a particular Server-FTP process because it
  282.           has no relevance to that computer system, for example ALLO
  283.           at a TENEX site, a Positive Completion reply is still
  284.           desired so that the simple User-process knows it can
  285.           proceed with its course of action.  A 202 reply is used in
  286.           this case with, for example, the reply text:  "No storage
  287.           allocation necessary."  If, on the other hand, the command
  288.           requests a non-site-specific action and is unimplemented,
  289.           the response is 502.  A refinement of that is the 504 reply
  290.           for a command that IS implemented, but that requests an
  291.           unimplemented parameter.                                      11h1
  292.                                                                          11i
  293.           200  Command okay                                             11i1
  294.           500  Syntax error, command unrecognized
  295.                   [This may include errors such as command line too
  296.                   long.]                                                11i2
  297.           501  Syntax error in parameters or arguments                  11i3
  298.           202  Command not imlemented, superfluous at this site.        11i4
  299.           502  Command not implemented                                  11i5
  300.           503  Bad sequence of commands                                 11i6
  301.           504  Command not implemented for that parameter               11i7
  302.                                                                          11j
  303.           110  Restart marker reply.
  304.                   In this case the text is exact and not left to the
  305.                   particular implementation; it must read:
  306.                                MARK yyyy = mmmm
  307.                   where yyyy is User-process data stream marker, and
  308.                   mmmm is Server's equivalent marker.  (note the
  309.                   spaces between the markers and "=".)                  11j1
  310.           211  System status, or system help reply                      11j2
  311.           212  Directory status                                         11j3
  312.           213  File status                                              11j4
  313.           214  Help message (on how to use the server or the meaning
  314.                   of a particular non-standard command.  This reply
  315.                   is useful only to the human user.)                    11j5
  316.                                                                          11k
  317.           120  Service ready in nnn minutes                             11k1
  318.           220  Service ready for new user                               11k2
  319.           221  Service closing TELNET connection (logged off if
  320.                   appropriate)                                          11k3
  321.           421  Service not available, closing TELNET connection.
  322.                   [This may be a reply to any command if the service
  323.                   knows it must shut down.]                             11k4
  324.  
  325.     NWG/RFC# 640                               JBP NJN 5-JUN-74 16:07  30843
  326.     Neigus                                       FTP Reply Codes  [7]
  327.  
  328.  
  329.  
  330.           125  Data connection already open; transfer starting          11k5
  331.           225  Data connection open; no transfer in progress            11k6
  332.           425  Can't open data connection                               11k7
  333.           226  Closing data connection; requested file action
  334.                   successful (for example, file transfer or file
  335.                   abort.)                                               11k8
  336.           426  Connection trouble, closed; transfer aborted.            11k9
  337.           227  Entering [passive, active] mode                         11k10
  338.                                                                          11l
  339.           230  User logged on, proceed                                  11l1
  340.           530  Not logged in                                            11l2
  341.           331  User name okay, need password                            11l3
  342.           332  Need account for login                                   11l4
  343.           532  Need account for storing files                           11l5
  344.                                                                          11m
  345.           150  File status okay; about to open data connection.         11m1
  346.           250  Requested file action okay, completed.                   11m2
  347.           350  Requested file action pending further information        11m3
  348.           450  Requested file action not taken: file unavailable
  349.                   (e.g. file not found, no access)                      11m4
  350.           550  Requested action not taken:  file unavailable (e.g.
  351.                   file busy)                                            11m5
  352.           451  Requested action aborted: local error in processing      11m6
  353.           452  Requested action not taken:  insufficient storage
  354.                   space in system                                       11m7
  355.           552  Requested file action aborted:  exceeded storage
  356.                   allocation (for current directory or dataset)         11m8
  357.           553  Requested action not taken: file name not allowed        11m9
  358.           354  Start mail input; end with <CR><LF>.<CR><LF>            11m10
  359.  
  360.  
  361.  
  362.  
  363.                           Command-Reply Sequences                         12
  364.  
  365.  
  366.      In this section, the command-reply sequence is presented.  Each
  367.     command is listed with its possible replies; command groups are
  368.     listed together.  Preliminary replies are listed first (with
  369.     their succeeding replies under them), then positive and negative
  370.     completion, and finally intermediary replies with the remaining
  371.     commands from the sequence following.  This listing forms the
  372.     basis for the state diagrams, which will be presented separately.     13
  373.  
  374.        ICP                                                               13a
  375.           120                                                           13a1
  376.              220                                                       13a1a
  377.           220                                                           13a2
  378.           421                                                           13a3
  379.  
  380.     NWG/RFC# 640                               JBP NJN 5-JUN-74 16:07  30843
  381.     Neigus                                       FTP Reply Codes  [8]
  382.  
  383.  
  384.  
  385.        Logon                                                             13b
  386.  
  387.           USER                                                          13b1
  388.              230                                                       13b1a
  389.              530                                                       13b1b
  390.              500, 501, 421                                             13b1c
  391.              331, 332                                                  13b1d
  392.           PASS                                                          13b2
  393.              230                                                       13b2a
  394.              202                                                       13b2b
  395.              530                                                       13b2c
  396.              500, 501, 503, 421                                        13b2d
  397.              332                                                       13b2e
  398.           ACCT                                                          13b3
  399.              230                                                       13b3a
  400.              202                                                       13b3b
  401.              530                                                       13b3c
  402.              500, 501, 503, 421                                        13b3d
  403.  
  404.        Logoff                                                            13c
  405.  
  406.           QUIT                                                          13c1
  407.              221                                                       13c1a
  408.              500                                                       13c1b
  409.           REIN                                                          13c2
  410.              120                                                       13c2a
  411.                 220                                                   13c2a1
  412.              220                                                       13c2b
  413.              421                                                       13c2c
  414.              500, 502                                                  13c2d
  415.  
  416.        Transfer parameters                                               13d
  417.  
  418.           SOCK                                                          13d1
  419.              200                                                       13d1a
  420.              500, 501, 421, 530                                        13d1b
  421.           PASV                                                          13d2
  422.              227                                                       13d2a
  423.              500, 501, 502, 421, 530                                   13d2b
  424.           ACTV                                                          13d3
  425.              227                                                       13d3a
  426.              202                                                       13d3b
  427.              500, 501, 421, 530                                        13d3c
  428.           BYTE, MODE, TYPE, STRU                                        13d4
  429.              200                                                       13d4a
  430.              500, 501, 504, 421, 530                                   13d4b
  431.  
  432.     NWG/RFC# 640                               JBP NJN 5-JUN-74 16:07  30843
  433.     Neigus                                       FTP Reply Codes  [9]
  434.  
  435.  
  436.  
  437.        File action commands                                              13e
  438.  
  439.           ALLO                                                          13e1
  440.              200                                                       13e1a
  441.              202                                                       13e1b
  442.              500, 501, 504, 421, 530                                   13e1c
  443.           REST                                                          13e2
  444.              500, 501, 502, 421, 530                                   13e2a
  445.              350                                                       13e2b
  446.           STOR                                                          13e3
  447.              125, 150                                                  13e3a
  448.                 (110)                                                 13e3a1
  449.                 226, 250                                              13e3a2
  450.                 425, 426, 451, 552                                    13e3a3
  451.              532, 450, 452, 553                                        13e3b
  452.              500, 501, 421, 530                                        13e3c
  453.           RETR                                                          13e4
  454.              125, 150                                                  13e4a
  455.                 (110)                                                 13e4a1
  456.                 226, 250                                              13e4a2
  457.                 425, 426, 451                                         13e4a3
  458.              450, 550                                                  13e4b
  459.              500, 501, 421, 530                                        13e4c
  460.           LIST, NLST                                                    13e5
  461.              125, 150                                                  13e5a
  462.                 226, 250                                              13e5a1
  463.                 425, 426, 451                                         13e5a2
  464.              450                                                       13e5b
  465.              500, 501, 502, 421, 530                                   13e5c
  466.           APPE                                                          13e6
  467.              125, 150                                                  13e6a
  468.                 (110)                                                 13e6a1
  469.                 226, 250                                              13e6a2
  470.                 425, 426, 451, 552                                    13e6a3
  471.              532, 450, 550, 452, 553                                   13e6b
  472.              500, 501, 502, 421, 530                                   13e6c
  473.           MLFL                                                          13e7
  474.              125, 150                                                  13e7a
  475.                 226, 250                                              13e7a1
  476.                 425, 426, 451, 552                                    13e7a2
  477.              532, 450, 550, 452, 553                                   13e7b
  478.              500, 501, 502, 421, 530                                   13e7c
  479.           RNFR                                                          13e8
  480.              450, 550                                                  13e8a
  481.              500, 501, 502, 421, 530                                   13e8b
  482.              350                                                       13e8c
  483.           RNTO                                                          13e9
  484.              250                                                       13e9a
  485.              532, 553                                                  13e9b
  486.  
  487.     NWG/RFC# 640                               JBP NJN 5-JUN-74 16:07  30843
  488.     Neigus                                      FTP Reply Codes  [10]
  489.  
  490.  
  491.  
  492.              500, 501, 502, 503, 421, 530                              13e9c
  493.           DELE                                                         13e10
  494.              250                                                      13e10a
  495.              450, 550                                                 13e10b
  496.              500, 501, 502, 421, 530                                  13e10c
  497.           ABOR                                                         13e11
  498.              225, 226                                                 13e11a
  499.              500, 501, 502, 421                                       13e11b
  500.           MAIL                                                         13e12
  501.              354                                                      13e12a
  502.                 250                                                  13e12a1
  503.                 451, 552                                             13e12a2
  504.              450, 550, 452, 553                                       13e12b
  505.              500, 501, 502, 421, 530                                  13e12c
  506.  
  507.        Informational commands                                            13f
  508.  
  509.           STAT                                                          13f1
  510.              211, 212, 213                                             13f1a
  511.              450                                                       13f1b
  512.              500, 501, 502, 421, 530                                   13f1c
  513.           HELP                                                          13f2
  514.              211, 214                                                  13f2a
  515.              500, 501, 502, 421                                        13f2b
  516.  
  517.        Miscellaneous commands                                            13g
  518.  
  519.           SITE                                                          13g1
  520.              200                                                       13g1a
  521.              202                                                       13g1b
  522.              500, 501, 530                                             13g1c
  523.           NOOP                                                          13g2
  524.              200                                                       13g2a
  525.              500                                                       13g2b
  526.  
  527.     NWG/RFC# 640                               JBP NJN 5-JUN-74 16:07  30843
  528.                                                            Jon Postel
  529.                                                             19 JUN 75
  530.  
  531.  
  532.                             FTP State Diagrams                            14
  533.  
  534.  
  535.  
  536.  
  537.     Here we present state diagrams for a very simple minded FTP
  538.     implementation. Only the first digit of the reply codes is used.
  539.     There is one state diagram for each group of FTP commands or
  540.     command sequences.                                                    15
  541.  
  542.     The command groupings were determined by constructing a model for
  543.     each command then collecting together the commands with
  544.     structurally identical models.                                        16
  545.  
  546.     For each command or command sequence there are three possible
  547.     outcomes: success (S), failure (F), and error (E). In the state
  548.     diagrams below we use the symbol B for "begin", and the symbol W
  549.     for "wait for reply".                                                 17
  550.  
  551.     We first present the diagram that represents the largest group of
  552.     FTP commands:                                                         18
  553.  
  554.        
  555.                                 1,3    +---+
  556.                            ----------->! E !
  557.                           !            +---+
  558.                           !
  559.        +---+    cmd    +---+    2      +---+
  560.        ! B !---------->! W !---------->! S !
  561.        +---+           +---+           +---+
  562.                           !
  563.                           !     4,5    +---+
  564.                            ----------->! F !
  565.                                        +---+
  566.                                                                          18a
  567.  
  568.  
  569.        This diagram models the commands:                                 18b
  570.  
  571.  
  572.           ABOR, ACTV, ALLO, BYTE, DELE, HELP, MODE, NOOP, PASV, QUIT,
  573.           SITE, SOCK, STAT, STRU, TYPE.                                 18b1
  574.  
  575.     NWG/RFC# 640                               JBP NJN 5-JUN-74 16:07  30843
  576.     Postel                                    FTP State Diagrams [12]
  577.  
  578.  
  579.  
  580.     The other large group of commands is represented by a very
  581.     similar diagram:                                                      19
  582.  
  583.        
  584.                                 3      +---+
  585.                            ----------->! E !
  586.                           !            +---+
  587.                           !
  588.        +---+    cmd    +---+    2      +---+
  589.        ! B !---------->! W !---------->! S !
  590.        +---+       --->+---+           +---+
  591.                   !     ! !
  592.                   !     ! !     4,5    +---+
  593.                   !  1  !  ----------->! F !
  594.                    -----               +---+
  595.                                                                          19a
  596.  
  597.  
  598.        This diagram models the commands:                                 19b
  599.  
  600.  
  601.           APPE, (ICP), LIST, MLFL, NLST, REIN, RETR, STOR.              19b1
  602.  
  603.     Note that this second model could also be used to represent the
  604.     first group of commands, the only difference being that in the
  605.     first group the 100 series replies are unexpected and therefore
  606.     treated as error, while the second group expects (some may
  607.     require) 100 series replies.                                          20
  608.  
  609.     The remaining diagrams model command sequences, perhaps the
  610.     simplest of these is the rename sequence:                             21
  611.  
  612.        
  613.        +---+   RNFR    +---+    1,2    +---+
  614.        ! B !---------->! W !---------->! E !
  615.        +---+           +---+        -->+---+
  616.                         ! !        !
  617.                  3      ! ! 4,5    !
  618.           --------------  ------   !
  619.          !                      !  !   +---+
  620.          !               ------------->! S !
  621.          !              !   1,3 !  !   +---+
  622.          !             2!  --------
  623.          !              ! !     !
  624.          V              ! !     !
  625.        +---+   RNTO    +---+ 4,5 ----->+---+
  626.        !   !---------->! W !---------->! F !
  627.        +---+           +---+           +---+
  628.                                                                          21a
  629.  
  630.     NWG/RFC# 640                               JBP NJN 5-JUN-74 16:07  30843
  631.     Postel                                    FTP State Diagrams [13]
  632.  
  633.  
  634.  
  635.     A very similar diagram models the Mail command:                       22
  636.  
  637.        
  638.        +---+   MAIL    +---+    1,2    +---+
  639.        ! B !---------->! W !---------->! E !
  640.        +---+           +---+        -->+---+
  641.                         ! !        !
  642.                  3      ! ! 4,5    !
  643.           --------------  ------   !
  644.          !                      !  !   +---+
  645.          !               ------------->! S !
  646.          !              !   1,3 !  !   +---+
  647.          !             2!  --------
  648.          !              ! !     !
  649.          V              ! !     !
  650.        +---+   text    +---+ 4,5 ----->+---+
  651.        !   !---------->! W !---------->! F !
  652.        +---+           +---+           +---+
  653.                                                                          22a
  654.  
  655.  
  656.        Note that the "text" here is a series of lines sent from the
  657.        user to the server with no response expected until the last
  658.        line is sent, recall that the last line must consist only of a
  659.        single period.                                                    22b
  660.  
  661.     NWG/RFC# 640                               JBP NJN 5-JUN-74 16:07  30843
  662.     Postel                                    FTP State Diagrams [14]
  663.  
  664.  
  665.  
  666.     The next diagram is a simple model of the Restart command:            23
  667.  
  668.        
  669.        +---+   REST    +---+    1,2    +---+
  670.        ! B !---------->! W !---------->! E !
  671.        +---+           +---+        -->+---+
  672.                         ! !        !
  673.                  3      ! ! 4,5    !
  674.           --------------  ------   !
  675.          !                      !  !   +---+
  676.          !               ------------->! S !
  677.          !              !   3   !  !   +---+
  678.          !             2!  --------
  679.          !              ! !     !
  680.          V              ! !     !
  681.        +---+   cmd     +---+ 4,5 ----->+---+
  682.        !   !---------->! W !---------->! F !
  683.        +---+        -->+---+           +---+
  684.                    !      !
  685.                    !  1   !
  686.                     ------
  687.                                                                          23a
  688.  
  689.  
  690.           Where "cmd" is APPE, STOR, RETR, or MLFL.                     23a1
  691.  
  692.     We note that the above three models are similar, in fact the Mail
  693.     diagram and the Rename diagram are structurally identical. The
  694.     Restart differs from the other two only in the treatment of 100
  695.     series replies at the second stage.                                   24
  696.  
  697.     NWG/RFC# 640                               JBP NJN 5-JUN-74 16:07  30843
  698.     Postel                                    FTP State Diagrams [15]
  699.  
  700.  
  701.  
  702.     The most complicated diagram is for the Logon sequence:               25
  703.  
  704.        
  705.                              1
  706.        +---+   USER    +---+------------->+---+
  707.        ! B !---------->! W ! 2       ---->! E !
  708.        +---+           +---+------  !  -->+---+
  709.                         ! !       ! ! !
  710.                       3 ! ! 4,5   ! ! !
  711.           --------------   -----  ! ! !
  712.          !                      ! ! ! !
  713.          !                      ! ! ! !
  714.          !                 ---------  !
  715.          !               1!     ! !   !
  716.          V                !     ! !   !
  717.        +---+   PASS    +---+ 2  !  ------>+---+
  718.        !   !---------->! W !------------->! S !
  719.        +---+           +---+   ---------->+---+
  720.                         ! !   ! !     !
  721.                       3 ! !4,5! !     !
  722.           --------------   --------   !
  723.          !                    ! !  !  !
  724.          !                    ! !  !  !
  725.          !                 -----------
  726.          !             1,3!   ! !  !
  727.          V                !  2! !  !
  728.        +---+   ACCT    +---+--  !   ----->+---+
  729.        !   !---------->! W ! 4,5 -------->! F !
  730.        +---+           +---+------------->+---+
  731.                                                                          25a
  732.  
  733.     NWG/RFC# 640                               JBP NJN 5-JUN-74 16:07  30843
  734.     Postel                                    FTP State Diagrams [16]
  735.  
  736.  
  737.  
  738.     Finally we present a generalized diagram that could be used to
  739.     model the command and reply interchange:                              26
  740.  
  741.        
  742.                 ------------------------------------
  743.                !                                    !
  744.        Begin   !                                    !
  745.          !     V                                    !
  746.          !   +---+  cmd   +---+ 2         +---+     !
  747.           -->!   !------->!   !---------->!   !     !
  748.              !   !        ! W !           ! S !-----!
  749.           -->!   !     -->!   !-----      !   !     !
  750.          !   +---+    !   +---+ 4,5 !     +---+     !
  751.          !     !      !    ! !      !               !
  752.          !     !      !   1! !3     !     +---+     !
  753.          !     !      !    ! !      !     !   !     !
  754.          !     !       ----  !       ---->! F !-----
  755.          !     !             !            !   !
  756.          !     !             !            +---+
  757.           -------------------
  758.                !
  759.                !
  760.                V
  761.               End
  762.                                                                          26a