mobile: even more 44.018 crazy structures

This commit is contained in:
mich 2018-11-16 17:42:06 +01:00
parent f1f24a0ef5
commit 80c0d5f455
2 changed files with 910 additions and 218 deletions

View File

@ -38,7 +38,7 @@ from pycrate_core.elt import Envelope, Array, Sequence, Alt, \
from pycrate_core.base import *
from pycrate_core.repr import *
from .TS24008_IE import LAI, ID, MSCm2
from .TS24008_IE import LAI, RAI, ID, MSCm2
#------------------------------------------------------------------------------#
# TS 44.018 IE specified with CSN.1
@ -48,16 +48,23 @@ from pycrate_csn1dir.ba_list_pref import ba_list_pref
from pycrate_csn1dir.utran_freq_list import utran_freq_list
from pycrate_csn1dir.individual_priorities import individual_priorities
from pycrate_csn1dir.classmark_3_value_part import classmark_3_value_part
from pycrate_csn1dir.gprs_broadcast_information_value_part import gprs_broadcast_information_value_part
from pycrate_csn1dir.rr_packet_uplink_assignment_value_part import rr_packet_uplink_assignment_value_part
from pycrate_csn1dir.rr_packet_downlink_assignment_value_part import rr_packet_downlink_assignment_value_part
from pycrate_csn1dir.dynamic_arfcn_mapping import dynamic_arfcn_mapping
from pycrate_csn1dir.ia_rest_octets import ia_rest_octets
from pycrate_csn1dir.ipa_rest_octets import ipa_rest_octets
from pycrate_csn1dir.iax_rest_octets import iax_rest_octets
from pycrate_csn1dir.iar_rest_octets import iar_rest_octets
from pycrate_csn1dir.gprs_broadcast_information_value_part import gprs_broadcast_information_value_part
from pycrate_csn1dir.rr_packet_uplink_assignment_value_part import rr_packet_uplink_assignment_value_part
from pycrate_csn1dir.rr_packet_downlink_assignment_value_part import rr_packet_downlink_assignment_value_part
from pycrate_csn1dir.dtm_information_details_value_part import dtm_information_details_value_part
from pycrate_csn1dir.channel_request_description_2_value_part import channel_request_description_2_value_part
from pycrate_csn1dir.packet_channel_description import packet_channel_description
from pycrate_csn1dir.rr_packet_downlink_assignment_type_2_value_part import \
rr_packet_downlink_assignment_type_2_value_part
from pycrate_csn1dir.cell_selection_indicator_after_release_of_all_tch_and_sdcch_value_part import \
cell_selection_indicator_after_release_of_all_tch_and_sdcch_value_part
#------------------------------------------------------------------------------#
# generic objects
#------------------------------------------------------------------------------#
@ -141,12 +148,16 @@ class BARange(Envelope):
# This is the same structure as FreqList defined in 10.5.2.13,
# but with a fixed length of 16 bytes
# _FreqListRange is the generic class template for all Range*
# for range 512 and range 1024, there is a W(parent) selection
# _FreqListRange is the generic class template for all Range* as defined
# in 10.5.2.13
# For range 512 and range 1024, there is a W(parent) selection
# which requires some damned numerology !
# So we build a dict of W_index -> W_parent_index up to index 511 (rank 8),
# what corresponds to the longest sequence of W (for range 512)
# For all _FreqListRange / _FreqListRangeLong / _FreqListRange1024
# only Layout and eventually Range need to be set
def __exp_ind(ind):
l = [i*2 for i in ind]
r = [1+i for i in l]
@ -162,7 +173,6 @@ def _build_w_parent_dict(rank=8):
return par
# generic class to handle the parsing, decoding and encoding of ranges of ARFCN
class _FreqListRange(Envelope):
_Range = 0
_Layout = ()
@ -236,60 +246,40 @@ class _FreqListRange(Envelope):
raise(PycrateErr('not implemented'))
# from 15 (W1 only) to 1013 bits (W1 -> W511), could be 1023 bits
class CellChanRange512(_FreqListRange):
# _FreqListRangeLong and _FreqListRange1024 are parent classes as defined in
# 10.5.2.13
class _FreqListRangeLong(_FreqListRange):
_Range = 512
_Layout = (9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5)
def _dec_get_w_ind(self, ind):
return self._Parent[ind]
# from 8 (W1 only) to 502 bits (W1 -> W255), could be 1023 bits
class CellChanRange256(_FreqListRange):
_Range = 256
_Layout = (8, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4)
# from 8 (W1 only) to 247 bits (W1 to W127), could be 1023 bits
class CellChanRange128(_FreqListRange):
_Range = 128
_Layout = (7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3)
class FreqListBitmapVar(BitMap):
def _decode(self):
rrfcns = []
rr_uint, rr_bl = self.to_uint(), self.get_bl()
for i in range(0, rr_bl):
if rr_uint & 1<<(rr_bl-i-1):
rrfcns.append(i+1)
return rrfcns
def _encode(self, rrfcns):
# bitmap length is the maximum offset, rounding to the octet boundary
rr_uint, rr_bl = 0, max(rrfcns)
if rr_bl % 8:
rr_bl += -rr_bl % 8
for o in rrfcns:
rr_uint += 1<<(rr_bl-o-1)
self.from_uint(rr_uint)
class CellChanAlt2(Envelope):
_GEN = (
Uint('FmtExt2', bl=2, dic={0: 'range 512', 1: 'range 256', 2: 'range 128', 3: 'variable bit map'}),
Uint('OriginARFCN', val=0, bl=10),
Alt(GEN={
0: CellChanRange512(),
1: CellChanRange256(),
2: CellChanRange128(),
3: FreqListBitmapVar('CellChanBitmapVar')},
sel=lambda self: self.get_env()[0].get_val())
class _FreqListRange1024(_FreqListRangeLong):
_Range = 1024
_GEN = (
Uint('F0', val=0, bl=1),
)
def decode(self):
"""returns the list of ARFCNs set
"""
if self[0].get_val():
return [0] + self._decode
else:
return self._decode()
def encode(self, arfcns):
"""sets a list of ARFCNs
"""
# TODO
raise(PycrateErr('not implemented'))
# _FreqListAlt2, _FreqListAlt1 and _FreqList are parent classes with common
# methods used children classes which have different generators
class _FreqListAlt2(Envelope):
def decode(self):
"""returns the list of ARFCNs set
"""
@ -319,31 +309,57 @@ class CellChanAlt2(Envelope):
pass
# from 11 (W1 only) to 1035 bits (W1 -> W264)
class CellChanRange1024(_FreqListRange):
_Range = 1024
_Layout = (10, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7)
_GEN = (
Uint('F0', val=0, bl=1),
)
def _dec_get_w_ind(self, ind):
return self._Parent[ind]
class _FreqListAlt1(Envelope):
def decode(self):
"""returns the list of ARFCNs set
"""
if self[0].get_val():
return [0] + self._decode
else:
return self._decode()
return self[1].get_alt().decode()
def encode(self, arfcns):
"""sets a list of ARFCNs
"""
# TODO
raise(PycrateErr('not implemented'))
self[1].get_alt().encode(arfcns)
class _FreqList(Envelope):
def decode(self):
"""returns the list of ARFCNs set
"""
try:
return self[2].get_alt().decode()
except:
return []
def encode(self, arfcns):
"""sets the list of ARFCNs
"""
# TODO: choose the best possible encoding ?!
raise(PycrateErr('not implemented'))
# FreqListBitmapVar and FreqListBitmap0 are defined in 10.5.2.13
# but actually used as-is in several places
class FreqListBitmapVar(BitMap):
def _decode(self):
rrfcns = []
rr_uint, rr_bl = self.to_uint(), self.get_bl()
for i in range(0, rr_bl):
if rr_uint & 1<<(rr_bl-i-1):
rrfcns.append(i+1)
return rrfcns
def _encode(self, rrfcns):
# bitmap length is the maximum offset, rounding to the octet boundary
rr_uint, rr_bl = 0, max(rrfcns)
if rr_bl % 8:
rr_bl += -rr_bl % 8
for o in rrfcns:
rr_uint += 1<<(rr_bl-o-1)
self.from_uint(rr_uint)
class FreqListBitmap0(BitMap):
_bl = 124
@ -369,7 +385,40 @@ class FreqListBitmap0(BitMap):
self.set_val(uint_to_bytes(ar_uint, 124))
class CellChanAlt1(Envelope):
# Actual Cell Channel definitions
class CellChanRange1024(_FreqListRange1024):
_Layout = (10, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 6)
class CellChanRange512(_FreqListRangeLong):
_Layout = (9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5)
class CellChanRange256(_FreqListRange):
_Range = 256
_Layout = (8, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4)
class CellChanRange128(_FreqListRange):
_Range = 128
_Layout = (7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3)
class CellChanAlt2(_FreqListAlt2):
_GEN = (
Uint('FmtExt2', bl=2, dic={0: 'range 512', 1: 'range 256', 2: 'range 128', 3: 'variable bit map'}),
Uint('OriginARFCN', val=0, bl=10),
Alt(GEN={
0: CellChanRange512(),
1: CellChanRange256(),
2: CellChanRange128(),
3: FreqListBitmapVar('CellChanBitmapVar')},
sel=lambda self: self.get_env()[0].get_val())
)
class CellChanAlt1(_FreqListAlt1):
_GEN = (
Uint('FmtExt', bl=1, dic={0:'range 1024'}),
Alt(GEN={
@ -377,20 +426,10 @@ class CellChanAlt1(Envelope):
1: CellChanAlt2()},
sel=lambda self: self.get_env()[0].get_val())
)
def decode(self):
"""returns the list of ARFCNs set
"""
return self[1].get_alt().decode()
def encode(self, arfcns):
"""sets a list of ARFCNs
"""
self[1].get_alt().encode(arfcns)
# 16 bytes, 128 bits
class CellChan(Envelope):
class CellChan(_FreqList):
_GEN = (
Uint('Fmt', bl=2, dic={0:'bit map 0', 1:'undefined', 3: 'undefined'}),
Uint('spare', bl=2),
@ -400,17 +439,24 @@ class CellChan(Envelope):
DEFAULT=Buf('undefined', rep=REPR_HEX),
sel=lambda self: self.get_env()[0].get_val())
)
def decode(self):
"""returns the list of ARFCNs set
"""
return self[2].get_alt().decode()
def encode(self, arfcns):
"""sets the list of ARFCNs
"""
# TODO: choose the best possible encoding ?!
raise(PycrateErr('not implemented'))
#------------------------------------------------------------------------------#
# Cell Description
# TS 44.018, 10.5.2.2
#------------------------------------------------------------------------------#
class CellDesc(Envelope):
_GEN = (
Uint('BCCHARFCN_hi', bl=2),
Uint('NCC', bl=3),
Uint('BCC', bl=3),
Uint8('BCCHARFCN_lo'),
Uint16('BCCHARFCN', trans=True)
)
def __init__(self, *args, **kwargs):
Envelope.__init__(self, *args, **kwargs)
self[4].set_valauto(lambda: self[3].get_val() + (self[0].get_val()<<8))
#------------------------------------------------------------------------------#
@ -667,18 +713,24 @@ class FreqChanSeq(Envelope):
# TS 44.018, 10.5.2.13
#------------------------------------------------------------------------------#
# from 11 (W1 only) to 1035 bits (W1 -> W264)
class FreqListRange1024(_FreqListRange):
_Layout = (10, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7) + \
16 * (6,) + \
32 * (5,) + \
64 * (4,) + \
128 * (3,) + \
11 * (2,)
# from 15 (W1 only) to 1013 bits (W1 -> W511), could be 1023 bits
class FreqListRange512(_FreqListRange):
_Range = 512
_Layout = (9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6) + \
16 * (5,) + \
32 * (4,) + \
64 * (3,) + \
128 * (2,) + \
256 * (1,)
def _dec_get_w_ind(self, ind):
return self._Parent[ind]
# from 8 (W1 only) to 502 bits (W1 -> W255), could be 1023 bits
@ -700,7 +752,7 @@ class FreqListRange128(_FreqListRange):
64 * (1,)
class FreqListAlt2(Envelope):
class FreqListAlt2(_FreqListAlt2):
_GEN = (
Uint('FmtExt2', bl=2, dic={0: 'range 512', 1: 'range 256', 2: 'range 128', 3: 'variable bit map'}),
Uint('OriginARFCN', val=0, bl=10),
@ -711,68 +763,9 @@ class FreqListAlt2(Envelope):
3: FreqListBitmapVar()},
sel=lambda self: self.get_env()[0].get_val())
)
def decode(self):
"""returns the list of ARFCNs set
"""
if self[0].get_val() == 3:
# variable bitmap
orig_arfcn = self[1].get_val()
add_orig_arfcn = lambda x: x+orig_arfcn
return list(map(add_orig_arfcn, self[2].get_alt()._decode()))
else:
# range
return [self[1].get_val()] + self[2].get_alt()._decode()
def encode(self, arfcns):
"""sets a list of ARFCNs
"""
arfcns = set(arfcns)
try:
arfcns.sort()
orig_arfcn = arfcns.pop(0)
self[1].set_val(orig_arfcn)
if self[0].get_val() == 3:
# variable bitmap, update every ARFCNs
rem_orig_arfcn = lambda x: x-orig_arfcn
arfcns = list(map(rem_orig_arfcn, arfcns))
self[2].get_alt()._encode(arfcns)
except:
pass
# from 11 (W1 only) to 1035 bits (W1 -> W264)
class FreqListRange1024(_FreqListRange):
_Range = 1024
_Layout = (10, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7) + \
16 * (6,) + \
32 * (5,) + \
64 * (4,) + \
128 * (3,) + \
11 * (2,)
_GEN = (
Uint('F0', val=0, bl=1),
)
def _dec_get_w_ind(self, ind):
return self._Parent[ind]
def decode(self):
"""returns the list of ARFCNs set
"""
if self[0].get_val():
return [0] + self._decode
else:
return self._decode()
def encode(self, arfcns):
"""sets a list of ARFCNs
"""
# TODO
raise(PycrateErr('not implemented'))
class FreqListAlt1(Envelope):
class FreqListAlt1(_FreqList):
_GEN = (
Uint('FmtExt', bl=1, dic={0:'range 1024'}),
Alt(GEN={
@ -780,20 +773,10 @@ class FreqListAlt1(Envelope):
1: FreqListAlt2()},
sel=lambda self: self.get_env()[0].get_val())
)
def decode(self):
"""returns the list of ARFCNs set
"""
return self[1].get_alt().decode()
def encode(self, arfcns):
"""sets a list of ARFCNs
"""
self[1].get_alt().encode(arfcns)
# from 2 to 130 bytes, 16 to 1040 bits
class FreqList(Envelope):
class FreqList(_FreqList):
_GEN = (
Uint('Fmt', bl=2, dic={0:'bit map 0', 1:'undefined', 3: 'undefined'}),
Uint('spare', bl=2),
@ -803,17 +786,66 @@ class FreqList(Envelope):
DEFAULT=Buf('undefined', rep=REPR_HEX),
sel=lambda self: self.get_env()[0].get_val())
)
def decode(self):
"""returns the list of ARFCNs set
"""
return self[2].get_alt().decode()
def encode(self, arfcns):
"""sets the list of ARFCNs
"""
# TODO: choose the best possible encoding ?!
raise(PycrateErr('not implemented'))
#------------------------------------------------------------------------------#
# Frequency Short List
# TS 44.018, 10.5.2.14
#------------------------------------------------------------------------------#
# This is the same structure as FreqList defined in 10.5.2.13,
# but with a fixed length of 9 bytes
class FreqShortListRange1024(_FreqListRange1024):
_Layout = (10, 9, 9, 8, 8, 8, 8)
class FreqShortListRange512(_FreqListRangeLong):
_Layout = (9, 8, 8, 7, 7, 7, 7)
class FreqShortListRange256(_FreqListRange):
_Range = 256
_Layout = (8, 7, 7, 6, 6, 6, 6, 5)
class FreqShortListRange128(_FreqListRange):
_Range = 128
_Layout = (7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4)
class FreqShortListAlt2(_FreqListAlt2):
_GEN = (
Uint('FmtExt2', bl=2, dic={0: 'range 512', 1: 'range 256', 2: 'range 128', 3: 'variable bit map'}),
Uint('OriginARFCN', val=0, bl=10),
Alt(GEN={
0: FreqShortListRange512(),
1: FreqShortListRange256(),
2: FreqShortListRange128(),
3: FreqListBitmapVar('FreqShortListBitmapVar')},
sel=lambda self: self.get_env()[0].get_val())
)
class FreqShortListAlt1(_FreqListAlt1):
_GEN = (
Uint('FmtExt', bl=1, dic={0:'range 1024'}),
Alt(GEN={
0: FreqShortListRange1024(),
1: FreqShortListAlt2()},
sel=lambda self: self.get_env()[0].get_val())
)
# 9 bytes, 72 bits
class FreqShortList(_FreqList):
_GEN = (
Uint('Fmt', val=2, bl=2),
Uint('spare', bl=2),
Alt(GEN={
2: FreqShortListAlt1()},
DEFAULT=Buf('undefined', rep=REPR_HEX),
sel=lambda self: self.get_env()[0].get_val())
)
#------------------------------------------------------------------------------#
@ -859,7 +891,7 @@ class GroupChanDesc(Envelope):
Uint('HSN', bl=6)
))},
sel=lambda self:self.get_env()[3].get_val()),
BitMap('MobAllocChan')
BitMap('MobileAllocChan')
)
@ -890,19 +922,64 @@ class GroupChanDesc2(Envelope):
Uint('spare', bl=1),
Uint('MAIO', bl=6),
Uint('HSN', bl=6),
BitMap('MobAllocChan')
BitMap('MobileAllocChan')
)
#------------------------------------------------------------------------------#
# Handover Reference
# TS 44.018, 10.5.2.15
#------------------------------------------------------------------------------#
class HandoverRef(Uint8):
pass
#------------------------------------------------------------------------------#
# L2 Pseudo Length
# TS 44.018, 10.5.2.19
#------------------------------------------------------------------------------#
# The length value is automated to sum up the length of all IE within a RR msg
# after the L2PseudoLength (index 0) and before the RestOctets (index -1)
class L2PseudoLength(Envelope):
_excl = ()
_GEN = (
Uint('Value', bl=6),
Uint('M', val=0, bl=1),
Uint('EL', val=1, bl=1)
)
def __init__(self, *args, **kwargs):
if 'excl' in kwargs:
self._excl = kwargs['excl']
del kwargs['excl']
Envelope.__init__(self, *args, **kwargs)
self[0].set_valauto(
lambda: sum([e.get_bl() for i, e in enumerate(self.get_env()._content) \
if i not in self._excl])>>3 )
#------------------------------------------------------------------------------#
# Mobile Allocation
# TS 44.018, 10.5.2.21
#------------------------------------------------------------------------------#
class MobAlloc(BitMap):
class MobileAlloc(BitMap):
pass
#------------------------------------------------------------------------------#
# Mobile Time Difference
# TS 44.018, 10.5.2.21a
#------------------------------------------------------------------------------#
class MobileTimeDiff(Envelope):
_GEN = (
Uint('Value', bl=21),
Uint('spare', bl=3)
)
#------------------------------------------------------------------------------#
# MultiRate configuration
# TS 44.018, 10.5.2.21aa
@ -921,6 +998,18 @@ class MultirateConfig(BitMap):
)
#------------------------------------------------------------------------------#
# Mobile Time Difference on Hyperframe level
# TS 44.018, 10.5.2.21ab
#------------------------------------------------------------------------------#
class MobileTimeDiffHFLevel(Envelope):
_GEN = (
Uint('Value', bl=33),
Uint('spare', bl=3)
)
#------------------------------------------------------------------------------#
# Multislot Allocation
# TS 44.018, 10.5.2.21b
@ -944,6 +1033,33 @@ class MultislotAlloc(Envelope):
self[2].set_transauto(lambda: True if self[1].get_val() else False)
#------------------------------------------------------------------------------#
# Dedicated Mode or TBF
# TS 44.018, 10.5.2.26
#------------------------------------------------------------------------------#
class DedicatedModeOrTBF(Envelope):
_GEN = (
Uint('NRA', bl=1),
Uint('TMA', bl=1),
Uint('Downlink', bl=1, dic={0:'UL', 1:'DL'}),
Uint('TD', bl=1, dic={0:'dedicated mode', 1:'TBF'})
)
#------------------------------------------------------------------------------#
# Page Mode
# TS 44.018, 10.5.2.26
#------------------------------------------------------------------------------#
PageMode_dict ={
0:'normal paging',
1:'extended paging',
2:'paging reorganization',
3:'same as before'
}
#------------------------------------------------------------------------------#
# Power Command
# TS 44.018, 10.5.2.28
@ -958,6 +1074,35 @@ class PowerCmd(Envelope):
)
#------------------------------------------------------------------------------#
# Power Command and access type
# TS 44.018, 10.5.2.28a
#------------------------------------------------------------------------------#
class PowerCmdAccType(Envelope):
_GEN = (
Uint('ATC', bl=1, dic={0:'sending of Handover Access mandatory',
1:'sending of Handover Access optional'}),
Uint('EPCMode', bl=1),
Uint('FPC_EPC', bl=1),
Uint('PowerLevel', bl=5)
)
#------------------------------------------------------------------------------#
# Request Reference
# TS 44.018, 10.5.2.30
#------------------------------------------------------------------------------#
class RequestRef(Envelope):
_GEN = (
Uint8('RA'),
Uint('T1prime', bl=5),
Uint('T3', bl=6),
Uint('T2', bl=5)
)
#------------------------------------------------------------------------------#
# RR Cause
# TS 44.018, 10.5.2.31
@ -1001,6 +1146,53 @@ class StartingTime(Envelope):
)
#------------------------------------------------------------------------------#
# Synchronization Indication
# TS 44.018, 10.5.2.39
#------------------------------------------------------------------------------#
_SI_dict = {
0 : 'Non-synchronized',
1 : 'Synchronized',
2 : 'Pre-synchronised',
3 : 'Pseudo-synchronised',
}
class SynchInd(Envelope):
_GEN = (
Uint('NCI', bl=1),
Uint('ROT', bl=1),
Uint('SI', bl=2, dic=_SI_dict)
)
#------------------------------------------------------------------------------#
# Timing Advance
# TS 44.018, 10.5.2.40
#------------------------------------------------------------------------------#
class TimingAdvance(Uint8):
pass
#------------------------------------------------------------------------------#
# Time Difference
# TS 44.018, 10.5.2.41
#------------------------------------------------------------------------------#
class TimeDiff(Uint8):
pass
#------------------------------------------------------------------------------#
# TLLI
# TS 44.018, 10.5.2.41a
#------------------------------------------------------------------------------#
class TLLI(Uint32):
pass
#------------------------------------------------------------------------------#
# VGCS Ciphering Parameters
# TS 44.018, 10.5.2.42b
@ -1040,6 +1232,65 @@ class VGCSTargetModeInd(Envelope):
)
#------------------------------------------------------------------------------#
# Wait Indication
# TS 44.018, 10.5.2.43
#------------------------------------------------------------------------------#
class T3122(Uint8):
pass
class T3142(Uint8):
pass
#------------------------------------------------------------------------------#
# Suspension Cause
# TS 44.018, 10.5.2.47
#------------------------------------------------------------------------------#
class SuspensionCause(Uint8):
_dic = {
0 : 'Emergency call, mobile originating call or call re-establishment',
1 : 'Location Area Update',
2 : 'MO Short message service',
3 : 'Other procedure which can be completed with an SDCCH',
4 : 'MO Voice broadcast or group call',
5 : 'Mobile terminating CS connection',
6 : 'DTM not supported in the cell'
}
#------------------------------------------------------------------------------#
# Service Support
# TS 44.018, 10.5.2.57
#------------------------------------------------------------------------------#
_ServiceSupport_dict = {
0:'notification not required',
1:'notification required'
}
class ServiceSupport(Envelope):
_GEN = (
Uint('spare', bl=6),
Uint('MBMSMulticast', bl=1, dic=_ServiceSupport_dict),
Uint('MBMSBroadcast', bl=1, dic=_ServiceSupport_dict)
)
#------------------------------------------------------------------------------#
# Dedicated Service Information
# TS 44.018, 10.5.2.59
#------------------------------------------------------------------------------#
class DedicatedServiceInfo(Envelope):
_GEN = (
Uint('spare', bl=7),
Uint('SIS', bl=1)
)
#------------------------------------------------------------------------------#
# Talker Priority Status
# TS 44.018, 10.5.2.64
@ -1067,6 +1318,61 @@ class TalkerId(Envelope):
)
#------------------------------------------------------------------------------#
# PS Cause
# TS 44.018, 10.5.2.67
#------------------------------------------------------------------------------#
PSCause_dict = {
0 : 'DTM multislot capabilities violated',
1 : 'No uplink TBF',
2 : 'Too m'
}
#------------------------------------------------------------------------------#
# Carrier Indication
# TS 44.018, 10.5.2.69
#------------------------------------------------------------------------------#
class CarrierInd(Envelope):
_GEN = (
Uint('spare', bl=2),
Uint('CI', bl=1, dic={0:'Carrier 1', 1:'Carrier 2'})
)
#------------------------------------------------------------------------------#
# Feature Indicator
# TS 44.018, 10.5.2.76
#------------------------------------------------------------------------------#
class FeatureInd(Envelope):
_GEN = (
Uint('PEO_BCCH_CHANGE_MARK', bl=2),
Uint('CS_IR', bl=1),
Uint('PS_IR', bl=1)
)
#------------------------------------------------------------------------------#
# PLMN Index
# TS 44.018, 10.5.2.81
#------------------------------------------------------------------------------#
PLMNIndex_dict = {
1 : 'PLMN identity of the Common PLMN broadcast in SYSTEM INFORMATION TYPE 3/4',
2 : 'PLMN identity of the first Additional PLMN in the network sharing information broadcast '\
'in SYSTEM INFORMATION TYPE 22',
3 : 'PLMN identity of the second Additional PLMN in the network sharing information broadcast broadcast '\
'in SYSTEM INFORMATION TYPE 22',
4 : 'PLMN identity of the third Additional PLMN in the network sharing information broadcast '\
'in SYSTEM INFORMATION TYPE 22',
5 : 'PLMN identity of the fourth Additional PLMN in the network sharing information broadcast '\
'in SYSTEM INFORMATION TYPE 22'
}
#------------------------------------------------------------------------------#
# Extended TSC Set
# TS 44.018, 10.5.2.82
@ -1081,3 +1387,24 @@ class ExtTSCSet(Envelope):
Uint('CSTSCSet', bl=2)
)
#------------------------------------------------------------------------------#
# Request Reference Alt
# TS 44.018, 10.5.2.87
#------------------------------------------------------------------------------#
class RequestRefAlt(Envelope):
_GEN = (
Uint('RA_lo', bl=3),
Uint('RAType', bl=2),
Uint('spare', bl=3),
Uint8('RA_hi'),
Uint('T1prime', bl=5),
Uint('T3', bl=6),
Uint('T2', bl=5),
Uint16('RA', trans=True)
)
def __init__(self, *args, **kwargs):
Envelope.__init__(self, *args, **kwargs)
self[7].set_valauto(lambda: self[0].get_val() + (self[3].get_val()<<3))

