Technical Manual – Signaling Protocols HUAWEI CSOFTX3000 Mobile SoftSwitch Center Table of Contents Table of Contents Chapter 2 SCTP ............................................................................................................................. 3-1 2.1 Overview of SCTP ............................................................................................................. 3-1 2.1.1 Related Terms......................................................................................................... 3-1 2.1.2 Functions of SCTP .................................................................................................. 3-2 2.2 SCTP Messages ................................................................................................................ 3-4 2.2.1 Message Structure .................................................................................................. 3-4 2.2.2 Message Format ..................................................................................................... 3-6 2.3 Basic SCTP Procedures .................................................................................................... 3-8 2.3.1 Establishment of Associations and Transmission of Chunks ................................. 3-8 2.3.2 Shutdown of Associations ..................................................................................... 3-11 Huawei Technologies Proprietary i Technical Manual – Signaling Protocols HUAWEI CSOFTX3000 Mobile SoftSwitch Center SIGTRAN Chapter 2 SCTP Chapter 2 SCTP This chapter describes stream control transmission protocol (SCTP) based on IP, including: z Overview of SCTP z SCTP messages z Basic SCTP procedures 2.1 Overview of SCTP The SCTP provides a reliable datagram transmission protocol based on IP. It is used in the IP network to transmit SCN narrowband signaling messages. Some defects of TCP are corrected in the SCTP, which makes the SCTP more reliable. The SCTP has the following features in the design: z Appropriate congestion control z Flooding and spoof attack prevention z Better real-time performance and multi-home attribute The SCTP is a protocol for the transmission layer. Its upper layer is the SCTP user application layer, and its lower layer is the packet network layer. 2.1.1 Related Terms This section introduces some terms involved in SCTP. I. Transport Address A transport address of the SCTP is defined as combination of an IP address and an SCTP port number. The SCTP port number is used for the SCTP to identify users with the same address. It is a concept identical to the TCP port number. For example, the IP address "10.105.28.92" and SCTP port number "1024" forms a transport address, whereas "10.105.28.93" and "1024" forms another transport address. Similarly, "10.105.28.92" and "1023" forms a different transport addresses. II. Host and Endpoint A host is a computer configured with one or more IP addresses. It is a typical physical entity. Huawei Technologies Proprietary 3-1 Technical Manual – Signaling Protocols HUAWEI CSOFTX3000 Mobile SoftSwitch Center SIGTRAN Chapter 2 SCTP An endpoint is a basic SCTP concept. It is a logical sender and receiver of SCTP packets. It is a typical logical entity. As prescribed in the SCTP, only one association is established between two endpoints, but a host may have multiple endpoints. III. Association and Stream An association is the logical relationship or a channel established between two SCTP endpoints for data transmission through the four-way handshake mechanism prescribed in the SCTP. The SCTP is characterized by streams. In an SCTP association, a stream is a uni-directional logical channel established between one endpoint and another associated endpoint. The data to be delivered in sequence must be transmitted in a stream. An association may contain multiple streams. IV. TSN and SSN A transmission sequence number (TSN) is a 32-bit sequence number used internally by the SCTP. One TSN is configured to each chunk to allow the receiving SCTP endpoint to acknowledge the receipt. A TSN is maintained based on association. A stream sequence number (SSN) is a 16-bit sequence number in each stream of an association configured for each chunk sent in the stream by the local end to ensure that the chunk can be transmitted in sequence. A SSN is maintained based on streams. TSNs are SSNs are assigned separately. V. CWND and RWND The SCTP is a sliding window protocol. A congestion window (CWND) is maintained based on each destination address. It is adjusted according to the network condition. When the length of an unacknowledged message sent from the destination address exceeds the value of a CWND, the endpoint stops sending data to this address. A receiver window (RWND) is used to describe the size of the receiving buffer of an association in the peer end. During establishment of an association, both ends exchange their initial RWNDs. RWNDs vary with data acknowledged or sent. The size of an RWND determines how much data it can send. When an RWND is set to 0, the SCTP can send a packet so that it knows changes of the buffer in the peer end. 2.1.2 Functions of SCTP The SCTP has the following functions: Huawei Technologies Proprietary 3-2 Technical Manual – Signaling Protocols HUAWEI CSOFTX3000 Mobile SoftSwitch Center SIGTRAN Chapter 2 SCTP z Establishment and shutdown of associations z Sequential message transmission in streams z User data segmentation z Acknowledgement and congestion avoidance z Chunk bundling z Packet verification z Path management I. Establishment and Shutdown of Associations SCTP is an association-oriented transmission protocol. In general, data can be transmitted only when two endpoints establish their association. Therefore, establishment and shutdown of associations are preconditions for providing other services. II. Sequential Message Transmission in Streams In the SCTP, streams are used to indicate sequences for the user messages to be sent to a high layer. In a same stream, messages must be transferred in sequence. SCTP users can specify the number of streams supported by an association when they establish an association. User messages are associated through the SSN. III. User Data Segmentation When sending messages to a low layer, the SCTP segments these messages to make them meet requirements of the maximum transmission unit (MTU). The receiving end needs to combine the segmented messages into complete messages and then sends them to SCTP users. IV. Acknowledgement and Congestion Avoidance The SCTP segments all user messages. If a message is not segmented, it assigns a TSN for the message. The receiving end is responsible for acknowledging the TSN. The SCCP sends a message again if it does not receive the acknowledge message within the specified time. V. Chunk Bundling If a large SCTP message header is contained in a short user message, the message will be transmitted inefficiently. In this case, you can bundle more than one message to an SCTP packet to improve the utilization ratio of bandwidth. Huawei Technologies Proprietary 3-3 Technical Manual – Signaling Protocols HUAWEI CSOFTX3000 Mobile SoftSwitch Center SIGTRAN Chapter 2 SCTP VI. Packet Verification Each SCTP packet header contains a mandatory Verification Tag and a 32-bit verification field. The value of the Verification Tag is selected by an endpoint of an association. If the receiver does not receive the expected Verification Tag, it discards the packet. The verification field is set by the sender of an SCTP packet. The receiver checks the checksum to make sure whether the user data is damaged. VII. Path Management An SCTP user can use a group of transport addresses as the destination of SCTP packets. The path management function makes the following operations possible: z Select a destination transport address for each SCTP packet to be sent based on instructions of SCTP users and accessibility of the current destination set. z Monitor whether a destination address is accessible through heartbeat messages and notify SCTP users about changes of the accessibility of destination addresses. z Report the qualified local transport address set to the remote end and send returned transport address reports to local SCTP users. 2.2 SCTP Messages This section describes: z Message structure z Message format 2.2.1 Message Structure Figure 2-1 shows the structure of an SCTP packet. Huawei Technologies Proprietary 3-4 Technical Manual – Signaling Protocols HUAWEI CSOFTX3000 Mobile SoftSwitch Center SIGTRAN Chapter 2 SCTP 16 bits 16 bits Destination Port Number Source Port Number Common Header Verification Tag Checksum Chunk Type Chunk Flags Chunk Length Chunk #1 Chunk Value Chunk Type Chunk Flags Chunk Length Chunk #n Chunk Value Figure 2-1 SCTP packet structure An SCTP packet contains the following: z A common header z Several chunks. Each chunk contains control information or user data. Huawei Technologies Proprietary 3-5 Technical Manual – Signaling Protocols HUAWEI CSOFTX3000 Mobile SoftSwitch Center SIGTRAN Chapter 2 SCTP Note: Multiple chunks can be bundled in an SCTP packet to meet requirements of the MTU except the following types of chunks: z INIT z INIT ACK z SHUTDOWN COMPLETE These chunks may not be bundled with other chunks in a packet. If a user message cannot be put in an SCTP packet, the message can be divided into several data chunks. 2.2.2 Message Format I. Format of Common Header An SCTP common header contains the following fields: z Source Port Number A Source Port Number identifies the SCTP port number of the sending endpoint. The receiving end can use Source Port Number, Source IP Address, Destination Port Number, and Destination IP Address to identify the association of SCTP packets. z Destination Port Number A Destination Port Number is the SCTP port number of the destination endpoint. Using a destination port number, the receiving host can multiplex an SCTP packet to a correct endpoint or an application. z Verification Tag A Verification Tag is a random identifier generated by the local endpoint for an association. During establishment of an association, the sender and the receiver exchange Verification Tags. The sender must carry this tag in the common header for verification. Functions of a Verification Tag are detailed in subsequent procedure. z Checksum The SCTP uses the ADLER-32 algorithm for user data to figure out a 32-bit checksum. This checksum is carried in packets. When a packet is sent, the receiver carries out the same calculation to obtain a checksum. Users can verify whether user data is damaged by judging whether this checksum is the same as the previous one. Huawei Technologies Proprietary 3-6 Technical Manual – Signaling Protocols HUAWEI CSOFTX3000 Mobile SoftSwitch Center SIGTRAN Chapter 2 SCTP II. Chunk Format A chunk contains the following fields: z Chunk type A chunk type is the type of a message in terms of chunk value. Table 2-1 lists major SCTP chunk types. Table 2-1 SCTP chunk types Chunk z Function DATA Payload chunk INIT Used to start an association between two SCTP endpoints. INIT ACK Used to verify startup of associations. SACK Used to verify the DATA chunks received at the peer end through TSNs, and inform the peer end of the interval for receiving a DATA chunk. HEARTBEAT Used to check that a specified destination address is accessible in the current association when an endpoint sends this type of chunk to the peer end. HEARTBEAT ACK Used to respond to a HEARTBEAT chunk sent by an SCTP endpoint. ABORT Used to abort the association between two SCTP endpoints. SHUTDOWN Used to shut down an association normally. SHUTDOWN ACK Used to acknowledge the SHUTDOWN chunk received. ERROR Used to inform the peer end of some connection errors. COOKIE ECHO Used to start an association. COOKIE ACK Used to acknowledge the COOKIE ECHO chunk received. SHUTDOWN COMPLETE Used to acknowledge the SHUTDOWN ACK chunk received after an association is shut down. Chunk flags Chunk flags are determined by chunk types. Unless set to other values, chunk flags are set to 0 during delivery and the receiving endpoint ignores the flags. z Chunk length Chunk length is the number of binary bytes used to indicate the length of chunk type, chunk flag, and chunk value. z Chunk value Huawei Technologies Proprietary 3-7 Technical Manual – Signaling Protocols HUAWEI CSOFTX3000 Mobile SoftSwitch Center SIGTRAN Chapter 2 SCTP A chunk value is the information to be sent in a chunk. Its contents are determined by chunk types. The length of a chunk value is not fixed. Note: The total length of a chunk must be integral times of four bytes. If not, the sender fills zeros in the chunk. These zeros are not accounted in the length of the chunk. The sender must fill at most three bytes, whereas the receiver ignores the filled bytes. 2.3 Basic SCTP Procedures The basic SCTP procedures include: z Establishment of associations and transmission of trunks z Shutdown of associations 2.3.1 Establishment of Associations and Transmission of Chunks SCTP endpoint A starts to establish an association and sends a chunk to endpoint B. B then sends two chunks to A. Suppose these messages are not bundled or segmented. Figure 2-2 shows the SCTP procedure. This procedure includes the following two parts: z Establishment of associations z Transmission of chunks Huawei Technologies Proprietary 3-8 Technical Manual – Signaling Protocols HUAWEI CSOFTX3000 Mobile SoftSwitch Center SIGTRAN Chapter 2 SCTP Endpoint A Endpoint B (1) INIT (2) INIT ACK (3) COOKIE ECHO (4) COOKIE ACK (5) DATA (6) SACK (7) DATA (8) DATA (9) SACK Figure 2-2 Establishment of an association I. Establishment of Associations Establishment of an association is a four-way handshake processing, including interactions of the following chunks: z INIT z INIT ACK z COOKIE ECHO z COOKIE ACK The procedure is as follows: 1) A sends an INIT chunk to B. In the INIT chunk, A must provides its Verification Tag (Tag_A) in the Initiate Tag field. Tag_A shall be a random number in the range of 1 to 429496729. After sending the INIT, A starts the INIT timer and enters the COOKIE-WAIT state. Huawei Technologies Proprietary 3-9 Technical Manual – Signaling Protocols HUAWEI CSOFTX3000 Mobile SoftSwitch Center SIGTRAN Chapter 2 SCTP Note: The INIT timer sets the duration for waiting for the peer endpoint to return the ININT ACK chunk. If the INTI ACK chunk is not received after the timer expires, the local endpoint resends the INIT chunk until the maximum resending times are reached. 2) B shall respond immediately with an INIT ACK chunk after receiving the INIT chunk. The destination IP address of the INIT ACK chunk must be set to the source IP address of the INIT to which B is responding. In the INIT ACK chunk, besides filling in other parameters, B must set the Verification Tag field to Tag_A, and also provide its own Verification Tag (Tag_B) in the Initiate Tag field. Moreover, B must generate and send along with the INIT ACK a State Cookie. 3) Upon reception of the INIT ACK from B, A shall stop the INIT timer and leave the COOKIE-WAIT state. A shall then send the State Cookie received in the INIT ACK chunk in a COOKIE ECHO chunk, starts the COOKIE timer, and enters the COOKIE-ECHOED state. 4) Upon reception of the COOKIE ECHO chunk, B will reply with a COOKIE ACK chunk after moving to the ESTABLISHED state. In addition, B sends the COMMUNICATION UP primitive to SCTP. 5) Upon reception of the COOKIE ACK chunk, A will move from the COOKIE-ECHOED state to the ESTABLISHED state, stopping the COOKIE timer. A notifies SCTP users about successful establishment of the association with a COMMUNICATION UP primitive. II. Transmission of Trunks The procedure of trunk transmission is as follows: 1) Endpoint A sends a DATA chunk to endpoint B and starts the T3-RTS timer. The DATA chunk must contain the following parameters: 2) z TSN: Initial TSN of the DATA chunk. z Stream Identifier: Identifier of the user data stream. Suppose the identifier is 0. z SSN: This field is in the range of 0 to 65535. z User Data: Contain payload user data. After receiving the DATA chunk, B returns a SACK chunk. The SACK chunk must contain the following parameters: z Cumulative TSN Ack: Initial TSN of A. z Gap Ack Block. This value is 0. Huawei Technologies Proprietary 3-10 Technical Manual – Signaling Protocols HUAWEI CSOFTX3000 Mobile SoftSwitch Center SIGTRAN Chapter 2 SCTP 3) After receiving the SACK, A stops the T3-RTX timer. 4) B sends the first DATA chunk to A. The DATA chunk must contain the following parameters: 5) z TSN: Initial TSN of the DATA chunk sent by B. z Stream Identifier: Identifier of the user data stream. Suppose the identifier is 0. z SSN: Suppose the SSN is 0. z User Data: Contain payload user data. B sends the second DATA chunk to A. The DATA chunk must contain the following parameters: 6) z TSN: One plus initial TSN of the DATA chunk sent by B. z Stream Identifier: Identifier of the user data stream. Suppose the identifier is 0. z SSN. The SSN is 1. z User Data: Contain payload user data. After receiving the DATA chunk, A returns a SACK chunk. The SACK chunk must contain the following parameters: z Cumulative TSN Ack: Initial TSN of B. z Gap Ack Block. This value is 0. 2.3.2 Shutdown of Associations When an endpoint exits, its association must be shut down. The following two procedures can be used to shut down an association: z Abortion process z Shutdown process I. Abortion of Associations An association may be aborted when there are unacknowledged messages. In this case, both ends of the association discard data and do not send it to the peer end. In this way, the security of data is not considered. The procedure of aborting an association is as follows: 1) The initiating end sends an ABORT chunk to the peer end. The Verification Tag of the peer endpoint must be filled in the SCTP packet sent. No DATA chunk is bundled in the ABORT chunk. 2) After receiving the ABORT chunk, the receiving endpoint checks the Verification Tag. If the Verification Tag is the same as that of the local endpoint, the receiving endpoint removes the association from records and reports it to SCTP users. Huawei Technologies Proprietary 3-11 Technical Manual – Signaling Protocols HUAWEI CSOFTX3000 Mobile SoftSwitch Center SIGTRAN Chapter 2 SCTP II. Shutdown of Associations When an endpoint executes the shutdown program, both ends of the association stop receiving new data from their SCTP users. They send data in packets to SCTP users when sending or receiving the SHUTDOWN chunk. Shutdown of an association ensures that data not sent or acknowledged at both ends can be sent or acknowledged before the association is aborted. Figure 2-3 shows the shutdown procedure of an association. Endpoint A Endpoint B (1) SHUTDOWN (2) SHUTDOWN ACK (3) SHUTDOWN COMPLETE Figure 2-3 Association shutdown procedure Upon receiving a SHUTDOWN primitive from SCTP users, endpoint A enters the SHUTDOWN-PENDING state. It keeps this state until all unacknowledged data is acknowledged by the peer end. In this case, A does not receive data from a high layer. The procedure of shutting down an association is as follows: 1) Endpoint A sends a SHUTDOWN chunk to endpoint B. Once all unacknowledged data is acknowledged, endpoint A sends the SHUTDOWN chunk to the peer end. In addition, endpoint A starts the T2-shutdown timer and enters the SHUTDOWN-SENT state. If the timer expires, endpoint A must resend the SHUTDOWN chunk. 2) After receiving the SHUTDOWN chunk, endpoint B performs the following operations: z Enters the SHUTDOWN-RECEIVED state. z Stops receiving new data from its SCTP users. z Verify that all its outstanding DATA chunks are received by the SHUTDOWN sender by checking the Cumulative TSN ACK field of the chunk. If endpoint B has no more outstanding DATA chunks, it shall send a SHUTDOWN ACK chunk and start a T2-shutdown timer of its own, entering the SHUTDOWN-ACK-SENT state. 3) Upon receiving the SHUTDOWN ACK, endpoint A shall stop the T2-shutdown timer, send a SHUTDOWN COMPLETE chunk to its peer, and remove all records of the association. Huawei Technologies Proprietary 3-12 Technical Manual – Signaling Protocols HUAWEI CSOFTX3000 Mobile SoftSwitch Center 4) SIGTRAN Chapter 2 SCTP After receiving the SHUTDOWN COMPLETE chunk, endpoint B verifies that it is in the SHUTDOWN-ACK-SENT state. If it is not in the SHUTDOWN-ACK-SENT state, B discards the chunk. If it is in the state, B stops the T2-shutdown timer and removes all records of the association. Thus, the association enters the CLOSED state. 3 Huawei Technologies Proprietary 3-13