Notation解读
参考3GPP规范38.413 Version17.0.0,在Ch.9.3.5.7可以看到MBS Distrubution Setup Request Transfer的描述
实际定义在Ch.9.4.5--F(P463):
MBS-DistributionSetupRequestTransfer ::= SEQUENCE {
mBS-SessionID MBS-SessionID,
mBS-AreaSessionID MBS-AreaSessionID OPTIONAL,
sharedNG-U-Unicast-TNL-Information UPTransportLayerInformation OPTIONAL,
iE-Extensions ProtocolExtensionContainer { { MBS-DistributionSetupRequestTransfer-ExtIEs} } OPTIONAL,
...
}
SEQUENCE关键字定义于X.680 Ch.25,可类比于C的struct声明,以上定义了MBS-DistributionSetupRequestTransfer是一个Type,其中的字段有mBS-SessionID,mBS-AreaSessionID,...都是有序的
类似的,MBS-SessionID,MBS-AreaSessionID,...都是Type,可查找对应的定义
略复杂一些的是iE-Extensions的定义,可以看出与上面的字段有所不同:
iE-Extensions ProtocolExtensionContainer { { MBS-DistributionSetupRequestTransfer-ExtIEs} } OPTIONAL,
这个是Referencing parameterized definitions(实例化参数化类型)的语法,定义于X.683 Ch.9
这里的ProtocolExtensionContainer是一个ParameterizedType(参数化类型)(X.683 Ch.9)
这里的 {MBS-DistributionSetupRequestTransfer-ExtIEs} 是一个ObjectSet(X.681 Ch.12.3)
先来看一下ProtocolExtensionContainer的ParameterizedTypeAssignment(参数化类型定义)(X.683 Ch.8):
ProtocolExtensionContainer {NGAP-PROTOCOL-EXTENSION : ExtensionSetParam} ::=
SEQUENCE (SIZE (1..maxProtocolExtensions)) OF
ProtocolExtensionField {{ExtensionSetParam}}
其中ExtensionSetParam是一个无意义的名称,用于指代实例化参数化类型中的实际参数(也即上面例子中的 {MBS-DistributionSetupRequestTransfer-ExtIEs} )
其中NGAP-PROTOCOL-EXTENSION是一个DefinedObjectClass(X.683 Ch.8.3),其定义为:
NGAP-PROTOCOL-EXTENSION ::= CLASS {
&id ProtocolExtensionID UNIQUE,
&criticality Criticality,
&Extension,
&presence Presence
}
WITH SYNTAX {
ID &id
CRITICALITY &criticality
EXTENSION &Extension
PRESENCE &presence
}
InformationObjectClass定义语法出自X.681 Ch.9,可以参考资料 Understanding Information Objects
可以将InformationObjectClass理解为一个类型模板,可以指定其中的field而将其特化为InformationObject,但在38.413中更多地可以看到将InformationObjectClass特化为一组InformationObjectSet的例子,比如:
UserLocationInformationEUTRA-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
{ ID id-PSCellInformation CRITICALITY ignore EXTENSION NGRAN-CGI PRESENCE optional},
...
}
虽然这个例子只特化了一个值,但确实使用的是声明ObjectSet的语法
其实前面例子中的 {MBS-DistributionSetupRequestTransfer-ExtIEs} 就是一个InformationObjectSet,只是在此版本的规范中没有定义任何特化值:
MBS-DistributionSetupRequestTransfer-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
...
}
个人理解,InformationObjectClass和InformationObject的关系可以对标Type和Value的关系,只是有几个区别:
Value是由用户特化的,而InformationObjectSet是一组预定义的枚举值Value是用户数据的载体,而InformationObjectSet应该是用于约束Type的特化的,并不用于承载用户数据
那么InformationObjectSet是如何约束Type特化的?我们回到前面ProtocolExtensionContainer的定义:
ProtocolExtensionContainer {NGAP-PROTOCOL-EXTENSION : ExtensionSetParam} ::=
SEQUENCE (SIZE (1..maxProtocolExtensions)) OF
ProtocolExtensionField {{ExtensionSetParam}}
现在我们应该能看出这段的大概意思了,语义比较接近于:
typedef ProtocolExtensionContainer List<ProtocolExtensionField<Set<NGAP-PROTOCOL-EXTENSION>>>
这次我们看ProtocolExtensionField的定义:
ProtocolExtensionField {NGAP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= SEQUENCE {
id NGAP-PROTOCOL-EXTENSION.&id ({ExtensionSetParam}),
criticality NGAP-PROTOCOL-EXTENSION.&criticality ({ExtensionSetParam}{@id}),
extensionValue NGAP-PROTOCOL-EXTENSION.&Extension ({ExtensionSetParam}{@id})
}
从这里我们可以看出InformationObjectSet的“约束”作用是什么意思(X.682 Ch.10),这段语义接近于:
public class ProtocolExtensionField<T extends Set<NGAP-PROTOCOL-EXTENSION>> {
public ProtocolExtensionField(ProtocolExtensionID id, Criticality criticality, Object extensionValue) {
assert(T.contains(id));
assert(T[id].CRITICALITY == criticality);
assert(extensionValue instanceof T[id].EXTENSION);
}
}
说到这里我们再回到最初的IE定义:
MBS-DistributionSetupRequestTransfer ::= SEQUENCE {
mBS-SessionID MBS-SessionID,
mBS-AreaSessionID MBS-AreaSessionID OPTIONAL,
sharedNG-U-Unicast-TNL-Information UPTransportLayerInformation OPTIONAL,
iE-Extensions ProtocolExtensionContainer { { MBS-DistributionSetupRequestTransfer-ExtIEs} } OPTIONAL,
...
}
其实就说iE-Extensions是一个数组,其元素必须符合MBS-DistributionSetupRequestTransfer-ExtIEs中定义过的枚举值。而由于MBS-DistributionSetupRequestTransfer-ExtIEs目前是空集合,应该是无法为iE-Extensions定义合法元素的
我们再来看一个类型特化的例子,MBS-DistributionSetupResponseTransfer也即响应的类型
MBS-DistributionSetupResponseTransfer ::= SEQUENCE {
protocolIEs ProtocolIE-Container { {MBS-DistributionSetupResponseTransferIEs} },
...
}
这个形式我们很熟悉了,来看一下ProtocolIE-Container的定义:
ProtocolIE-Container {NGAP-PROTOCOL-IES : IEsSetParam} ::=
SEQUENCE (SIZE (0..maxProtocolIEs)) OF
ProtocolIE-Field {{IEsSetParam}}
NGAP-PROTOCOL-IES ::= CLASS {
&id ProtocolIE-ID UNIQUE,
&criticality Criticality,
&Value,
&presence Presence
}
WITH SYNTAX {
ID &id
CRITICALITY &criticality
TYPE &Value
PRESENCE &presence
}
ProtocolIE-Field {NGAP-PROTOCOL-IES : IEsSetParam} ::= SEQUENCE {
id NGAP-PROTOCOL-IES.&id ({IEsSetParam}),
criticality NGAP-PROTOCOL-IES.&criticality ({IEsSetParam}{@id}),
value NGAP-PROTOCOL-IES.&Value ({IEsSetParam}{@id})
}
特化使用的枚举集合定义为:
MBS-DistributionSetupResponseTransferIEs NGAP-PROTOCOL-IES ::= {
{ ID id-MBS-SessionID CRITICALITY reject TYPE MBS-SessionID PRESENCE mandatory }|
{ ID id-MBS-AreaSessionID CRITICALITY reject TYPE MBS-AreaSessionID PRESENCE optional }|
{ ID id-SharedNG-U-Multicast-TNL-Information CRITICALITY reject TYPE SharedNG-U-Multicast-TNL-Information PRESENCE optional }|
{ ID id-Alternative-SharedNG-U-Multicast-TNL-Information CRITICALITY ignore TYPE SharedNG-U-Multicast-TNL-Information PRESENCE optional }|
{ ID id-MBS-QoSFlows-ToBeSetupList CRITICALITY reject TYPE MBS-QoSFlows-ToBeSetupList PRESENCE mandatory }|
{ ID id-MBSSessionStatus CRITICALITY reject TYPE MBSSessionStatus PRESENCE mandatory }|
{ ID id-MBS-ServiceArea CRITICALITY reject TYPE MBS-ServiceArea PRESENCE optional },
...
}
有疑问的一点是Presence在这里似乎没有办法检验?
APER编解码
于38.413 Ch.9.5指出NGAP协议使用Aligned Basic PER作为编解码规范,此规范定义于X.691
MBS-DistributionSetupRequestTransfer编码
我们尝试从MBS-DistributionSetupRequestTransfer的编码开始,MBS-DistributionSetupRequestTransfer的定义为:
MBS-DistributionSetupRequestTransfer ::= SEQUENCE {
mBS-SessionID MBS-SessionID,
mBS-AreaSessionID MBS-AreaSessionID OPTIONAL,
sharedNG-U-Unicast-TNL-Information UPTransportLayerInformation OPTIONAL,
iE-Extensions ProtocolExtensionContainer { { MBS-DistributionSetupRequestTransfer-ExtIEs} } OPTIONAL,
...
}
是一个SEQUENCE类型,参考X.691 Ch.19 Encoding the sequence type
根据X.691 Ch.19.1,如果SEQUENCE有extension marker(即...),则第1个bit(称作extension bit)用于指定数据是否携带extension additions
由于MBS-DistributionSetupRequestTransfer并未定义任何extension additions,所以此bit总应置0
根据X.691 Ch.19.2,如果SEQUENCE中有n个带有OPTIONAL或DEFAULT标记的字段,就应有n个bit用于记录对应字段是否存在
对MBS-DistributionSetupRequestTransfer来说,就应是3个bit位
根据X.691 Ch.19.4,从第5个bit开始应逐个编码对应字段
mBS-SessionID编码
看第一个字段类型MBS-SessionID及相关定义:
MBS-SessionID ::= SEQUENCE {
tMGI TMGI,
nID NID OPTIONAL,
iE-Extensions ProtocolExtensionContainer { {MBS-SessionID-ExtIEs} } OPTIONAL,
...
}
TMGI ::= OCTET STRING (SIZE(6))
NID ::= BIT STRING (SIZE(44))
MBS-SessionID-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
...
}
MBS-SessionID是SEQUENCE类型,所以同样地,第5个bit是extension bit,第6,7个bit代表nID和iE-Extensions是否出现
由于MBS-SessionID-ExtIEs这个约束集合是空的,目前没有合法的iE-Extensions,所以第7个bit总应是0
tMGI编码
从第8个bit开始编码tMGI,参考X.691 Ch.17 Encoding the octetstring type
根据X.691 Ch.17.7,2<长度<64K的定长OCTET STRING要字节对齐,无length determinant(长度指示符)
所以tMGI从第2个字节开始编码,即第2,3,4,5,6,7个字节,第1字节的第8bit填充0
nID编码
第8个字节开始编码nID(如果存在),参考X.691 Ch.16 Encoding the bitstring type
根据X.691 Ch.16.10,16bit<长度<64K bit的BIT STRING要字节对齐,无长度指示符
所以第8,9,10,11,12字节,以及第13字节的前4个bit用于编码nID
根据X.691 Ch.16.3,如果nID之后没有字段需要编码了,并且第13个字节的前4个bit都是0,则第13个字节可以省略,整体消息编码结束
mBS-AreaSessionID编码
再看下一个例子,MBS-AreaSessionID的定义为:
MBS-AreaSessionID ::= INTEGER (0..65535, ...)
假设mBS-SessionID到第13字节第4bit为止,则mBS-AreaSessionID的编码从第13字节第5bit开始
INTEGER的编码参考X.691 Ch.13 Encoding the integer type
根据X.691 Ch.13.1,INTERGER的约束中有extension marker时,应有1个bit表明此INTEGER实际值是否超出约束范围
在此例子中即第13字节第5bit:
- 若置0代表mBS-SessionID实际值在约束0..65535之间
- 若置1则需要按无约束的
INTEGER规则进行编码,参考X.691 13.2.4~13.2.6
按约束编码
0..65535的范围参考X.691 Ch.13.2.2,跳转到X.691 Ch.11.5 Encoding of a constrained whole number,适用于X.691 Ch.11.5.7.3
根据X.691 Ch.11.5.7.3,实际值在0..65535之间的mBS-SessionID将按照2个字节的非负整数进行编码(字节对齐),也即第14,15个字节用于编码mBS-SessionID,第13字节的第6,7,8bit置0
无约束编码
但是若mBS-SessionID实际值范围不在0..65535之间,即第13字节第5bit为1时,mBS-SessionID将作为无约束整数进行编码
根据X.691 Ch.13.2.4,无约束整数参考X.691 Ch.11.8 Encoding of an unconstrained whole number规则进行编码
根据X.691 Ch.11.8,无约束整数以2的补码方式编码,并且有长度指示符
长度指示符的编码规则在X.691 Ch.11.9 General rules for encoding a length determinant指出
从X.691 Ch.11.9.3.6开始对无约束整数编码长度指示符的描述,实际上这种编码很类似UTF-8的原理:
| 值长度 | 长度指示符 |
|---|---|
| <=127 | 单个字节,bit8置0,其余7个bit作非负整数编码 |
| 127<l<16K | 2个字节,bit16置1,bit15置0,剩余14个bit作非负整数编码 |
| >16K | 单个字节,bit8,7置1,剩余6个比特可选值为1,2,3,4,代表后面跟着最多16K*4的值,然后再次插入长度指示符,直到分片结束 |
>16K的情况有个图可以很好地说明:
sharedNG-U-Unicast-TNL-Information编码
UPTransportLayerInformation类型及相关定义:
UPTransportLayerInformation ::= CHOICE {
gTPTunnel GTPTunnel,
choice-Extensions ProtocolIE-SingleContainer { {UPTransportLayerInformation-ExtIEs} }
}
CHOICE类型编码参考X.691 Ch.23 Encoding the choice type
根据X.691 Ch.23.6,首先将选中的项序号作为有约束整数编码,然后再跟上对应项的编码
由于一共只有2项,所以可选项的序号为0..1,根据X.691 Ch.15.7.5.1使用1个bit编码
gTPTunnel编码
GTPTunnel ::= SEQUENCE {
transportLayerAddress TransportLayerAddress,
gTP-TEID GTP-TEID,
iE-Extensions ProtocolExtensionContainer { {GTPTunnel-ExtIEs} } OPTIONAL,
...
}
TransportLayerAddress ::= BIT STRING (SIZE(1..160, ...))
GTP-TEID ::= OCTET STRING (SIZE(4))
GTPTunnel-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
...
}
这段定义没多少特殊的,只说一下TransportLayerAddress这个带extension marker的BIT STRING怎么编码
根据X.691 Ch.16.6,带有extension marker的BIT STRING第一个bit是extension bit,若置1代表实际值不在约束范围中
若extension bit置0,代表transportLayerAddress实际长度在约束1..160中,根据X.691 Ch.16.11应先将长度指示符作为有约束整数编码,参考X.691 Ch.11.9.3.3,1.。160的长度应使用8个bit进行编码,之后应以字节对齐的方式接上transportLayerAddress的实际值
若extension bit置1,首先应将长度指示符作为半约束整数编码,参考X.691 Ch.11.9.3.6~,以字节对齐方式插入长度指示符,再以字节对齐方式接上transportLayerAddress的实际值
choice-Extensions编码
由于UPTransportLayerInformation-ExtIEs目前是空集合,不存在合法的choice-Extensions实例,所以不考虑编码
ProtocolIE-SingleContainer {NGAP-PROTOCOL-IES : IEsSetParam} ::=
ProtocolIE-Field {{IEsSetParam}}
ProtocolIE-Field {NGAP-PROTOCOL-IES : IEsSetParam} ::= SEQUENCE {
id NGAP-PROTOCOL-IES.&id ({IEsSetParam}),
criticality NGAP-PROTOCOL-IES.&criticality ({IEsSetParam}{@id}),
value NGAP-PROTOCOL-IES.&Value ({IEsSetParam}{@id})
}
UPTransportLayerInformation-ExtIEs NGAP-PROTOCOL-IES ::= {
...
}
MBS-DistributionSetupResponseTransfer
再来看一个复杂些的例子,响应类型MBS-DistributionSetupResponseTransfer的定义为:
MBS-DistributionSetupResponseTransfer ::= SEQUENCE {
protocolIEs ProtocolIE-Container { {MBS-DistributionSetupResponseTransferIEs} },
...
}
ProtocolIE-Container {NGAP-PROTOCOL-IES : IEsSetParam} ::=
SEQUENCE (SIZE (0..maxProtocolIEs)) OF
ProtocolIE-Field {{IEsSetParam}}
NGAP-PROTOCOL-IES ::= CLASS {
&id ProtocolIE-ID UNIQUE,
&criticality Criticality,
&Value,
&presence Presence
}
WITH SYNTAX {
ID &id
CRITICALITY &criticality
TYPE &Value
PRESENCE &presence
}
ProtocolIE-Field {NGAP-PROTOCOL-IES : IEsSetParam} ::= SEQUENCE {
id NGAP-PROTOCOL-IES.&id ({IEsSetParam}),
criticality NGAP-PROTOCOL-IES.&criticality ({IEsSetParam}{@id}),
value NGAP-PROTOCOL-IES.&Value ({IEsSetParam}{@id})
}
MBS-DistributionSetupResponseTransferIEs NGAP-PROTOCOL-IES ::= {
{ ID id-MBS-SessionID CRITICALITY reject TYPE MBS-SessionID PRESENCE mandatory }|
{ ID id-MBS-AreaSessionID CRITICALITY reject TYPE MBS-AreaSessionID PRESENCE optional }|
{ ID id-SharedNG-U-Multicast-TNL-Information CRITICALITY reject TYPE SharedNG-U-Multicast-TNL-Information PRESENCE optional }|
{ ID id-Alternative-SharedNG-U-Multicast-TNL-Information CRITICALITY ignore TYPE SharedNG-U-Multicast-TNL-Information PRESENCE optional }|
{ ID id-MBS-QoSFlows-ToBeSetupList CRITICALITY reject TYPE MBS-QoSFlows-ToBeSetupList PRESENCE mandatory }|
{ ID id-MBSSessionStatus CRITICALITY reject TYPE MBSSessionStatus PRESENCE mandatory }|
{ ID id-MBS-ServiceArea CRITICALITY reject TYPE MBS-ServiceArea PRESENCE optional },
...
}
同样的,首先编码MBS-DistributionSetupResponseTransfer的extension bit
然后是protocolIEs是一个SEQUENCE OF类型,参考X.691 Ch.20 Encoding the sequence-of type
根据X.691 Ch.20.6,编码双字节的长度指示符,然后跟上数组元素
数组元素是ProtocolIE-Field类型,即SEQUENCE类型,无extension marker和optional,即无preamble
值得一提的是Criticality是ENUMERATED类型,根据X.691 Ch.14 Encoding the enumerated type,其中的枚举项应该以升序排列,并按有约束整数编码其序号(?)
还有一点需要注意,ProtocolIE-Field中的value是按照OpenType进行编码的,参考X.691 Ch.11.2 Open type fields要先编码无约束长度指示符再加上实际值
实践
使用online ASN.1的工具来验证编码是否正确: asn1.io/asn1playgro…
MBS-DistributionSetupRequestTransfer编码
输入schema并编译:
--<ASN1.HugeInteger World-Schema.Rocket.range>--
World-Schema DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
MBS-DistributionSetupRequestTransfer ::= SEQUENCE {
mBS-SessionID MBS-SessionID,
mBS-AreaSessionID MBS-AreaSessionID OPTIONAL,
sharedNG-U-Unicast-TNL-Information UPTransportLayerInformation OPTIONAL,
iE-Extensions ProtocolExtensionContainer { { MBS-DistributionSetupRequestTransfer-ExtIEs} } OPTIONAL,
...
}
MBS-SessionID ::= SEQUENCE {
tMGI TMGI,
nID NID OPTIONAL,
iE-Extensions ProtocolExtensionContainer { {MBS-SessionID-ExtIEs} } OPTIONAL,
...
}
TMGI ::= OCTET STRING (SIZE(6))
NID ::= BIT STRING (SIZE(44))
ProtocolExtensionContainer {NGAP-PROTOCOL-EXTENSION : ExtensionSetParam} ::=
SEQUENCE (SIZE (1..maxProtocolExtensions)) OF
ProtocolExtensionField {{ExtensionSetParam}}
maxProtocolExtensions INTEGER ::= 65535
NGAP-PROTOCOL-EXTENSION ::= CLASS {
&id ProtocolExtensionID UNIQUE,
&criticality Criticality,
&Extension,
&presence Presence
}
WITH SYNTAX {
ID &id
CRITICALITY &criticality
EXTENSION &Extension
PRESENCE &presence
}
ProtocolExtensionID ::= INTEGER (0..65535)
Criticality ::= ENUMERATED { reject, ignore, notify }
Presence ::= ENUMERATED { optional, conditional, mandatory }
ProtocolExtensionField {NGAP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= SEQUENCE {
id NGAP-PROTOCOL-EXTENSION.&id ({ExtensionSetParam}),
criticality NGAP-PROTOCOL-EXTENSION.&criticality ({ExtensionSetParam}{@id}),
extensionValue NGAP-PROTOCOL-EXTENSION.&Extension ({ExtensionSetParam}{@id})
}
MBS-SessionID-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
...
}
MBS-AreaSessionID ::= INTEGER (0..65535, ...)
UPTransportLayerInformation ::= CHOICE {
gTPTunnel GTPTunnel,
choice-Extensions ProtocolIE-SingleContainer { {UPTransportLayerInformation-ExtIEs} }
}
GTPTunnel ::= SEQUENCE {
transportLayerAddress TransportLayerAddress,
gTP-TEID GTP-TEID,
iE-Extensions ProtocolExtensionContainer { {GTPTunnel-ExtIEs} } OPTIONAL,
...
}
TransportLayerAddress ::= BIT STRING (SIZE(1..160, ...))
GTP-TEID ::= OCTET STRING (SIZE(4))
GTPTunnel-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
...
}
ProtocolIE-SingleContainer {NGAP-PROTOCOL-IES : IEsSetParam} ::=
ProtocolIE-Field {{IEsSetParam}}
NGAP-PROTOCOL-IES ::= CLASS {
&id ProtocolIE-ID UNIQUE,
&criticality Criticality,
&Value,
&presence Presence
}
WITH SYNTAX {
ID &id
CRITICALITY &criticality
TYPE &Value
PRESENCE &presence
}
ProtocolIE-Field {NGAP-PROTOCOL-IES : IEsSetParam} ::= SEQUENCE {
id NGAP-PROTOCOL-IES.&id ({IEsSetParam}),
criticality NGAP-PROTOCOL-IES.&criticality ({IEsSetParam}{@id}),
value NGAP-PROTOCOL-IES.&Value ({IEsSetParam}{@id})
}
ProtocolIE-ID ::= INTEGER (0..65535)
UPTransportLayerInformation-ExtIEs NGAP-PROTOCOL-IES ::= {
...
}
MBS-DistributionSetupRequestTransfer-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
...
}
END
输入值(自选示例值)并encode:
value MBS-DistributionSetupRequestTransfer ::= {
mBS-SessionID {
tMGI '112233445566'H
},
mBS-AreaSessionID 922,
sharedNG-U-Unicast-TNL-Information gTPTunnel : {
transportLayerAddress '010010011'B,
gTP-TEID 'AABBCCDD'H
}
}
APER方式得到的编码为:6011 2233 4455 6600 039a 0080 4980 aabb ccdd,我们来看一下是否符合上述理解:
| bit位 | Binary | Hex | 解释 |
|---|---|---|---|
| 1-4 | 0110 | 6 | 0: MBS-DistributionSetupRequestTransfer层无extension addition 1: OPTIONAL mBS-AreaSessionID存在 1: OPTIONAL sharedNG-U-Unicast-TNL-Information存在 0: OPTIONAL iE-Extensions不存在 |
| 5-8 | 0000 | 0 | 0: MBS-SessionID层无extension addition 0: OPTIONAL nID不存在 0: OPTIONAL iE-Extensions不存在 0: 由于后面tMGI的编码要求字节对齐而产生的填充位 |
| 9-56 | 112233445566 | tMGI的值 | |
| 57-64 | 00000000 | 00 | 0: mBS-AreaSessionID的值在约束中 0000000: 由于mBS-AreaSessionID双字节编码要求字节对齐而产生的填充位 |
| 65-80 | 039a | mBS-AreaSessionID的值 | |
| 81-88 | 00000000 | 00 | 0: 选择UPTransportLayerInformation第0项choice 0: GTPTunnel层无extension addition 0: GTPTunnel的OPTIONAL iE-Extensions不存在 0: TransportLayerAddress的值在约束中 0000: 由于编码TransportLayerAddress的长度指示符需要字节对齐而产生的填充位 |
| 89-96 | 10000000 | 80 | 这里我不理解为什么是80,最大range 160,应当使用8bit编码长度,实际长度为9,所以应编码9-1=8,编码应为0x08 |
| 97-112 | 0100100110000000 | 4980 | 010010011: transportLayerAddress的值 0000000: 由于后面GTP-TEID要求字节对齐而产生的填充位 |
| 113-144 | aabbccdd | gTP-TEID的值 |
MBS-DistributionSetupResponseTransfer编码
输入schema并编译:
--<ASN1.HugeInteger World-Schema.Rocket.range>--
World-Schema DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
MBS-DistributionSetupResponseTransfer ::= SEQUENCE {
protocolIEs ProtocolIE-Container { {MBS-DistributionSetupResponseTransferIEs} },
...
}
ProtocolIE-Container {NGAP-PROTOCOL-IES : IEsSetParam} ::=
SEQUENCE (SIZE (0..maxProtocolIEs)) OF
ProtocolIE-Field {{IEsSetParam}}
maxProtocolIEs INTEGER ::= 65535
NGAP-PROTOCOL-IES ::= CLASS {
&id ProtocolIE-ID UNIQUE,
&criticality Criticality,
&Value,
&presence Presence
}
WITH SYNTAX {
ID &id
CRITICALITY &criticality
TYPE &Value
PRESENCE &presence
}
ProtocolIE-ID ::= INTEGER (0..65535)
ProtocolIE-Field {NGAP-PROTOCOL-IES : IEsSetParam} ::= SEQUENCE {
id NGAP-PROTOCOL-IES.&id ({IEsSetParam}),
criticality NGAP-PROTOCOL-IES.&criticality ({IEsSetParam}{@id}),
value NGAP-PROTOCOL-IES.&Value ({IEsSetParam}{@id})
}
MBS-DistributionSetupResponseTransferIEs NGAP-PROTOCOL-IES ::= {
{ ID id-MBS-SessionID CRITICALITY reject TYPE MBS-SessionID PRESENCE mandatory }|
{ ID id-MBS-AreaSessionID CRITICALITY reject TYPE MBS-AreaSessionID PRESENCE optional }|
{ ID id-SharedNG-U-Multicast-TNL-Information CRITICALITY reject TYPE SharedNG-U-Multicast-TNL-Information PRESENCE optional }|
{ ID id-Alternative-SharedNG-U-Multicast-TNL-Information CRITICALITY ignore TYPE SharedNG-U-Multicast-TNL-Information PRESENCE optional }|
{ ID id-MBS-QoSFlows-ToBeSetupList CRITICALITY reject TYPE MBS-QoSFlows-ToBeSetupList PRESENCE mandatory }|
{ ID id-MBSSessionStatus CRITICALITY reject TYPE MBSSessionStatus PRESENCE mandatory }|
{ ID id-MBS-ServiceArea CRITICALITY reject TYPE MBS-ServiceArea PRESENCE optional },
...
}
id-MBS-SessionID ProtocolIE-ID ::= 299
id-MBS-AreaSessionID ProtocolIE-ID ::= 295
id-SharedNG-U-Multicast-TNL-Information ProtocolIE-ID ::= 321
id-Alternative-SharedNG-U-Multicast-TNL-Information ProtocolIE-ID ::= 308
id-MBS-QoSFlows-ToBeSetupList ProtocolIE-ID ::= 296
id-MBSSessionStatus ProtocolIE-ID ::= 320
id-MBS-ServiceArea ProtocolIE-ID ::= 298
MBS-SessionID ::= SEQUENCE {
tMGI TMGI,
nID NID OPTIONAL,
iE-Extensions ProtocolExtensionContainer { {MBS-SessionID-ExtIEs} } OPTIONAL,
...
}
TMGI ::= OCTET STRING (SIZE(6))
NID ::= BIT STRING (SIZE(44))
ProtocolExtensionContainer {NGAP-PROTOCOL-EXTENSION : ExtensionSetParam} ::=
SEQUENCE (SIZE (1..maxProtocolExtensions)) OF
ProtocolExtensionField {{ExtensionSetParam}}
maxProtocolExtensions INTEGER ::= 65535
NGAP-PROTOCOL-EXTENSION ::= CLASS {
&id ProtocolExtensionID UNIQUE,
&criticality Criticality,
&Extension,
&presence Presence
}
WITH SYNTAX {
ID &id
CRITICALITY &criticality
EXTENSION &Extension
PRESENCE &presence
}
ProtocolExtensionID ::= INTEGER (0..65535)
Criticality ::= ENUMERATED { reject, ignore, notify }
Presence ::= ENUMERATED { optional, conditional, mandatory }
ProtocolExtensionField {NGAP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= SEQUENCE {
id NGAP-PROTOCOL-EXTENSION.&id ({ExtensionSetParam}),
criticality NGAP-PROTOCOL-EXTENSION.&criticality ({ExtensionSetParam}{@id}),
extensionValue NGAP-PROTOCOL-EXTENSION.&Extension ({ExtensionSetParam}{@id})
}
MBS-SessionID-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
...
}
MBS-AreaSessionID ::= INTEGER (0..65535, ...)
SharedNG-U-Multicast-TNL-Information ::= SEQUENCE {
iP-MulticastAddress TransportLayerAddress,
iP-SourceAddress TransportLayerAddress,
gTP-TEID GTP-TEID,
iE-Extensions ProtocolExtensionContainer { {SharedNG-U-Multicast-TNL-Information-ExtIEs} } OPTIONAL,
...
}
TransportLayerAddress ::= BIT STRING (SIZE(1..160, ...))
GTP-TEID ::= OCTET STRING (SIZE(4))
SharedNG-U-Multicast-TNL-Information-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
...
}
MBS-QoSFlows-ToBeSetupList ::= SEQUENCE (SIZE(1.. maxnoofMBSQoSFlows)) OF MBS-QoSFlows-ToBeSetupItem
maxnoofMBSQoSFlows INTEGER ::= 64
MBS-QoSFlows-ToBeSetupItem ::= SEQUENCE {
mBSqosFlowIdentifier QosFlowIdentifier,
mBSqosFlowLevelQosParameters QosFlowLevelQosParameters,
iE-Extensions ProtocolExtensionContainer { {MBS-QoSFlows-ToBeSetupItem-ExtIEs} } OPTIONAL,
...
}
QosFlowIdentifier ::= INTEGER (0..63, ...)
QosFlowLevelQosParameters ::= SEQUENCE {
qosCharacteristics QosCharacteristics,
allocationAndRetentionPriority AllocationAndRetentionPriority,
gBR-QosInformation GBR-QosInformation OPTIONAL,
reflectiveQosAttribute ReflectiveQosAttribute OPTIONAL,
additionalQosFlowInformation AdditionalQosFlowInformation OPTIONAL,
iE-Extensions ProtocolExtensionContainer { {QosFlowLevelQosParameters-ExtIEs} } OPTIONAL,
...
}
QosCharacteristics ::= CHOICE {
nonDynamic5QI NonDynamic5QIDescriptor,
dynamic5QI Dynamic5QIDescriptor,
choice-Extensions ProtocolIE-SingleContainer { {QosCharacteristics-ExtIEs} }
}
NonDynamic5QIDescriptor ::= SEQUENCE {
fiveQI FiveQI,
priorityLevelQos PriorityLevelQos OPTIONAL,
averagingWindow AveragingWindow OPTIONAL,
maximumDataBurstVolume MaximumDataBurstVolume OPTIONAL,
iE-Extensions ProtocolExtensionContainer { {NonDynamic5QIDescriptor-ExtIEs} } OPTIONAL,
...
}
FiveQI ::= INTEGER (0..255, ...)
PriorityLevelQos ::= INTEGER (1..127, ...)
AveragingWindow ::= INTEGER (0..4095, ...)
MaximumDataBurstVolume ::= INTEGER (0..4095, ..., 4096.. 2000000)
NonDynamic5QIDescriptor-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
{ ID id-CNPacketDelayBudgetDL CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }|
{ ID id-CNPacketDelayBudgetUL CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional },
...
}
id-CNPacketDelayBudgetDL ProtocolIE-ID ::= 187
id-CNPacketDelayBudgetUL ProtocolIE-ID ::= 188
ExtendedPacketDelayBudget ::= INTEGER (1..65535, ...)
Dynamic5QIDescriptor ::= SEQUENCE {
priorityLevelQos PriorityLevelQos,
packetDelayBudget PacketDelayBudget,
packetErrorRate PacketErrorRate,
fiveQI FiveQI OPTIONAL,
delayCritical DelayCritical OPTIONAL,
-- The above IE shall be present in case of GBR QoS flow
averagingWindow AveragingWindow OPTIONAL,
-- The above IE shall be present in case of GBR QoS flow
maximumDataBurstVolume MaximumDataBurstVolume OPTIONAL,
iE-Extensions ProtocolExtensionContainer { {Dynamic5QIDescriptor-ExtIEs} } OPTIONAL,
...
}
PacketDelayBudget ::= INTEGER (0..1023, ...)
PacketErrorRate ::= SEQUENCE {
pERScalar INTEGER (0..9, ...),
pERExponent INTEGER (0..9, ...),
iE-Extensions ProtocolExtensionContainer { {PacketErrorRate-ExtIEs} } OPTIONAL,
...
}
PacketErrorRate-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
...
}
DelayCritical ::= ENUMERATED {
delay-critical,
non-delay-critical,
...
}
Dynamic5QIDescriptor-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
{ ID id-ExtendedPacketDelayBudget CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }|
{ ID id-CNPacketDelayBudgetDL CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }|
{ ID id-CNPacketDelayBudgetUL CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional },
...
}
id-ExtendedPacketDelayBudget ProtocolIE-ID ::= 189
ProtocolIE-SingleContainer {NGAP-PROTOCOL-IES : IEsSetParam} ::=
ProtocolIE-Field {{IEsSetParam}}
QosCharacteristics-ExtIEs NGAP-PROTOCOL-IES ::= {
...
}
AllocationAndRetentionPriority ::= SEQUENCE {
priorityLevelARP PriorityLevelARP,
pre-emptionCapability Pre-emptionCapability,
pre-emptionVulnerability Pre-emptionVulnerability,
iE-Extensions ProtocolExtensionContainer { {AllocationAndRetentionPriority-ExtIEs} } OPTIONAL,
...
}
PriorityLevelARP ::= INTEGER (1..15)
Pre-emptionCapability ::= ENUMERATED {
shall-not-trigger-pre-emption,
may-trigger-pre-emption,
...
}
Pre-emptionVulnerability ::= ENUMERATED {
not-pre-emptable,
pre-emptable,
...
}
AllocationAndRetentionPriority-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
...
}
GBR-QosInformation ::= SEQUENCE {
maximumFlowBitRateDL BitRate,
maximumFlowBitRateUL BitRate,
guaranteedFlowBitRateDL BitRate,
guaranteedFlowBitRateUL BitRate,
notificationControl NotificationControl OPTIONAL,
maximumPacketLossRateDL PacketLossRate OPTIONAL,
maximumPacketLossRateUL PacketLossRate OPTIONAL,
iE-Extensions ProtocolExtensionContainer { {GBR-QosInformation-ExtIEs} } OPTIONAL,
...
}
BitRate ::= INTEGER (0..4000000000000, ...)
NotificationControl ::= ENUMERATED {
notification-requested,
...
}
PacketLossRate ::= INTEGER (0..1000, ...)
GBR-QosInformation-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
{ ID id-AlternativeQoSParaSetList CRITICALITY ignore EXTENSION AlternativeQoSParaSetList PRESENCE optional },
...
}
id-AlternativeQoSParaSetList ProtocolIE-ID ::= 220
AlternativeQoSParaSetList ::= SEQUENCE (SIZE(1..maxnoofQosParaSets)) OF AlternativeQoSParaSetItem
maxnoofQosParaSets INTEGER ::= 8
AlternativeQoSParaSetItem ::= SEQUENCE {
alternativeQoSParaSetIndex AlternativeQoSParaSetIndex,
guaranteedFlowBitRateDL BitRate OPTIONAL,
guaranteedFlowBitRateUL BitRate OPTIONAL,
packetDelayBudget PacketDelayBudget OPTIONAL,
packetErrorRate PacketErrorRate OPTIONAL,
iE-Extensions ProtocolExtensionContainer { {AlternativeQoSParaSetItem-ExtIEs} } OPTIONAL,
...
}
AlternativeQoSParaSetIndex ::= INTEGER (1..8, ...)
AlternativeQoSParaSetItem-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
...
}
ReflectiveQosAttribute ::= ENUMERATED {
subject-to,
...
}
AdditionalQosFlowInformation ::= ENUMERATED {
more-likely,
...
}
QosFlowLevelQosParameters-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
{ID id-QosMonitoringRequest CRITICALITY ignore EXTENSION QosMonitoringRequest PRESENCE optional}|
{ID id-QosMonitoringReportingFrequency CRITICALITY ignore EXTENSION QosMonitoringReportingFrequency PRESENCE optional},
...
}
id-QosMonitoringRequest ProtocolIE-ID ::= 181
id-QosMonitoringReportingFrequency ProtocolIE-ID ::= 276
QosMonitoringRequest ::= ENUMERATED {ul, dl, both, ..., stop}
QosMonitoringReportingFrequency ::= INTEGER (1..1800, ...)
MBS-QoSFlows-ToBeSetupItem-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
...
}
MBSSessionStatus ::= ENUMERATED {
activated,
deactivated,
...
}
MBS-ServiceArea ::= CHOICE {
locationindependent MBS-ServiceAreaInformation,
locationdependent MBS-ServiceAreaInformationList,
choice-Extensions ProtocolIE-SingleContainer { {MBS-ServiceArea-ExtIEs} }
}
MBS-ServiceAreaInformation ::= SEQUENCE {
mBS-ServiceAreaCellList MBS-ServiceAreaCellList OPTIONAL,
mBS-ServiceAreaTAIList MBS-ServiceAreaTAIList OPTIONAL,
iE-Extensions ProtocolExtensionContainer { {MBS-ServiceAreaInformation-ExtIEs} } OPTIONAL,
...
}
MBS-ServiceAreaCellList ::= SEQUENCE (SIZE(1.. maxnoofCellsforMBS)) OF NR-CGI
maxnoofCellsforMBS INTEGER ::= 8192
NR-CGI ::= SEQUENCE {
pLMNIdentity PLMNIdentity,
nRCellIdentity NRCellIdentity,
iE-Extensions ProtocolExtensionContainer { {NR-CGI-ExtIEs} } OPTIONAL,
...
}
PLMNIdentity ::= OCTET STRING (SIZE(3))
NRCellIdentity ::= BIT STRING (SIZE(36))
NR-CGI-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
...
}
MBS-ServiceAreaTAIList ::= SEQUENCE (SIZE(1.. maxnoofTAIforMBS)) OF TAI
maxnoofTAIforMBS INTEGER ::= 1024
TAI ::= SEQUENCE {
pLMNIdentity PLMNIdentity,
tAC TAC,
iE-Extensions ProtocolExtensionContainer { {TAI-ExtIEs} } OPTIONAL,
...
}
TAC ::= OCTET STRING (SIZE(3))
TAI-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
...
}
MBS-ServiceAreaInformation-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
...
}
MBS-ServiceAreaInformationList ::= SEQUENCE (SIZE(1..maxnoofMBSServiceAreaInformation)) OF MBS-ServiceAreaInformation
maxnoofMBSServiceAreaInformation INTEGER ::= 256 -- FFS
MBS-ServiceArea-ExtIEs NGAP-PROTOCOL-IES ::= {
...
}
END
输入值(自选示例值)并encode:
value MBS-DistributionSetupResponseTransfer ::= {
protocolIEs {
{
id id-MBS-SessionID,
criticality reject,
value MBS-SessionID : {
tMGI '112233445566'H
}
},
{
id id-MBS-AreaSessionID,
criticality reject,
value MBS-AreaSessionID : 922
},
{
id id-MBS-QoSFlows-ToBeSetupList,
criticality reject,
value MBS-QoSFlows-ToBeSetupList : {
{
mBSqosFlowIdentifier 7,
mBSqosFlowLevelQosParameters {
qosCharacteristics nonDynamic5QI : {
fiveQI 126
},
allocationAndRetentionPriority {
priorityLevelARP 13,
pre-emptionCapability shall-not-trigger-pre-emption,
pre-emptionVulnerability not-pre-emptable
}
}
}
}
},
{
id id-MBSSessionStatus,
criticality reject,
value MBSSessionStatus : deactivated
}
}
}
APER方式得到的编码为:0000 0401 2b00 0700 1122 3344 5566 0127 0003 0003 9a01 2800 0700 0e00 007e 3000 0140 0001 40,我们来看一下是否符合上述理解:
| bit位 | Binary | Hex | 解释 |
|---|---|---|---|
| 1-8 | 00000000 | 00 | 0: MBS-DistributionSetupResponseTransfer层无extension addition 0000000: 由于protocolIEs的长度指示符为双字节编码要求字节对齐而产生的填充位 |
| 9-24 | 0004 | 双字节编码长度指示符: 4 | |
| 25-40 | 012b | 双字节编码id: id-MBS-SessionID(299) | |
| 41-48 | 00000000 | 00 | 00: criticality枚举值需要2个bit编码,00是第一项reject 000000: 由于OpenType无约束长度指示符要求字节对齐而产生的填充位 |
| 49-56 | 07 | OpenType无约束长度指示符,代表MBS-SessionID长度为7个字节 | |
| 57-64 | 00000000 | 00 | 0: MBS-SessionID层无extension addition 0: OPTIONAL nID不存在 0: OPTIONAL iE-Extensions不存在 00000: 由于后面tMGI的编码要求字节对齐而产生的填充位 |
| 65-112 | 112233445566 | tMGI的值 | |
| 113-128 | 0127 | 双字节编码id: id-MBS-AreaSessionID(295) | |
| 129-136 | 00000000 | 00 | 00: criticality reject 000000: 由于OpenType无约束长度指示符要求字节对齐而产生的填充位 |
| 137-144 | 03 | OpenType无约束长度指示符,代表mBS-AreaSessionID长度为3个字节 | |
| 145-152 | 00000000 | 00 | 0: mBS-AreaSessionID的值在约束中 0000000: 由于mBS-AreaSessionID双字节编码要求字节对齐而产生的填充位 |
| 153-168 | 039a | mBS-AreaSessionID的值 | |
| 169-184 | 0128 | 双字节编码id: id-MBS-QoSFlows-ToBeSetupList(296) | |
| 185-192 | 00000000 | 00 | 00: criticality reject 000000: 由于OpenType无约束长度指示符要求字节对齐而产生的填充位 |
| 193-200 | 00000111 | 07 | OpenType无约束长度指示符,代表MBS-QoSFlows-ToBeSetupList长度为7个字节 |
| 201-232 | 00000000000011100000000000000000 | 000e0000 | 000000: MBS-QoSFlows-ToBeSetupList最大长度是64,所以长度指示符为6bit,实际长度为1,所以编码1-1=0 0: MBS-QoSFlows-ToBeSetupItem无extention addition 0: OPTIONAL iE-Extensions不存在 0: QosFlowIdentifier值在约束中 000111: QosFlowIdentifier最大长度为64,用6bit编码(7) 0: QosFlowLevelQosParameters无extension addition 0000: 4个OPTIONAL均不存在 00: QosCharacteristics choice用2bit编码,选中00(nonDynamic5QI) 0: NonDynamic5QIDescriptor无extension addition 0000: 4个OPTIONAL均不存在 0: FiveQI值在约束中 000: FiveQI单字节编码要求字节对齐而产生的填充位 |
| 233-240 | 7e | 单字节编码FiveQI(126) | |
| 241-256 | 0011000000000000 | 3000 | 0: AllocationAndRetentionPriority无extension addition 0: OPTIONAL不存在 1100: 4bit编码PriorityLevelARP(13-1=12) 0: Pre-emptionCapability无extension addition 0: 1bit编码Pre-emptionCapability(shall-not-trigger-pre-emption) 0: Pre-emptionVulnerability无extension addition 0: 1bit编码Pre-emptionVulnerability(not-pre-emptable) 000000: 由于双字节编码id-MBSSessionStatus而产生的填充位 |
| 257-272 | 0140 | 双字节编码id: id-MBSSessionStatus(320) | |
| 273-280 | 00000000 | 00 | 00: criticality reject 000000: 由于OpenType无约束长度指示符要求字节对齐而产生的填充位 |
| 281-288 | 01 | OpenType无约束长度指示符,代表MBSSessionStatus长度为1个字节 | |
| 289-296 | 01000000 | 40 | 0: MBSSessionStatus无extension additon 1: 1bit编码MBSSessionStatus(deactivated) 000000: 填充满1个字节 |
参考资料
X.680: Specification of basic notation
X.681: Information object specification
X.682: Constraint specification