SN UNITDATA PDU format(非确认模式)
其中各字段含义如下:
- More bit (M):
0 Last segment of N PDU.
1 Not the last segment of N PDU, more segments to follow.
- SN PDU Type (T):
0 SN DATA PDU.
1 SN UNITDATA PDU.
- First segment indicator bit (F):
0 This SN PDU is not the first segment of an N PDU.
The octet including DCOMP and PCOMP is not included in the SN DATA PDU or SN UNITDATA PDU format. Also the octet for N PDU number for acknowledged mode is not included in the SN DATA PDU format.
1 This SN PDU is the first segment of an N PDU. The octet for DCOMP and PCOMP is included in the SN DATA PDU or SN UNITDATA PDU format. Also the octet for N PDU number for acknowledged mode is included in the SN DATA PDU format.
- Spare bit (X):
0 Shall be set to 0 by the transmitting SNDCP entity and ignored by the receiving SNDCP entity.
- NSAPI:
0 Escape mechanism for future extensions.
1 Point-to-Multipoint Multicast (PTM-M) information.
2-4 Reserved for future use.
5-15 Dynamically allocated NSAPI value.
SN PDU with an unallocated NSAPI value shall be ignored by the receiving SNDCP entity without error notification.
- Data compression coding (DCOMP):
0 No compression.
1-14 Points to the data compression identifier negotiated dynamically.
15 Reserved for future extensions.
SN PDU with an unallocated DCOMP value shall be ignored by the receiving SNDCP entity without error notification.
- Protocol control information compression coding (PCOMP):
0 No compression.
1-14 Points to the protocol control information compression identifier negotiated dynamically (see subclause 6.5).
15 Reserved for future extensions.
SN PDU with an unallocated PCOMP value shall be ignored by the receiving SNDCP entity without error notification.
- Segment number:
0-15 Sequence number for segments carrying an N PDU.
- N PDU number - acknowledged mode:
0-255 N PDU number of the N PDU.
- N PDU number - unacknowledged mode:
0-4095 N PDU number of the N PDU.
2) Segmentation
分段就是将N-PDU分成SN-PDUs. SN-PDUs的长度,在确认模式下,S不超过N201-I;非确认模式下,不超过N201-U。其中N201-I和N201-U通过XID参数协商确定。
第一个分段的F字段为1,其它分段的F字段为0.
非确认模式下, 对于F为1的第一个分段,DCOMP 和PCOMP字段需填写。
确认模式下,对于F为1的第一个分段,DCOMP, PCOMP 和 N PDU number字段需填写。
最后一个分段的M字段为0,其它分段的M字段为1.
3) Reassembly
汇聚时,DCOMP 和PCOMP从第一个分段中获得,确认模式下,N PDU number也从第一个分段中获得。
接收的SNDCP实体,有以下3个状态:
- Receive First Segment state,等待接收F字段为1的第一个分段;
- Receive Subsequent Segment state,等待接收F为0的后续分段;
- Discard state,组合成N-PDU后,丢弃接收的SN-PDUs.
4) Segmentation and reassembly in acknowledged mode
确认模式是可靠传输,只有前面的分段确认后,才发送后面的字段。接收也一样。可以确保所有分段按先后顺序达到。在接收完毕后,直接组合为N-PDU即可。
5) Segmentation and reassembly in unacknowledged mode
非确认模式下,由于是不可靠传输,先发的未必先收到。还需引进Segment number,为N-PDU的每一个SN-PDU指定一个序列号,从0开始,依次递增。这样在接收后,按Segment number排序,然后组合成N-PDU.
- Receive First Segment state.
如果接收到F字段为0的分段,不是第一个分段,抛掉。接收完第一个分段后(F为1),获得DCOMP或者PCOMP,然后进入Receive Subsequent Segment 状态。
- Receive Subsequent Segment state.
如果再次收到F为1的第一个分段,并且DCOMP或者PCOMP不同,那么之前接收的同一个N-PDU的所有分段都抛掉。接收完N-PDU的最后一个分段(M为0)后,进入Receive First Segment状态。
6. XID parameter negotiation
XID参数包括数据压缩和解压缩的参数,以及SN-PDU的长度N201-I和N201-U。(N201是LLC层的最大payload长度,即I帧的信息帧的长度,类似于IP网络中MTU最大传输单元的作用)。
在数据传输前,需要调整XID参数时,先进行XID参数协商。
图七 SNDCP XID协商流程
7. Data transfer
1) Acknowledged mode
The SNDCP entity shall initiate acknowledged data transmission only if the PDP context for the NSAPI identified in the SN DATA.request has been activated and if acknowledged LLC operation has been established.
确认模式下传输数据要求:NSAPI对应的PDP已经激活,并且确认模式的LLC连接已经建立。
上层应用在发数据时,通过SN DATA.request源语,将N-PDU number带下来。不同的NSAPI的N-PDU number是独立的。确认模式下,在分段时,将N-PDU number填在第一个分段的SNDCP头部。
对每一个NSAPI,都有Send N-PDU number和Receive N-PDU number. 在激活确认模式下的数据传输时(PDP激活和LLC建立),这两个N-PDU number都置为0.
SN DATA.request源语中如果没有带Send N-PDU number,就把当前的置作为N-PDU number,对数据进行压缩和分段发到LLC。然后Send N-PDU。number加1.
SN DATA.request源语中如果带了Send N-PDU number,就覆盖当前的值。
每发送一个N-PDU,Send N-PDU number加1;每接收一个N-PDU,Receive N-PDU number加1。
图八 SNDCP确认模式数据传输
2) Unacknowledged mode
The SNDCP entity shall initiate unacknowledged data transmission only if the PDP context for the NSAPI identified in the SN DATA.request has been activated. The SNDCP entity may initiate unacknowledged data transmission even if the acknowledged peer-to-peer operation is not established for that NSAPI.
图九 SNDCP非确认模式数据传输