1. Connection establishment and transmission process
Sctp endpoint A starts to establish coupling and sends a user message to endpoint B. Then, endpoint B sends two user messages to. (Assume that these messages are not bundled and segmented ). The signaling process 1 is shown.
Figure 1 process message interaction diagram created by coupling
(1) Endpoint A creates a Data Structure TCB (Transmission Control Block) to describe the coupling to be initiated (including the basic information of coupling), and then sends the init data block to endpoint B. The following parameters are included in the init data block:
Initiate Tag: peer verification tag, for example, set to tag_a. Tag_a is a random number from 1 to 4294967295.
Output stream quantity (OS): the maximum number of outgoing streams expected by the current endpoint.
Input stream quantity (MIS): the maximum number of inbound streams allowed by this endpoint.
(2) After receiving the init message, endpoint B immediately responds with the init ack data block. The init ack data block must contain the following parameters:
Destination IP Address: Set it to the origin IP address of the init data block.
Initiate Tag: Set to tag_ B.
State COOKIE: a TCB is generated based on the basic information of the coupling. This TCB is a temporary TCB. After the TCB is generated, it includes the necessary information (including the timestamp generated by a cookie and the life cycle of the cookie) and a local key is calculated into a 32-bit digest Mac using the algorithm described in rfc2401 (this calculation is irreversible ). Combine necessary information and Mac information into the State cookie parameter.
This endpoint transfer address.
The maximum number of inbound streams.
The maximum number of outbound streams.
(3) After receiving the init ACK, Terminal A First stops the init timer and leaves the cookie-Wait Status. Then, it sends the cookie echo data block and brings back the original state cookie parameter in the init ack data block. End Point A starts the cookie timer and enters the cookie-echoed state.
(4) After receiving the cookie echo data block, endpoint B performs cookie verification. Calculate the TCB portion of the state cookie and the local key based on the rfc2401 MAC Algorithm, and compare the Mac contained in the obtained Mac and State cookie. If the message is different, the message is discarded. if the message is the same, the time stamp of the TCB part is taken out, which is compared with the current time to check whether the time has exceeded the Cookie's life cycle. If yes, it is also discarded. Otherwise, a coupling with end a is established based on the information in TCB. Endpoint B migrates the status to established and issues the cookie ack data block. Endpoint B sends scommunciation up notifications to sctp users.
(5) Endpoint A sends a data block to endpoint B and starts the T3-RTS timer. The data block must contain the following parameters:
TSN: the initial TSN of the data block.
Stream identifier: the stream of user data. It is assumed that the stream ID is 0.
Stream sequence number: the sequential number of user data in the stream. This field ranges from 0 to 65535.
User Data: carries the user data net load.
(6) After receiving the data block, endpoint B returns the sack data block. The sack data block must contain the following parameters:
Cumulative TSN ack: the initial TSN of endpoint.
Gap ack block: The value is 0. When endpoint A receives the sack data block, it stops the T3-RTX timer.
(7) Endpoint B sends the first data block to endpoint. Data blocks must contain the following parameters:
TSN: the initial TSN of the data block sent by endpoint B.
Stream identifier: the stream of user data. It is assumed that the stream ID is 0.
Stream sequence number: the sequential number of user data in the stream. Assume that the stream sequence code is 0.
User Data: carries the user data net load.
(8) Endpoint B sends the second data block to endpoint. Data blocks must contain the following parameters:
TSN: the initial TSN + 1 of the data block sent by endpoint B.
Stream identifier: the stream of user data. It is assumed that the stream ID is 0.
Stream sequence number: the sequential number of user data in the stream. The stream sequence code is 1.
User Data: carries the user data net load.
(9) After receiving the data block, endpoint a returns the sack data block. The sack data block must contain the following parameters:
Cumulative TSN ack: the initial TSN of endpoint B.
Gap ack block: The value is 0.
2 coupling close Process
When an endpoint exits the service, it needs to stop its coupling. The stop of coupling uses two processes: the stop process of coupling (abnormal close) and the normal close process of coupling. The suspension of coupling (abnormal shutdown) can be performed during any unfinished period. both ends of the coupling discard the data and do not submit the data to the peer end. This method does not consider data security. The process for terminating coupling is relatively simple: the initiator sends an abort data block to the peer vertex, and the verification label of the Peer vertex must be filled in the sctp group to be sent, in addition, no data is bound to the abort data block. The receiving endpoint checks the verification label after receiving the abort data block. If the verification label is the same as the local verification label, the receiving endpoint clears the coupling from the recording and reports the end of the coupling to the sctp user.
Normally Closed coupling: When any endpoint executes a normally closed program, both ends of the coupling stop accepting new data sent from its sctp user, and when the shutdown data block is sent or received, submit the data in the group to the sctp user. The closure of coupling ensures that unsent and unconfirmed data are sent and confirmed at both ends before the coupling ends.
Figure 2 disable message interaction after Coupling
The steps for disabling coupling are as follows:
(1) The reason why the sctp user of the initiator A sends a shutdown request to sctp is disabled in coupling mode. Sctp coupling is moved from the established state to the shutdown-pending state. In this status, sctp does not accept any data sending requests from sctp users on this coupling. At the same time, wait for all unconfirmed data sent by endpoint A to be confirmed by endpoint B. When unverified data is sent by all endpoint A, the shutdown data block is sent to endpoint B. Endpoint A starts the T2-shutdown timer into shutdown-sent state. The purpose of starting the T2-shutdown timer is to wait for the SHUTDOWN-ACK data block sent back by endpoint B, and if the timer times out, endpoint A Must resend the shutdown data block.
(2) After receiving the shutdown message, endpoint B enters the SHOUTDOWN-RECEIVED state, no longer receives new data from the sctp user, and checks the accumulated TSN ACK segment of the data block, verify that all unfinished data blocks have been received by the shutdown sender. When all unsent data and unconfirmed data are sent and confirmed by endpoint B, send the shutdown ack data block, start the local T2-SHUTDOWN timer, and enter the SHUTDOWN-ACK-SENT status. If the timer times out, end B resends the shutdown ack data block.
(3) After receiving the shutdown ACK message, end a stops the T2-shutdown timer, and sends the shutdown complete data block to end B, and clears all records of coupling. After receiving the shutdown complete data block, endpoint B verifies that it is in the SHUTDOWN-ACK-SENT state. If not, the data block is discarded; if the endpoint is in the SHUTDOWN-ACK-SENT state, endpoint B stops the T2-shutdown timer and clears all records of coupling into the closed state.