View File

@ -122,13 +122,15 @@ GSMRRType_dict = {
77:'DTM INFORMATION',
78:'PACKET NOTIFICATION',
96:'UTRAN CLASSMARK CHANGE',
98:'CDMA 2000 CLASSMARK CHANGE',
98:'CDMA2000 CLASSMARK CHANGE',
99:'INTER SYSTEM TO UTRAN HANDOVER COMMAND',
100:'INTER SYSTEM TO CDMA2000 HANDOVER COMMAND',
101:'GERAN IU MODE CLASSMARK CHANGE',
102:'PRIORITY UPLINK REQUEST',
102:'INTER SYSTEM TO E-UTRAN HANDOVER COMMAND',
#102:'PRIORITY UPLINK REQUEST',
103:'DATA INDICATION',
104:'DATA INDICATION 2'
104:'DATA INDICATION 2',
105:'IMMEDIATE PACKET ASSIGNMENT'
}
class RRHeader(Envelope):
@ -143,11 +145,11 @@ class RRHeader(Envelope):
# TS 44.018, section 9.1.1
#------------------------------------------------------------------------------#
class RRAdditionalAssign(Envelope):
class RRAdditionalAssign(Layer3):
_GEN = (
RRHeader(val={'Type':59}),
Type3V('ChanDesc', val={'V':b'\0\0\0'}, bl={'V':24}, IE=ChanDesc()),
Type4TLV('MobAlloc', val={'T':0x72, 'V':b'\0'}, IE=MobAlloc()),
Type4TLV('MobileAlloc', val={'T':0x72, 'V':b'\0'}, IE=MobileAlloc()),
Type3TV('StartingTime', val={'T':0x7C, 'V':b'\0\0'}, bl={'V':16}, IE=StartingTime()),
Type3TV('ExtTSCSet', val={'T':0x6D, 'V':b'\0'}, bl={'V':8}, IE=ExtTSCSet())
)
@ -158,7 +160,7 @@ class RRAdditionalAssign(Envelope):
# TS 44.018, section 9.1.2
#------------------------------------------------------------------------------#
class RRAssignmentCmd(Envelope):
class RRAssignmentCmd(Layer3):
_GEN = (
RRHeader(val={'Type':46}),
Type3V('FirstChanDescAfter', val={'V':b'\0\0\0'}, bl={'V':24}, IE=ChanDesc2()),
@ -176,13 +178,13 @@ class RRAssignmentCmd(Envelope):
Type3TV('ChanModeSet8', val={'T':0x18, 'V':b'\0'}, bl={'V':8}, IE=ChanMode()),
Type3TV('SecondChanDescAfter', val={'T':0x64, 'V':b'\0\0\0'}, bl={'V':24}, IE=ChanDesc()),
Type3TV('SecondChanMode', val={'T':0x66, 'V':b'\0'}, bl={'V':8}, IE=ChanMode2()),
Type4TLV('MobAllocAfter', val={'T':0x72, 'V':b'\0'}, IE=MobAlloc()),
Type4TLV('MobileAllocAfter', val={'T':0x72, 'V':b'\0'}, IE=MobileAlloc()),
Type3TV('StartingTime', val={'T':0x7C, 'V':b'\0\0'}, bl={'V':16}, IE=StartingTime()),
Type4TLV('FreqListBefore', val={'T':0x19, 'V':b'\0\0'}, IE=FreqList()),
Type3V('FirstChanDescBefore', val={'V':b'\0\0\0'}, bl={'V':24}, IE=ChanDesc2()),
Type3TV('SecondChanDescAfter', val={'T':0x64, 'V':b'\0\0\0'}, bl={'V':24}, IE=ChanDesc()),
Type3TV('FreqChanSeqBefore', val={'T':0x1E, 'V':9*b'\0'}, bl={'V':72}, IE=FreqChanSeq()),
Type4TLV('MobAllocBefore', val={'T':0x72, 'V':b'\0'}, IE=MobAlloc()),
Type4TLV('MobileAllocBefore', val={'T':0x72, 'V':b'\0'}, IE=MobileAlloc()),
Type1TV('CipherModeSetting', val={'T':0x9, 'V':0}, IE=CipherModeSetting()),
Type4TLV('VGCSTargetModeInd', val={'T':0x1, 'V':b'\0'}, IE=VGCSTargetModeInd()),
Type4TLV('MultirateConfig', val={'T':0x3, 'V':b'\0\0'}, IE=MultirateConfig()),
@ -197,7 +199,7 @@ class RRAssignmentCmd(Envelope):
# TS 44.018, section 9.1.3
#------------------------------------------------------------------------------#
class RRAssignmentComplete(Envelope):
class RRAssignmentComplete(Layer3):
_GEN = (
RRHeader(val={'Type':41}),
Type3V('RRCause', val={'V':b'\0'}, bl={'V':8}, IE=RRCause()),
@ -209,7 +211,7 @@ class RRAssignmentComplete(Envelope):
# TS 44.018, section 9.1.4
#------------------------------------------------------------------------------#
class RRAssignmentFailure(Envelope):
class RRAssignmentFailure(Layer3):
_GEN = (
RRHeader(val={'Type':47}),
Type3V('RRCause', val={'V':b'\0'}, bl={'V':8}, IE=RRCause())
@ -221,7 +223,7 @@ class RRAssignmentFailure(Envelope):
# TS 44.018, section 9.1.5
#------------------------------------------------------------------------------#
class RRChannelModeModify(Envelope):
class RRChannelModeModify(Layer3):
_GEN = (
RRHeader(val={'Type':16}),
Type3V('ChanDesc', val={'V':b'\0\0\0'}, bl={'V':24}, IE=ChanDesc2()),
@ -238,7 +240,7 @@ class RRChannelModeModify(Envelope):
# TS 44.018, section 9.1.6
#------------------------------------------------------------------------------#
class RRChannelModeModifyAck(Envelope):
class RRChannelModeModifyAck(Layer3):
_GEN = (
RRHeader(val={'Type':23}),
Type3V('ChanDesc', val={'V':b'\0\0\0'}, bl={'V':24}, IE=ChanDesc2()),
@ -252,7 +254,7 @@ class RRChannelModeModifyAck(Envelope):
# TS 44.018, section 9.1.7
#------------------------------------------------------------------------------#
class RRChannelRelease(Envelope):
class RRChannelRelease(Layer3):
_GEN = (
RRHeader(val={'Type':13}),
Type3V('RRCause', val={'V':b'\0'}, bl={'V':8}, IE=RRCause()),
@ -279,7 +281,7 @@ class RRChannelRelease(Envelope):
# CHANNEL REQUEST
# TS 44.018, section 9.1.8
#------------------------------------------------------------------------------#
# this is just 1 bytes with an establishment cause and a random reference
# this is just 1 byte with an establishment cause and a random reference
#------------------------------------------------------------------------------#
@ -287,7 +289,7 @@ class RRChannelRelease(Envelope):
# TS 44.018, section 9.1.9
#------------------------------------------------------------------------------#
class RRCipheringModeCmd(Envelope):
class RRCipheringModeCmd(Layer3):
_GEN = (
RRHeader(val={'Type':53}),
Type1V('CipherResp', val={'V':0}, IE=CipherResp()),
@ -300,7 +302,7 @@ class RRCipheringModeCmd(Envelope):
# TS 44.018, section 9.1.10
#------------------------------------------------------------------------------#
class RRCipheringModeComplete(Envelope):
class RRCipheringModeComplete(Layer3):
_GEN = (
RRHeader(val={'Type':50}),
Type4TLV('MEId', val={'T':0x17, 'V':b'\0'}, IE=ID())
@ -312,7 +314,7 @@ class RRCipheringModeComplete(Envelope):
# TS 44.018, section 9.1.11
#------------------------------------------------------------------------------#
class RRClassmarkChange(Envelope):
class RRClassmarkChange(Layer3):
_GEN = (
RRHeader(val={'Type':22}),
Type4LV('MSCm2', val={'V':b'@\0\0'}, IE=MSCm2()),
@ -325,7 +327,7 @@ class RRClassmarkChange(Envelope):
# TS 44.018, section 9.1.11a
#------------------------------------------------------------------------------#
class RRUTRANClassmarkChange(Envelope):
class RRUTRANClassmarkChange(Layer3):
_GEN = (
RRHeader(val={'Type':96}),
Type4LV('UTRANCm', val={'V':b'\0'}) # INTER RAT HANDOVER INFO from TS 25.331
@ -333,11 +335,11 @@ class RRUTRANClassmarkChange(Envelope):
#------------------------------------------------------------------------------#
# cdma2000 CLASSMARK CHANGE
# CDMA2000 CLASSMARK CHANGE
# TS 44.018, section 9.1.11b
#------------------------------------------------------------------------------#
class RRcdma2000ClassmarkChange(Envelope):
class RRCdma2000ClassmarkChange(Layer3):
_GEN = (
RRHeader(val={'Type':98}),
Type4LV('TerminalInfo', val={'V':b''}),
@ -361,7 +363,7 @@ class RRcdma2000ClassmarkChange(Envelope):
# TS 44.018, section 9.1.11d
#------------------------------------------------------------------------------#
class RRUTRANClassmarkChange(Envelope):
class RRUTRANClassmarkChange(Layer3):
_GEN = (
RRHeader(val={'Type':101}),
Type4LV('GERANIuModeCm', val={'V':14*b'\0'}) # MS GERAN IU MODE RADIO ACCESS CAPABILITY from TS 44.118
@ -373,7 +375,7 @@ class RRUTRANClassmarkChange(Envelope):
# TS 44.018, section 9.1.12
#------------------------------------------------------------------------------#
class RRClassmarkEnquiry(Envelope):
class RRClassmarkEnquiry(Layer3):
_GEN = (
RRHeader(val={'Type':19}),
Type4TLV('CmEnquiryMask', val={'T':0x10, 'V':b'\0'}, IE=CmEnquiryMask())
@ -385,7 +387,7 @@ class RRClassmarkEnquiry(Envelope):
# TS 44.018, section 9.1.12b
#------------------------------------------------------------------------------#
class RRConfigChangeCmd(Envelope):
class RRConfigChangeCmd(Layer3):
_GEN = (
RRHeader(val={'Type':48}),
Type4LV('MultislotAlloc', val={'V':b'\0'}, IE=MultislotAlloc()),
@ -405,7 +407,7 @@ class RRConfigChangeCmd(Envelope):
# TS 44.018, section 9.1.12c
#------------------------------------------------------------------------------#
class RRConfigChangeAck(Envelope):
class RRConfigChangeAck(Layer3):
_GEN = (
RRHeader(val={'Type':49})
)
@ -416,7 +418,7 @@ class RRConfigChangeAck(Envelope):
# TS 44.018, section 9.1.12d
#------------------------------------------------------------------------------#
class RRConfigChangeReject(Envelope):
class RRConfigChangeReject(Layer3):
_GEN = (
RRHeader(val={'Type':51}),
Type3V('RRCause', val={'V':b'\0'}, bl={'V':8}, IE=RRCause()),
@ -428,21 +430,21 @@ class RRConfigChangeReject(Envelope):
# TS 44.018, section 9.1.12e
#------------------------------------------------------------------------------#
class RRDTMAssignmentCmd(Envelope):
class RRDTMAssignmentCmd(Layer3):
_GEN = (
RRHeader(val={'Type':76}),
Type3V('CSPowerCmd', val={'V':b'\0'}, bl={'V':8}, IE=PowerCmd()),
Type3V('CSChanDesc', val={'V':b'\0\0\0'}, bl={'V':24}, IE=ChanDesc()),
Type4LV('GPRSBcastInfo', val={'V':6*b'\0'}, IE=gprs_broadcast_information_value_part),
Type4LV('GPRSBroadcastInfo', val={'V':6*b'\0'}, IE=gprs_broadcast_information_value_part),
Type3TV('CellChan', val={'T':0x10, 'V':16*b'\0'}, bl={'V':128}, IE=CellChan()),
Type3TV('ChanMode', val={'T':0x11, 'V':b'\0'}, bl={'V':8}, IE=ChanMode()),
Type4TLV('FreqList', val={'T':0x12, 'V':b'\0\0'}, IE=FreqList()),
Type4TLV('MobAlloc', val={'T':0x13, 'V':b'\0'}, IE=MobAlloc()),
Type4TLV('MobileAlloc', val={'T':0x13, 'V':b'\0'}, IE=MobileAlloc()),
Type4TLV('PSULAssign', val={'T':0x15, 'V':b'\0'}, IE=rr_packet_uplink_assignment_value_part),
Type4TLV('PSDLAssign', val={'T':0x16, 'V':b'\0'}, IE=rr_packet_downlink_assignment_value_part),
Type4TLV('MultirateConfig', val={'T':0x17, 'V':b'\0\0'}, IE=MultirateConfig()),
Type1TV('CipherModeSetting', val={'T':0x9, 'V':0}, IE=CipherModeSetting()),
Type4TLV('MobAllocC2', val={'T':0x18, 'V':b'\0'}, IE=MobAlloc()),
Type4TLV('MobileAllocC2', val={'T':0x18, 'V':b'\0'}, IE=MobileAlloc()),
Type4TLV('FreqListC2', val={'T':0x19, 'V':b'\0\0'}, IE=FreqList()),
Type4TLV('PSDLAssignType2', val={'T':0x16, 'V':b'\0'}, IE=rr_packet_downlink_assignment_type_2_value_part),
Type3TV('ChanDescC2', val={'V':b'\0\0'}, bl={'V':16}, IE=ChanDesc3()),
@ -450,13 +452,327 @@ class RRDTMAssignmentCmd(Envelope):
)
#------------------------------------------------------------------------------#
# DTM ASSIGNMENT FAILURE
# TS 44.018, section 9.1.12f
#------------------------------------------------------------------------------#
class RRDTMAssignmentFailure(Layer3):
_GEN = (
RRHeader(val={'Type':72}),
Type3V('RRCause', val={'V':b'\0'}, bl={'V':8}, IE=RRCause()),
)
#------------------------------------------------------------------------------#
# DTM INFORMATION
# TS 44.018, section 9.1.12g
#------------------------------------------------------------------------------#
class RRDTMInformation(Layer3):
_GEN = (
RRHeader(val={'Type':77}),
Type3V('RAI', val={'V':b'\0\xf1\x10\0\0\0'}, bl={'V':48}, IE=RAI()),
Type4LV('DTMInfoDetails', val={'V':b'\0\0\0'}, IE=dtm_information_details_value_part)
)
#------------------------------------------------------------------------------#
# DTM REJECT
# TS 44.018, section 9.1.12h
#------------------------------------------------------------------------------#
class RRDTMReject(Layer3):
_GEN = (
RRHeader(val={'Type':73}),
Type3V('DTMWaitInd', val={'V':b'\0'}, bl={'V':8}, IE=T3142())
)
#------------------------------------------------------------------------------#
# DTM REQUEST
# TS 44.018, section 9.1.12i
#------------------------------------------------------------------------------#
class RRDTMReq(Layer3):
_GEN = (
RRHeader(val={'Type':74}),
Type3V('TLLI', val={'V':4*b'\0'}, bl={'V':32}, IE=TLLI()),
Type4LV('ChanReqDesc2', val={'V':4*b'\0'}, IE=channel_request_description_2_value_part)
)
#------------------------------------------------------------------------------#
# FREQUENCY REDEFINITION
# TS 44.018, section 9.1.13
#------------------------------------------------------------------------------#
class RRFrequencyRedefinition(Layer3):
_GEN = (
RRHeader(val={'Type':20}),
Type3V('ChanDesc', val={'V':b'\0\0\0'}, bl={'V':24}, IE=ChanDesc()),
Type4LV('MobileAlloc', val={'V':b'\0'}, IE=MobileAlloc()),
Type3V('StartingTime', val={'V':b'\0\0'}, bl={'V':16}, IE=StartingTime()),
Type3TV('CellChan', val={'T':0x62, 'V':16*b'\0'}, bl={'V':128}, IE=CellChan()),
Type1TV('CarrierInd', val={'T':0x9, 'V':0}, IE=CarrierInd()),
Type4TLV('MobileAllocC2', val={'T':0x11, 'V':b'\0'}, IE=MobileAlloc()),
Type3TV('ChanDescC2', val={'T':0x12, 'V':b'\0\0'}, bl={'V':16}, IE=ChanDesc3()),
Type3TV('ExtTSCSet', val={'T':0x6D, 'V':b'\0'}, bl={'V':8}, IE=ExtTSCSet())
)
#------------------------------------------------------------------------------#
# GPRS SUSPENSION REQUEST
# TS 44.018, section 9.1.13b
#------------------------------------------------------------------------------#
class RRGPRSSuspensionReq(Layer3):
_GEN = (
RRHeader(val={'Type':52}),
Type3V('TLLI', val={'V':4*b'\0'}, bl={'V':32}, IE=TLLI()),
Type3V('RAI', val={'V':b'\0\xf1\x10\0\0\0'}, bl={'V':48}, IE=RAI()),
Type3V('SuspensionCause', val={'V':b'\0'}, bl={'V':8}, IE=SuspensionCause()),
Type3TV('ServiceSupport', val={'T':0x1, 'V':b'\0'}, bl={'V':8}, IE=ServiceSupport())
)
#------------------------------------------------------------------------------#
# HANDOVER ACCESS
# TS 44.018, section 9.1.14
#------------------------------------------------------------------------------#
# this is just 1 byte with a random reference
#------------------------------------------------------------------------------#
# HANDOVER COMMAND
# TS 44.018, section 9.1.15
#------------------------------------------------------------------------------#
class RRHandoverCmd(Layer3):
_GEN = (
RRHeader(val={'Type':43}),
Type3V('CellDesc', val={'V':b'\0\0'}, bl={'V':16}, IE=CellDesc()),
Type3V('FirstChanDescAfter', val={'V':b'\0\0\0'}, bl={'V':24}, IE=ChanDesc2()),
Type3V('HandoverRef', val={'V':b'\0'}, bl={'V':8}, IE=HandoverRef()),
Type3V('PowerCmdAccType', val={'V':b'\0'}, bl={'V':8}, IE=PowerCmdAccType()),
Type1TV('SynchInd', val={'T':0xD, 'V':0}, IE=SynchInd()),
Type3TV('FreqShortListAfter', val={'T':0x2, 'V':9*b'\0'}, bl={'V':72}, IE=FreqShortList()),
Type4TLV('FreqListAfter', val={'T':0x5, 'V':b'\0\0'}, IE=FreqList()),
Type3TV('CellChan', val={'T':0x62, 'V':16*b'\0'}, bl={'V':128}, IE=CellChan()),
Type4TLV('MultislotAlloc', val={'T':0X10, 'V':b'\0'}, IE=MultislotAlloc()),
Type3TV('ChanModeSet1', val={'T':0x63, 'V':b'\0'}, bl={'V':8}, IE=ChanMode()),
Type3TV('ChanModeSet2', val={'T':0x11, 'V':b'\0'}, bl={'V':8}, IE=ChanMode()),
Type3TV('ChanModeSet3', val={'T':0x13, 'V':b'\0'}, bl={'V':8}, IE=ChanMode()),
Type3TV('ChanModeSet4', val={'T':0x14, 'V':b'\0'}, bl={'V':8}, IE=ChanMode()),
Type3TV('ChanModeSet5', val={'T':0x15, 'V':b'\0'}, bl={'V':8}, IE=ChanMode()),
Type3TV('ChanModeSet6', val={'T':0x16, 'V':b'\0'}, bl={'V':8}, IE=ChanMode()),
Type3TV('ChanModeSet7', val={'T':0x17, 'V':b'\0'}, bl={'V':8}, IE=ChanMode()),
Type3TV('ChanModeSet8', val={'T':0x18, 'V':b'\0'}, bl={'V':8}, IE=ChanMode()),
Type3TV('SecondChanDescAfter', val={'T':0x64, 'V':b'\0\0\0'}, bl={'V':24}, IE=ChanDesc()),
Type3TV('SecondChanMode', val={'T':0x66, 'V':b'\0'}, bl={'V':8}, IE=ChanMode2()),
Type3TV('FreqChanSeqAfter', val={'T':0x69, 'V':9*b'\0'}, bl={'V':72}, IE=FreqChanSeq()),
Type4TLV('MobileAllocAfter', val={'T':0x72, 'V':b'\0'}, IE=MobileAlloc()),
Type3TV('StartingTime', val={'T':0x7C, 'V':b'\0\0'}, bl={'V':16}, IE=StartingTime()),
Type4TLV('RealTimeDiff', val={'T':0x7B, 'V':b'\0'}, IE=TimeDiff()),
Type3TV('TimingAdvance', val={'T':0x7D, 'V':b'\0'}, bl={'V':8}, IE=TimingAdvance()),
Type3TV('FreqShortListBefore', val={'T':0x12, 'V':9*b'\0'}, bl={'V':72}, IE=FreqShortList()),
Type4TLV('FreqListBefore', val={'T':0x19, 'V':b'\0\0'}, IE=FreqList()),
Type3TV('FirstChanDescBefore', val={'T':0x1C, 'V':b'\0\0\0'}, bl={'V':24}, IE=ChanDesc2()),
Type3TV('SecondChanDescBefore', val={'T':0x1D, 'V':b'\0\0\0'}, bl={'V':24}, IE=ChanDesc()),
Type3TV('FreqChanSeqBefore', val={'T':0x1E, 'V':9*b'\0'}, bl={'V':72}, IE=FreqChanSeq()),
Type4TLV('MobileAllocBefore', val={'T':0x21, 'V':b'\0'}, IE=MobileAlloc()),
Type1TV('CipherModeSetting', val={'T':0x9, 'V':0}, IE=CipherModeSetting()),
Type4TLV('VGCSTargetModeInd', val={'T':0x1, 'V':b'\0'}, IE=VGCSTargetModeInd()),
Type4TLV('MultirateConfig', val={'T':0x3, 'V':b'\0\0'}, IE=MultirateConfig()),
Type4TLV('DynARFCNMapping', val={'T':0x76, 'V':4*b'\0'}, IE=dynamic_arfcn_mapping),
Type4TLV('VGCSCipherParams', val={'T':0x4, 'V':b'\0'}, IE=VGCSCipherParams()),
Type3TV('DedicatedServiceInfo', val={'T':0x51, 'V':b'\0'}, IE=DedicatedServiceInfo()),
Type1TV('PLMNIndex', val={'T':0xA, 'V':0}, dic=PLMNIndex_dict),
Type3TV('ExtTSCSetAfter', val={'T':0x6D, 'V':b'\0'}, bl={'V':8}, IE=ExtTSCSet()),
Type3TV('ExtTSCSetBefore', val={'T':0x6E, 'V':b'\0'}, bl={'V':8}, IE=ExtTSCSet())
)
#------------------------------------------------------------------------------#
# INTER SYSTEM TO UTRAN HANDOVER COMMANDd
# TS 44.018, section 9.1.15a
#------------------------------------------------------------------------------#
class RRInterSystemUTRANHOCmd(Layer3):
_GEN = (
RRHeader(val={'Type':99}),
Type4LV('HOToUTRANCmd', val={'V':b'\0'}), # see TS 25.331
Type4TLV('CNToMSTransparentInfo', val={'V':b'\0'}) # see TS 48.008
)
#------------------------------------------------------------------------------#
# INTER SYSTEM TO CDMA2000 HANDOVER COMMAND
# TS 44.018, section 9.1.15b
#------------------------------------------------------------------------------#
class RRInterSystemCdma200HOCmd(Layer3):
_GEN = (
RRHeader(val={'Type':100}),
Type4LV('HOToCdma2000Cmd', val={'V':b'\0\0\0'}) # see TIA/EIA/IS-2000
)
#------------------------------------------------------------------------------#
# HANDOVER TO GERAN Iu MODE Command
# TS 44.018, section 9.1.15c
#------------------------------------------------------------------------------#
# This message has however no defined type
#------------------------------------------------------------------------------#
# INTER SYSTEM TO E-UTRAN HANDOVER COMMAND
# TS 44.018, section 9.1.15d
#------------------------------------------------------------------------------#
class RRInterSystemEUTRANHOCmd(Layer3):
_GEN = (
RRHeader(val={'Type':102}),
Type4LV('DL-DCCH-Message', val={'V':b'\0'}), # see TS 36.331
Type4TLV('CNToMSTransparentInfo', val={'V':b'\0'}) # see TS 48.008
)
#------------------------------------------------------------------------------#
# HANDOVER COMPLETE
# TS 44.018, section 9.1.16
#------------------------------------------------------------------------------#
class RRHandoverComplete(Layer3):
_GEN = (
RRHeader(val={'Type':44}),
Type3V('RRCause', val={'V':b'\0'}, bl={'V':8}, IE=RRCause()),
Type4TLV('MobileObservedTimeDiff', val={'V':b'\0\0\0'}, IE=MobileTimeDiff()),
Type4TLV('MobileObservedTimeDiffHFLevel', val={'V':5*b'\0'}, IE=MobileTimeDiffHFLevel()),
)
#------------------------------------------------------------------------------#
# HANDOVER FAILURE
# TS 44.018, section 9.1.17
#------------------------------------------------------------------------------#
class RRHandoverFailure(Layer3):
_GEN = (
RRHeader(val={'Type':40}),
Type3V('RRCause', val={'V':b'\0'}, bl={'V':8}, IE=RRCause()),
Type1TV('PSCause', val={'T':0x9, 'V':0}, dic=PSCause_dict),
)
#------------------------------------------------------------------------------#
# IMMEDIATE ASSIGNMENT
# TS 44.018, section 9.1.18
#------------------------------------------------------------------------------#
def get_tbf(l3msg):
v = l3msg[2][0].get_val()
if isinstance(v, str_types):
if python_version:
return v[0] & 1
else:
return ord(v[0]) & 1
elif isinstance(v, list):
return v[-1]
else:
return 0
class RRImmediateAssignment(Layer3):
_GEN = (
L2PseudoLength(excl=(0, 12)),
RRHeader(val={'Type':63}),
Type1V('DedicatedModeOrTBF', val={'V':0}, IE=DedicatedModeOrTBF()),
Type1V('PageMode', val={'V':0}, dic=PageMode_dict),
Alt(GEN={
0: Type3V('ChanDesc', val={'V':b'\0\0\0'}, bl={'V':24}, IE=ChanDesc()),
1: Type3V('PChanDesc', val={'V':b'\0\0\0'}, bl={'V':24}, IE=packet_channel_description)},
sel=lambda self: get_tbf(self.get_env())),
Type3V('RequestRef', val={'V':b'\0\0\0'}, bl={'V':24}, IE=RequestRef()),
Type3V('TimingAdvance', val={'V':b'\0'}, bl={'V':8}, IE=TimingAdvance()),
Type4LV('MobileAlloc', val={'V':b'\0'}, IE=MobileAlloc()),
Type3TV('StartingTime', val={'T':0x7C, 'V':b'\0\0'}, bl={'V':16}, IE=StartingTime()),
RestOctets('IARestOctets', IE=ia_rest_octets),
Type3TV('ExtTSCSet', val={'T':0x6D, 'V':b'\0'}, bl={'V':8}, IE=ExtTSCSet())
)
#------------------------------------------------------------------------------#
# IMMEDIATE PACKET ASSIGNMENT
# TS 44.018, section 9.1.18b
#------------------------------------------------------------------------------#
class RRImmediatePacketAssignment(Layer3):
_GEN = (
L2PseudoLength(),
RRHeader(val={'Type':105}),
Type1V('FeatureInd', val={'V':0}, IE=FeatureInd()),
Type1V('PageMode', val={'V':0}, dic=PageMode_dict),
RestOctets('IPARestOctets', IE=ipa_rest_octets),
Type3TV('RequestRef1', val={'T':0x5, 'V':b'\0\0\0\0'}, bl={'V':32}, IE=RequestRefAlt()),
Type3TV('RequestRef2', val={'T':0x6, 'V':b'\0\0\0\0'}, bl={'V':32}, IE=RequestRefAlt()),
Type3TV('RequestRef3', val={'T':0x7, 'V':b'\0\0\0\0'}, bl={'V':32}, IE=RequestRefAlt()),
Type3TV('RequestRef4', val={'T':0x8, 'V':b'\0\0\0\0'}, bl={'V':32}, IE=RequestRefAlt()),
)
#------------------------------------------------------------------------------#
# IMMEDIATE ASSIGNMENT EXTENDED
# TS 44.018, section 9.1.19
#------------------------------------------------------------------------------#
class RRImmediateAssignmentExt(Layer3):
_GEN = (
L2PseudoLength(),
RRHeader(val={'Type':57}),
Type1V('FeatureInd', val={'V':0}, IE=FeatureInd()),
Type1V('PageMode', val={'V':0}, dic=PageMode_dict),
Type3V('ChanDesc1', val={'V':b'\0\0\0'}, bl={'V':24}, IE=ChanDesc()),
Type3V('RequestRef1', val={'V':b'\0\0\0'}, bl={'V':24}, IE=RequestRef()),
Type3V('TimingAdvance1', val={'V':b'\0'}, bl={'V':8}, IE=TimingAdvance()),
Type3V('ChanDesc2', val={'V':b'\0\0\0'}, bl={'V':24}, IE=ChanDesc()),
Type3V('RequestRef2', val={'V':b'\0\0\0'}, bl={'V':24}, IE=RequestRef()),
Type3V('TimingAdvance2', val={'V':b'\0'}, bl={'V':8}, IE=TimingAdvance()),
Type4LV('MobileAlloc', val={'V':b'\0'}, IE=MobileAlloc()),
Type3TV('StartingTime', val={'T':0x7C, 'V':b'\0\0'}, bl={'V':16}, IE=StartingTime()),
RestOctets('IAXRestOctets', IE=iax_rest_octets)
)
#------------------------------------------------------------------------------#
# IMMEDIATE ASSIGNMENT REJECT
# TS 44.018, section 9.1.
#------------------------------------------------------------------------------#
class RRImmediateAssignmentReject(Layer3):
_GEN = (
L2PseudoLength(),
RRHeader(val={'Type':58}),
Type1V('FeatureInd', val={'V':0}, IE=FeatureInd()),
Type1V('PageMode', val={'V':0}, dic=PageMode_dict),
Type3V('RequestRef1', val={'V':b'\0\0\0'}, bl={'V':24}, IE=RequestRef()),
Type3V('WaitInd1', val={'V':b'\0'}, bl={'V':8}, IE=T3122()),
Type3V('RequestRef2', val={'V':b'\0\0\0'}, bl={'V':24}, IE=RequestRef()),
Type3V('WaitInd2', val={'V':b'\0'}, bl={'V':8}, IE=T3122()),
Type3V('RequestRef3', val={'V':b'\0\0\0'}, bl={'V':24}, IE=RequestRef()),
Type3V('WaitInd3', val={'V':b'\0'}, bl={'V':8}, IE=T3122()),
Type3V('RequestRef4', val={'V':b'\0\0\0'}, bl={'V':24}, IE=RequestRef()),
Type3V('WaitInd4', val={'V':b'\0'}, bl={'V':8}, IE=T3122()),
RestOctets('IARRestOctets', IE=iar_rest_octets)
)
'''
#------------------------------------------------------------------------------#
#
# TS 44.018, section 9.1.
#------------------------------------------------------------------------------#
class RR(Envelope):
class RR(Layer3):
_GEN = (
RRHeader(val={'Type':}),
@ -468,7 +784,20 @@ class RR(Envelope):
# TS 44.018, section 9.1.
#------------------------------------------------------------------------------#
class RR(Envelope):
class RR(Layer3):
_GEN = (
RRHeader(val={'Type':}),
)
#------------------------------------------------------------------------------#
#
# TS 44.018, section 9.1.
#------------------------------------------------------------------------------#
class RR(Layer3):
_GEN = (
RRHeader(val={'Type':}),
@ -480,7 +809,7 @@ class RR(Envelope):
# TS 44.018, section 9.1.
#------------------------------------------------------------------------------#
class RR(Envelope):
class RR(Layer3):
_GEN = (
RRHeader(val={'Type':}),
@ -492,7 +821,7 @@ class RR(Envelope):
# TS 44.018, section 9.1.
#------------------------------------------------------------------------------#
class RR(Envelope):
class RR(Layer3):
_GEN = (
RRHeader(val={'Type':}),
@ -504,7 +833,43 @@ class RR(Envelope):
# TS 44.018, section 9.1.
#------------------------------------------------------------------------------#
class RR(Envelope):
class RR(Layer3):
_GEN = (
RRHeader(val={'Type':}),
)
#------------------------------------------------------------------------------#
#
# TS 44.018, section 9.1.
#------------------------------------------------------------------------------#
class RR(Layer3):
_GEN = (
RRHeader(val={'Type':}),
)
#------------------------------------------------------------------------------#
#
# TS 44.018, section 9.1.
#------------------------------------------------------------------------------#
class RR(Layer3):
_GEN = (
RRHeader(val={'Type':}),
)
#------------------------------------------------------------------------------#
#
# TS 44.018, section 9.1.
#------------------------------------------------------------------------------#
class RR(Layer3):
_GEN = (
RRHeader(val={'Type':}),
@ -517,7 +882,7 @@ class RR(Envelope):
# TS 44.018, section 9.1.25
#------------------------------------------------------------------------------#
class RRPagingResponse(Envelope):
class RRPagingResponse(Layer3):
_GEN = (
RRHeader(val={'Type':39}),
Uint('spare', bl=4),