📄 rfc916.txt
字号:
Finn [Page 26]RFC 916 October 1984Reliable Asynchronous Transfer Protocol A -------------------------------------------------------- This procedure details the behavior of the LISTEN state. First check the packet for the RST flag. If it is set then packet is discarded and ignored, return and continue the processing associated with this state. We assume now that the RST flag was not set. Check the packet for the ACK flag. If it is set we have an illegal condition since no connection has yet been opened. Send a RST packet with the correct response SN value: <SN=received AN><CTL=RST> Return to the current state without any further processing. We assume now that neither the RST nor the ACK flags were set. Check the packet for a SYN flag. If it is set then an attempt is being made to open a connection. Create a TCB for this connection. The sender has placed its MDL in the LENGTH field, also specified is the sender's initial SN value. Retrieve and place them into the TCB. Note that the presence of the SO flag is ignored since it has no meaning when either of the SYN, RST, or FIN flags are set. Send a SYN packet which acknowledges the SYN received. Choose the initial SN value and the MDL for this end of the connection: <SN=0><AN=received SN+1 modulo 2><CTL=SYN, ACK><LENGTH=MDL> and go to the SYN-RECEIVED state without any further processing. Any packet not satisfying the above tests is discarded and ignored. Return to the current state without any further processing.Finn [Page 27]RFC 916 October 1984Reliable Asynchronous Transfer Protocol B -------------------------------------------------------- This procedure represents the behavior of the SYN-SENT state and is entered when this end of the connection decides to execute an active OPEN. First, check the packet for the ACK flag. If the ACK flag is set then check to see if the AN value was as expected. If it was continue below. Otherwise the AN value was unexpected. If the RST flag was set then discard the packet and return to the current state without any further processing, else send a reset: <SN=received AN><CTL=RST> Discard the packet and return to the current state without any further processing. At this point either the ACK flag was set and the AN value was as expected or ACK was not set. Second, check the RST flag. If the RST flag is set there are two cases: 1. If the ACK flag is set then discard the packet, flush the retransmission queue, inform the user "Error: Connection refused", delete the TCB, and go to the CLOSED state without any further processing. 2. If the ACK flag was not set then discard the packet and return to this state without any further processing. At this point we assume the packet contained an ACK which was Ok, or there was no ACK, and there was no RST. Now check the packet for the SYN flag. If the ACK flag was set then our SYN has been acknowledged. Store MDL received in the TCB. At this point we are technically in the ESTABLISHED state. Send an acknowledgment packet and any initial data which is queued to send: <SN=received AN><AN=received SN+1 modulo 2><CTL=ACK><DATA> Go to the ESTABLISHED state without any further processing. If the SYN flag was set but the ACK was not set then the other end of the connection has executed an active open also. Acknowledge the SYN, choose your MDL, and send: <SN=0><AN=received SN+1 modulo 2><CTL=SYN, ACK><LENGTH=MDL>Finn [Page 28]RFC 916 October 1984Reliable Asynchronous Transfer Protocol Go to the SYN-RECEIVED state without any further processing. Any packet not satisfying the above tests is discarded and ignored. Return to the current state without any further processing. C1 -------------------------------------------------------- Examine the received SN field value. If the SN value was expected then return and continue the processing associated with this state. We now assume the SN value was not what was expected. If either RST or FIN were set discard the packet and return to the current state without any further processing. If neither RST nor FIN flags were set it is assumed that this packet is a duplicate of one already received. Send an ACK back: <SN=received AN><AN=received SN+1 modulo 2><CTL=ACK> Discard the duplicate packet and return to the current state without any further processing. C2 -------------------------------------------------------- Examine the received SN field value. If the SN value was expected then return and continue the processing associated with this state. We now assume the SN value was not what was expected. If either RST or FIN were set discard the packet and return to the current state without any further processing. If SYN was set we assume that the other end crashed and has attempted to open a new connection. We respond by sending a legal reset: <SN=received AN><AN=received SN+1 modulo 2><CTL=RST, ACK> This will cause the other end, currently in the SYN-SENT state, to close. Flush the retransmission queue, inform the user "Error: Connection reset", discard the packet, delete the TCB, and go to the CLOSED state without any further processing.Finn [Page 29]RFC 916 October 1984Reliable Asynchronous Transfer Protocol If neither RST, FIN, nor SYN flags were set it is assumed that this packet is a duplicate of one already received. Send an ACK back: <SN=received AN><AN=received SN+1 modulo 2><CTL=ACK> Discard the duplicate packet and return to the current state without any further processing. D1 -------------------------------------------------------- The packet is examined for a RST flag. If RST is not set then return and continue the processing associated with this state. RST is now assumed to have been set. If the connection was originally initiated from the LISTEN state (it was passively opened) then flush the retransmission queue, discard the packet, and go to the LISTEN state without any further processing. If instead the connection was initiated actively (came from the SYN-SENT state) then flush the retransmission queue, inform the user "Error: Connection refused", discard the packet, delete the TCB, and go to the CLOSED state without any further processing. D2 -------------------------------------------------------- The packet is examined for a RST flag. If RST is not set then return and continue the processing associated with this state. RST is now assumed to have been set. Any data remaining to be sent is flushed. The retransmission queue is flushed, the user is informed "Error: Connection reset.", discard the packet, delete the TCB, and go to the CLOSED state without any further processing. D3 -------------------------------------------------------- The packet is examined for a RST flag. If RST is not set then return and continue the processing associated with this state. RST is now assumed to have been set. Discard the packet, delete the TCB, and go to the CLOSED state without any further processing.Finn [Page 30]RFC 916 October 1984Reliable Asynchronous Transfer Protocol E -------------------------------------------------------- Check the presence of the SYN flag. If the SYN flag is not set then return and continue the processing associated with this state. We now assume that the SYN flag was set. The presence of a SYN here is an error. Flush the retransmission queue, send a legal RST packet. If the ACK flag was set then send: <SN=received AN><CTL=RST> If the ACK flag was not set then send: <SN=0><CTL=RST> The user should receive the message "Error: Connection reset.", then delete the TCB and go to the CLOSED state without any further processing. F1 -------------------------------------------------------- Check the presence of the ACK flag. If ACK is not set then discard the packet and return without any further processing. We now assume that the ACK flag was set. If the AN field value was as expected then return and continue the processing associated with this state. We now assume that the ACK flag was set and that the AN field value was unexpected. If the connection was originally initiated from the LISTEN state (it was passively opened) then flush the retransmission queue, discard the packet, and send a legal RST packet: <SN=received AN><CTL=RST> Then delete the TCB and go to the LISTEN state without any further processing. Otherwise the connection was initiated actively (came from the SYN-SENT state) then inform the user "Error: Connection refused", flush the retransmission queue, discard the packet, and send a legal RST packet:Finn [Page 31]RFC 916 October 1984Reliable Asynchronous Transfer Protocol <SN=received AN><CTL=RST> Then delete the TCB and go to the CLOSED state without any further processing. F2 -------------------------------------------------------- Check the presence of the ACK flag. If ACK is not set then discard the packet and return without any further processing. We now assume that the ACK flag was set. If the AN field value was as expected then flush the retransmission queue and inform the user with an "Ok" if a buffer has been entirely acknowledged. Another packet containing data may now be sent. Return and continue the processing associated with this state. We now assume that the ACK flag was set and that the AN field value was unexpected. This is assumed to indicate a duplicate acknowledgment. It is ignored, return and continue the processing associated with this state. F3 -------------------------------------------------------- Check the presence of the ACK flag. If ACK is not set then discard the packet and return without any further processing. We now assume that the ACK flag was set. If the AN field value was as expected then continue the processing associated with this state. We now assume that the ACK flag was set and that the AN field value was unexpected. This is ignored, return and continue with the processing associated with this state. G -------------------------------------------------------- This procedure represents the behavior of the CLOSED state of a connection. All incoming packets are discarded. If the packet had the RST flag set take no action. Otherwise it is necessary to build a RST packet. Since this end is closed the other end of the connection has incorrect data about the state of the connection and should be so informed. If the ACK flag was set then send: <SN=received AN><CTL=RST>Finn [Page 32]RFC 916 October 1984Reliable Asynchronous Transfer Protocol If the ACK flag was not set then send: <SN=0><AN=received SN+1 modulo 2><CTL=RST, ACK> After sending the reset packet return to the current state without any further processing. H1 -------------------------------------------------------- Our SYN has been acknowledged. At this point we are technically in the ESTABLISHED state. Send any initial data which is queued to send: <SN=received AN><AN=received SN+1 modulo 2><CTL=ACK><DATA> Go to the ESTABLISHED state and execute procedure I1 to process any data which might be in this packet. Any packet not satisfying the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -