📄 rfc908.txt
字号:
Processing of arriving segments usually follows this general sequence: the sequence number is checked for validity and, if valid, the segment is queued and processed in sequence-number order. For all events, unless a state change is specified, RDP remains in the same state. Page 20 RDP Specification Protocol Operation 3.7.1 User Request Events The following scenarios demonstrate the processing of events caused by the issuance of user requests: Open Request CLOSED STATE Create a connection record If none available Return "Error - insufficient resources" Endif If passive Open If local port not specified Return "Error - local port not specified" Endif Generate SND.ISS Set SND.NXT = SND.ISS + 1 SND.UNA = SND.ISS Fill in SND.MAX, RMAX.BUF from Open parameters Set State = LISTEN Return Endif If active Open If remote port not specified Return "Error - remote port not specified" Endif Generate SND.ISS Set SND.NXT = SND.ISS + 1 SND.UNA = SND.ISS Fill in SND.MAX, RMAX.BUF from Open parameters If local port not specified Allocate a local port Endif Send <SEQ=SND.ISS><MAX=SND.MAX><MAXBUF=RMAX.BUF><SYN> Set State = SYN-SENT Return (local port, connection identifier) Endif Page 21 RFC-908 July 1984 LISTEN STATE SYN-SENT STATE SYN-RCVD STATE OPEN STATE CLOSE-WAIT STATE Return "Error - connection already open" Close Request OPEN STATE Send <SEQ=SND.NXT><RST> Set State = CLOSE-WAIT Start TIMWAIT Timer Return LISTEN STATE Set State = CLOSED Deallocate connection record Return SYN-RCVD STATE SYN-SENT STATE Send <SEQ=SND.NXT><RST> Set State = CLOSED Return CLOSE-WAIT STATE Return "Error - connection closing" CLOSE STATE Return "Error - connection not open" Page 22 RDP Specification Protocol Operation Receive Request OPEN STATE If Data is pending Return with data else Return with "no data" indication Endif LISTEN STATE SYN-RCVD STATE SYN-SENT STATE Return with "no data" indication CLOSE STATE CLOSE-WAIT STATE Return "Error - connection not open" Send Request OPEN STATE If SND.NXT < SND.UNA + SND.MAX Send <SEQ=SND.NXT><ACK=RCV.CUR><ACK><Data> Set SND.NXT = SND.NXT + 1 Return else Return "Error - insufficient resources to send data" Endif LISTEN STATE SYN-RCVD STATE SYN-SENT STATE CLOSE STATE CLOSE-WAIT STATE Return "Error - connection not open" Status Request Return with: Page 23 RFC-908 July 1984 State of connection (OPEN, LISTEN, etc.) Number of segments unacknowledged Number of segments received not given to user Maximum segment size for the send side of the connection Maximum segment size for the receive side of the connection 3.7.2 Segment Arrival Events The following scenarios describe the processing of the event caused by the arrival of a RDP segment from a remote host. The assumption is made that the segment was addressed to the local port associated with the connection record. If State = CLOSED If RST set Discard segment Return Endif If ACK or NUL set Send <SEQ=SEG.ACK + 1><RST> Discard segment Return else Send <SEQ=0><RST><ACK=RCV.CUR><ACK> Discard segment Return Endif Endif If State = CLOSE-WAIT If RST set Set State = CLOSED Discard segment Cancel TIMWAIT timer Deallocate connection record else Discard segment Endif Return Endif Page 24 RDP Specification Protocol Operation If State = LISTEN If RST set Discard the segment Return Endif If ACK or NUL set Send <SEQ=SEG.ACK + 1><RST> Return Endif If SYN set Set RCV.CUR = SEG.SEQ RCV.IRS = SEG.SEQ SND.MAX = SEG.MAX SBUF.MAX = SEG.BMAX Send <SEQ=SND.ISS><ACK=RCV.CUR><MAX=RCV.MAX><BUFMAX=RBUF.MAX> <ACK><SYN> Set State = SYN-RCVD Return Endif If anything else (should never get here) Discard segment Return Endif Endif If State = SYN-SENT If ACK set If RST clear and SEG.ACK != SND.ISS Send <SEQ=SEG.ACK + 1><RST> Endif Discard segment; Return Endif If RST set If ACK set Signal "Connection Refused" Set State = CLOSED Deallocate connection record Endif Discard segment Return Endif Page 25 RFC-908 July 1984 If SYN set Set RCV.CUR = SEG.SEQ RCV.IRS = SEG.SEQ SND.MAX = SEG.MAX RBUF.MAX = SEG.BMAX If ACK set Set SND.UNA = SEG.ACK State = OPEN Send <SEQ=SND.NXT><ACK=RCV.CUR><ACK> else Set State = SYN-RCVD Send <SEQ=SND.ISS><ACK=RCV.CUR><MAX=RCV.MAX><BUFMAX=RBUF.MAX> <SYN><ACK> Endif Return Endif If anything else Discard segment Return Endif Endif If State = SYN-RCVD If RCV.IRS < SEG.SEQ =< RCV.CUR + (RCV.MAX * 2) Segment sequence number acceptable else Send <SEQ=SND.NXT><ACK=RCV.CUR><ACK> Discard segment Return Endif If RST set If passive Open Set State = LISTEN else Set State = CLOSED Signal "Connection Refused" Discard segment Deallocate connection record Endif Return Endif Page 26 RDP Specification Protocol Operation If SYN set Send <SEQ=SEG.ACK + 1><RST> Set State = CLOSED Signal "Connection Reset" Discard segment Deallocate connection record Return Endif If EACK set Send <SEQ=SEG.ACK + 1><RST> Discard segment Return Endif If ACK set If SEG.ACK = SND.ISS Set State = OPEN else Send <SEQ=SEG.ACK + 1><RST> Discard segment Return Endif else Discard segment Return Endif If Data in segment or NUL set If the received segment is in sequence Copy the data (if any) to user buffers Set RCV.CUR=SEG.SEQ Send <SEQ=SND.NXT><ACK=RCV.CUR><ACK> else If out-of-sequence delivery permitted Copy the data (if any) to user buffers Endif Send <SEQ=SND.NXT><ACK=RCV.CUR><ACK><EACK><RCVDSEQNO1> ...<RCVDSEQNOn> Endif Endif Endif Page 27 RFC-908 July 1984 If State = OPEN If RCV.CUR < SEG.SEQ =< RCV.CUR + (RCV.MAX * 2) Segment sequence number acceptable else Send <SEQ=SND.NXT><ACK=RCV.CUR><ACK> Discard segment and return Endif If RST set Set State = CLOSE-WAIT Signal "Connection Reset" Return Endif If NUL set Set RCV.CUR=SEG.SEQ Send <SEQ=SND.NXT><ACK=RCV.CUR><ACK> Discard segment Return Endif If SYN set Send <SEQ=SEG.ACK + 1><RST> Set State = CLOSED Signal "Connection Reset" Discard segment
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -