SCTP报文格式
SCTP分组含了一个公共的分组头(Common Header)和若干数据块(Chunk)。
一个SCTP分组含了一个公共的分组头(Common Header)和若干数据块(Chunk),每个数据块中既可以包含控制信息,也可以包含用户数据。除了INIT、INIT ACK和SHUTDOWN COMPLETE数据块外,其他类型的多个数据块可以捆绑在一个SCTP分组中,以满足对MTU大小的要求。当然,这些数据块也可以不与其他数据块捆绑在一个分组中。如果一个用户消息不能放在一个SCTP分组中,这个消息可以被分成若干个数据块。
一、SCTP报文格式
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-------------------------------+-------------------------------+ ---
| Source Port Number | Destination Port Number | ^
+-------------------------------+-------------------------------+ |
| Verification Tag | Common Header
+---------------------------------------------------------------+ |
| Checksum | V
+---------------+---------------+-------------------------------+ ---
| Chunk Type | Chunk Flags | Chunk Length | ^
+---------------+---------------+-------------------------------+ |
| Chunk Value | Chunk #1
+ ... ... + |
| | V
+---------------------------------------------------------------+ ---
| |
+ .... + ....
| |
+---------------+---------------+-------------------------------+ ---
| Chunk Type | Chunk Flags | Chunk Length | ^
+---------------+---------------+-------------------------------+ |
| Chunk Value | Chunk #n
+ + |
| | V
+---------------------------------------------------------------+ ---
二、SCTP报文格式释义
字段 | 长度 | 描述 |
---|---|---|
Source Port Number | 16比特 | 源端口号,识别SCTP发送端点的SCTP端口号。接收方可以使用源端口号、源IP地址、目的端口号和目的IP地址标识该SCTP分组所属的偶联。 |
Destination Port Number | 16比特 | 目的端口号,为目的端点的SCTP端口号。接收主机可以使用目的端口号将SCTP分组复用到正确的端点或应用中。 |
Verification Tag | 32比特 |
验证标签是偶联建立时,本端端点为这个偶联生成一个随机标识。偶联建立过程中,双方会交换这个TAG,到了数据传递时,发送端必须在公共分组头中带上对端的这个TAG,以备校验。
|
Checksum | 32比特 | SCTP通过对用户数据使用ADLER-32算法,计算出一个32位的校验码,带在数据报中,在接收端进行同样的运算,通过检查校验码是否相等来验证用户数据是否遭到破坏。 |
Chunk Type | 8比特 | 块类型定义在块值(Chunk Value)中消息所属的类型。包括:INIT、INIT ACK、SACK、ABORT、ERROR、SHUTDOWN、COOKIE ACK等13种数据块类型。
该参数的取值范围为0~254,255留作今后的扩展。 数据块类型字段的编码分配如下:
Chunk type的高两位bit指示了收端不认识对应的chunk type的处理原则:
|
Chunk Flags | 8比特 | 块标志位用法由块类型决定。除非被置为其他值,块标记在传送过程中会被置0而且接收端点会忽视块标记。 |
Chunk Length | 16比特 | 块长度用来表示包括块类型、块标记、块长度和块值在内的字节数,长度使用二进制表示。 |
Chunk Value | 变长 | 块值字段是在该数据块中真正传送的信息,内容由数据块类型决定。块值的长度为不定长。 |
三、SCTP报文示例
Frame 1: 62 bytes on wire (496 bits), 62 bytes captured (496 bits)
Encapsulation type: Ethernet (1)
Arrival Time: Oct 13, 2011 11:01:57.810594000
[Time shift for this packet: 0.000000000 seconds]
Epoch Time: 1318474917.810594000 seconds
[Time delta from previous captured frame: 0.000000000 seconds]
[Time delta from previous displayed frame: 0.000000000 seconds]
[Time since reference or first frame: 0.000000000 seconds]
Frame Number: 1
Frame Length: 62 bytes (496 bits)
Capture Length: 62 bytes (496 bits)
[Frame is marked: False]
[Frame is ignored: False]
[Protocols in frame: eth:ethertype:ip:sctp]
Ethernet II, Src: 28:6e:d4:ee:49:df (28:6e:d4:ee:49:df), Dst: 00:25:9e:80:bb:70 (00:25:9e:80:bb:70)
Destination: 00:25:9e:80:bb:70 (00:25:9e:80:bb:70)
Address: 00:25:9e:80:bb:70 (00:25:9e:80:bb:70)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
Source: 28:6e:d4:ee:49:df (28:6e:d4:ee:49:df)
Address: 28:6e:d4:ee:49:df (28:6e:d4:ee:49:df)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
Type: IP (0x0800)
Internet Protocol Version 4, Src: 172.21.193.215 (172.21.193.215), Dst: 172.21.193.212 (172.21.193.212)
Version: 4
Header Length: 20 bytes
Differentiated Services Field: 0xb8 (DSCP 0x2e: Expedited Forwarding; ECN: 0x00: Not-ECT (Not ECN-Capable Transport))
1011 10.. = Differentiated Services Codepoint: Expedited Forwarding (0x2e)
.... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable Transport) (0x00)
Total Length: 48
Identification: 0x18b8 (6328)
Flags: 0x00
0... .... = Reserved bit: Not set
.0.. .... = Don't fragment: Not set
..0. .... = More fragments: Not set
Fragment offset: 0
Time to live: 255
Protocol: SCTP (132)
Header checksum: 0xc602 [validation disabled]
[Good: False]
[Bad: False]
Source: 172.21.193.215 (172.21.193.215)
Destination: 172.21.193.212 (172.21.193.212)
[Source GeoIP: Unknown]
[Destination GeoIP: Unknown]
Stream Control Transmission Protocol, Src Port: 2910 (2910), Dst Port: 2910 (2910)
Source port: 2910
Destination port: 2910
Verification tag: 0x01685c18
[Assocation index: 0]
Checksum: 0x62e7f617 (not verified)
SACK chunk (Cumulative TSN: 23616545, a_rwnd: 109100, gaps: 0, duplicate TSNs: 0)
Chunk type: SACK (3)
0... .... = Bit: Stop processing of the packet
.0.. .... = Bit: Do not report
Chunk flags: 0x00
.... ...0 = Nounce sum: 0
Chunk length: 16
Cumulative TSN ACK: 23616545
Advertised receiver window credit (a_rwnd): 109100
Number of gap acknowledgement blocks: 0
Number of duplicated TSNs: 0
四、SCTP所处的协议栈结构
+----------------------+--------+--------+
| Application user | | |
+--------------+-------+ | |
| SCCP | | Q.931 | |
+-------+------+ | | H.248 |
| MTP3 | | SUA | | |
+-------+ M3UA | +--------+ |
| M2UA | | | IUA | |
+-------+------+-------+--------+--------+
| SCTP |
+----------------------------------------+
| IP |
+----------------------------------------+
| L2 |
+----------------------------------------+
| L1 |
+----------------------------------------+
发表评论