rfc908.txt

来自「RFC 的详细文档!」· 文本 代码 · 共 2,193 行 · 第 1/5 页

TXT
2,193
字号


     STATUS Request

          Returns the status of a connection.  The parameters  include
          the  connection  identifier  and  the  address of the status
          buffer.









                                                               Page 19



     RFC-908                                                 July 1984



     3.7  Event Processing

          This section describes one possible sequence for  processing
     events.    It   is   not   intended   to   suggest  a  particular
     implementation, but any actual implementation  should  vary  from
     this   description  only  in  detail  and  not  significantly  in
     substance.  The following are the kinds of events that may occur:

          USER REQUESTS

                Open
                Send
                Receive
                Close
                Status


          ARRIVING SEGMENT

                Segment Arrives


          TIMEOUTS

                Retransmission Timeout
                Close-Wait Timeout

          User request processing always terminates with a  return  to
     the  caller,  with  a possible error indication.  Error responses
     are given as a character string.   A  delayed  response  is  also
     possible  in  some  situations  and  is  returned  to the user by
     whatever event or pseudo interrupt mechanism is  available.   The
     term "signal" is used to refer to delayed responses.

          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

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?