Quick 3GPP RRC ASN.1
Seokseong Jeon
DISCLAIMER
• This is a simplified introduction to encoding rule used by 3GPP RRC protocol.
The most practical examples are captured and not every single rule is treated.
Encoding Rule
• 3GPP uses Unaligned variant of Packed Encoding Rule (PER)
• In unaligned variant, each field is not aligned at octet boundary
• Therefore, zero-pad is used only at the end of message
• PER is insensitive to field name
• Both are considered to be same
• Reference: ITU-T X.691
sequenceType SEQUENCE{
apple APPLE
}
sequenceType SEQUENCE{
fruit APPLE
}
NULL, BOOLEAN and INTEGER
• NULL is zero-length type
• BOOLEAN is 1-bit type
• 0 for FALSE
• 1 for TRUE
• Constrained INTEGER
• Value range (v.r): 33 – (-30) + 1 = 64
• Field size: ⌈log2(v.r)⌉ = 8 bits
• Offset (lower bound): -30
intergerField INTEGER(-30..33)
00000011 = -27
BIT STRING and OCTET STRING
• Length is indicated, if required
apple BIT STRING 00000100 AAAA = 4-bit long and content follows
apple BIT STRING (SIZE(4..11)) 00000000 AAAA = 4-bit long and content follows
apple BIT STRING (SIZE(4)) AAAA
apple OCTET STRING 00000001 AAAAAAAA = 1-octet long and content follows
apple OCTET STRING (SIZE(1..8)) 00000000 AAAAAAAA = 1-octet long and content follows
apple OCTET STRING (SIZE(1)) AAAAAAAA
ENUMERATED and CHOICE
• Enumeration index to choose item
• Field size: ⌈log2(3)⌉ = 2
• Choice index to choose item
• Choice index field size: ⌈log2(3)⌉ = 2
enumType ENUMERATED{apple, banana, cherry}
choiceType CHOICE{
apple APPLE,
banana BANANA,
cherry CHERRY
}
10 = cherry
10 CCCC = content of cherry
ENUMERATED and CHOICE with Extension Marker (EM)
• Extension bit at the beginning
enumType ENUMERATED{apple, ..., cherry}
choiceType CHOICE{
apple APPLE,
...,
cherry CHERRY
}
1 0 = cherry
1 0 CCCC = content of cherry
SEQUENCE
• No OPTIONAL/DEFAULT fields is in definition
• Just list all content in order
• One or more OPTIONAL/DEFAULT fields in definition
• Optional bitmap indicates each OPTIONAL/DEFAULT field
• Optional bitmap size: # of OPTIONAL/DEFAULT fields = 2
sequenceType SEQUENCE{
apple APPLE OPTIONAL,
banana BANANA,
cherry CHERRY OPTIONAL
}
10 AAAA BBBB = content of apple and banana
SEQUENCE with EM
• Extension bit at the beginning
• Additional bitmap at the end indicates how many fields are after EM
• Bitmap shall indicate even for a mandatory field
• Length of bitmap is also indicated
• Content is included after EM. Its length (in octets) precedes
sequenceType SEQUENCE{
apple APPLE OPTIONAL,
...,
cherry CHERRY,
durian DURAIN OPTIONAL
}
1 1 AAAA 00000010 11 00000001 CCCCCCCC 00000001 DDDDDDDD
= content of apple, cherry and durian
SEQUENCE with Version Bracket (VB)
• The same rule of EM for SEQUENCE applies
• Each VB is considered as a single SEQUENCE
sequenceType SEQUENCE{
apple APPLE OPTIONAL,
...,
[[
cherry CHERRY,
durian DURAIN OPTIONAL
]]
}
1 1 AAAA 00000001 1 00000001 0 CCCC = content of apple and cherry
SEQUENCE OF
• Iteration count is indicated
apple SEQUENCE (SIZE(1..8)) OF APPLE
00000011 AAA1 AAA2 AAA3 AAA4 = 4 APPLEs
Length Determinant
• <= 127
• <=16383
• >= 16384
0 0001010 = 10
1 0 001010 = 2561
00000001
1 0 000100 = four 16384 (bits/octets/…)
(1 to 4 units are supported)
AAAAAAAA = content follows
LLLLLLLL = another length determinant

Quick 3GPP RRC ASN.1

  • 1.
    Quick 3GPP RRCASN.1 Seokseong Jeon
  • 2.
    DISCLAIMER • This isa simplified introduction to encoding rule used by 3GPP RRC protocol. The most practical examples are captured and not every single rule is treated.
  • 3.
    Encoding Rule • 3GPPuses Unaligned variant of Packed Encoding Rule (PER) • In unaligned variant, each field is not aligned at octet boundary • Therefore, zero-pad is used only at the end of message • PER is insensitive to field name • Both are considered to be same • Reference: ITU-T X.691 sequenceType SEQUENCE{ apple APPLE } sequenceType SEQUENCE{ fruit APPLE }
  • 4.
    NULL, BOOLEAN andINTEGER • NULL is zero-length type • BOOLEAN is 1-bit type • 0 for FALSE • 1 for TRUE • Constrained INTEGER • Value range (v.r): 33 – (-30) + 1 = 64 • Field size: ⌈log2(v.r)⌉ = 8 bits • Offset (lower bound): -30 intergerField INTEGER(-30..33) 00000011 = -27
  • 5.
    BIT STRING andOCTET STRING • Length is indicated, if required apple BIT STRING 00000100 AAAA = 4-bit long and content follows apple BIT STRING (SIZE(4..11)) 00000000 AAAA = 4-bit long and content follows apple BIT STRING (SIZE(4)) AAAA apple OCTET STRING 00000001 AAAAAAAA = 1-octet long and content follows apple OCTET STRING (SIZE(1..8)) 00000000 AAAAAAAA = 1-octet long and content follows apple OCTET STRING (SIZE(1)) AAAAAAAA
  • 6.
    ENUMERATED and CHOICE •Enumeration index to choose item • Field size: ⌈log2(3)⌉ = 2 • Choice index to choose item • Choice index field size: ⌈log2(3)⌉ = 2 enumType ENUMERATED{apple, banana, cherry} choiceType CHOICE{ apple APPLE, banana BANANA, cherry CHERRY } 10 = cherry 10 CCCC = content of cherry
  • 7.
    ENUMERATED and CHOICEwith Extension Marker (EM) • Extension bit at the beginning enumType ENUMERATED{apple, ..., cherry} choiceType CHOICE{ apple APPLE, ..., cherry CHERRY } 1 0 = cherry 1 0 CCCC = content of cherry
  • 8.
    SEQUENCE • No OPTIONAL/DEFAULTfields is in definition • Just list all content in order • One or more OPTIONAL/DEFAULT fields in definition • Optional bitmap indicates each OPTIONAL/DEFAULT field • Optional bitmap size: # of OPTIONAL/DEFAULT fields = 2 sequenceType SEQUENCE{ apple APPLE OPTIONAL, banana BANANA, cherry CHERRY OPTIONAL } 10 AAAA BBBB = content of apple and banana
  • 9.
    SEQUENCE with EM •Extension bit at the beginning • Additional bitmap at the end indicates how many fields are after EM • Bitmap shall indicate even for a mandatory field • Length of bitmap is also indicated • Content is included after EM. Its length (in octets) precedes sequenceType SEQUENCE{ apple APPLE OPTIONAL, ..., cherry CHERRY, durian DURAIN OPTIONAL } 1 1 AAAA 00000010 11 00000001 CCCCCCCC 00000001 DDDDDDDD = content of apple, cherry and durian
  • 10.
    SEQUENCE with VersionBracket (VB) • The same rule of EM for SEQUENCE applies • Each VB is considered as a single SEQUENCE sequenceType SEQUENCE{ apple APPLE OPTIONAL, ..., [[ cherry CHERRY, durian DURAIN OPTIONAL ]] } 1 1 AAAA 00000001 1 00000001 0 CCCC = content of apple and cherry
  • 11.
    SEQUENCE OF • Iterationcount is indicated apple SEQUENCE (SIZE(1..8)) OF APPLE 00000011 AAA1 AAA2 AAA3 AAA4 = 4 APPLEs
  • 12.
    Length Determinant • <=127 • <=16383 • >= 16384 0 0001010 = 10 1 0 001010 = 2561 00000001 1 0 000100 = four 16384 (bits/octets/…) (1 to 4 units are supported) AAAAAAAA = content follows LLLLLLLL = another length determinant