📄 rfc640.txt
字号:
STAT 13f1
211, 212, 213 13f1a
450 13f1b
500, 501, 502, 421, 530 13f1c
HELP 13f2
211, 214 13f2a
500, 501, 502, 421 13f2b
Miscellaneous commands 13g
SITE 13g1
200 13g1a
202 13g1b
500, 501, 530 13g1c
NOOP 13g2
200 13g2a
500 13g2b
NWG/RFC# 640 JBP NJN 5-JUN-74 16:07 30843
Jon Postel
19 JUN 75
FTP State Diagrams 14
Here we present state diagrams for a very simple minded FTP
implementation. Only the first digit of the reply codes is used.
There is one state diagram for each group of FTP commands or
command sequences. 15
The command groupings were determined by constructing a model for
each command then collecting together the commands with
structurally identical models. 16
For each command or command sequence there are three possible
outcomes: success (S), failure (F), and error (E). In the state
diagrams below we use the symbol B for "begin", and the symbol W
for "wait for reply". 17
We first present the diagram that represents the largest group of
FTP commands: 18
1,3 +---+
----------->! E !
! +---+
!
+---+ cmd +---+ 2 +---+
! B !---------->! W !---------->! S !
+---+ +---+ +---+
!
! 4,5 +---+
----------->! F !
+---+
18a
This diagram models the commands: 18b
ABOR, ACTV, ALLO, BYTE, DELE, HELP, MODE, NOOP, PASV, QUIT,
SITE, SOCK, STAT, STRU, TYPE. 18b1
NWG/RFC# 640 JBP NJN 5-JUN-74 16:07 30843
Postel FTP State Diagrams [12]
The other large group of commands is represented by a very
similar diagram: 19
3 +---+
----------->! E !
! +---+
!
+---+ cmd +---+ 2 +---+
! B !---------->! W !---------->! S !
+---+ --->+---+ +---+
! ! !
! ! ! 4,5 +---+
! 1 ! ----------->! F !
----- +---+
19a
This diagram models the commands: 19b
APPE, (ICP), LIST, MLFL, NLST, REIN, RETR, STOR. 19b1
Note that this second model could also be used to represent the
first group of commands, the only difference being that in the
first group the 100 series replies are unexpected and therefore
treated as error, while the second group expects (some may
require) 100 series replies. 20
The remaining diagrams model command sequences, perhaps the
simplest of these is the rename sequence: 21
+---+ RNFR +---+ 1,2 +---+
! B !---------->! W !---------->! E !
+---+ +---+ -->+---+
! ! !
3 ! ! 4,5 !
-------------- ------ !
! ! ! +---+
! ------------->! S !
! ! 1,3 ! ! +---+
! 2! --------
! ! ! !
V ! ! !
+---+ RNTO +---+ 4,5 ----->+---+
! !---------->! W !---------->! F !
+---+ +---+ +---+
21a
NWG/RFC# 640 JBP NJN 5-JUN-74 16:07 30843
Postel FTP State Diagrams [13]
A very similar diagram models the Mail command: 22
+---+ MAIL +---+ 1,2 +---+
! B !---------->! W !---------->! E !
+---+ +---+ -->+---+
! ! !
3 ! ! 4,5 !
-------------- ------ !
! ! ! +---+
! ------------->! S !
! ! 1,3 ! ! +---+
! 2! --------
! ! ! !
V ! ! !
+---+ text +---+ 4,5 ----->+---+
! !---------->! W !---------->! F !
+---+ +---+ +---+
22a
Note that the "text" here is a series of lines sent from the
user to the server with no response expected until the last
line is sent, recall that the last line must consist only of a
single period. 22b
NWG/RFC# 640 JBP NJN 5-JUN-74 16:07 30843
Postel FTP State Diagrams [14]
The next diagram is a simple model of the Restart command: 23
+---+ REST +---+ 1,2 +---+
! B !---------->! W !---------->! E !
+---+ +---+ -->+---+
! ! !
3 ! ! 4,5 !
-------------- ------ !
! ! ! +---+
! ------------->! S !
! ! 3 ! ! +---+
! 2! --------
! ! ! !
V ! ! !
+---+ cmd +---+ 4,5 ----->+---+
! !---------->! W !---------->! F !
+---+ -->+---+ +---+
! !
! 1 !
------
23a
Where "cmd" is APPE, STOR, RETR, or MLFL. 23a1
We note that the above three models are similar, in fact the Mail
diagram and the Rename diagram are structurally identical. The
Restart differs from the other two only in the treatment of 100
series replies at the second stage. 24
NWG/RFC# 640 JBP NJN 5-JUN-74 16:07 30843
Postel FTP State Diagrams [15]
The most complicated diagram is for the Logon sequence: 25
1
+---+ USER +---+------------->+---+
! B !---------->! W ! 2 ---->! E !
+---+ +---+------ ! -->+---+
! ! ! ! !
3 ! ! 4,5 ! ! !
-------------- ----- ! ! !
! ! ! ! !
! ! ! ! !
! --------- !
! 1! ! ! !
V ! ! ! !
+---+ PASS +---+ 2 ! ------>+---+
! !---------->! W !------------->! S !
+---+ +---+ ---------->+---+
! ! ! ! !
3 ! !4,5! ! !
-------------- -------- !
! ! ! ! !
! ! ! ! !
! -----------
! 1,3! ! ! !
V ! 2! ! !
+---+ ACCT +---+-- ! ----->+---+
! !---------->! W ! 4,5 -------->! F !
+---+ +---+------------->+---+
25a
NWG/RFC# 640 JBP NJN 5-JUN-74 16:07 30843
Postel FTP State Diagrams [16]
Finally we present a generalized diagram that could be used to
model the command and reply interchange: 26
------------------------------------
! !
Begin ! !
! V !
! +---+ cmd +---+ 2 +---+ !
-->! !------->! !---------->! ! !
! ! ! W ! ! S !-----!
-->! ! -->! !----- ! ! !
! +---+ ! +---+ 4,5 ! +---+ !
! ! ! ! ! ! !
! ! ! 1! !3 ! +---+ !
! ! ! ! ! ! ! ! !
! ! ---- ! ---->! F !-----
! ! ! ! !
! ! ! +---+
-------------------
!
!
V
End
26a
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -