Exemple #1
0
class SI_4(Layer3):
    '''
    Net -> ME  (in BCCH)
    Dual
    '''
    constructorList = [ie for ie in LengthRR()] + [ie for ie in Header(6, 28)]
    def __init__(self, with_options=True, **kwargs):
        Layer3.__init__(self)
        self.extend([ \
            Str('LAI', ReprName='Location Area Identity', Pt=LAI(), Len=5, \
                Repr='hex'), # 44018, 10.5.1.3, in L3Mobile_IE.py
            Str('CellSel', ReprName='Cell Selection Parameters', \
                Pt=CellSel(), Len=2), # 44018, 10.5.2.4
            Str('RACHCtrl', ReprName='RACH Control Parameters', Pt=RACHCtrl(),\
                Len=3), # 44018, 10.5.2.29, in L3GSM_IE.py
            Type3_TV('ChanDesc', ReprName='CBCH Channel Description', T=0x7C, \
                V=ChanDesc(), Len=3), # 44018, 10.5.2.5, in L3GSM_IE.py
            Type4_TLV('MobAlloc', ReprName='CBCH Mobile Allocation', T=0x72, \
                V=MobAlloc()), # 44018, 10.5.2.21, in L3GSM_IE.py
            StrRR('SI4RestOctets', Repr='hex')]) # 44018, 10.5.2.35
        self._post_init(with_options, **kwargs)
        if hasattr(self.CellSel, 'ACS'): self.CellSel.ACS.Dict = ACS_SI4_dict
        # L2 pseudo header automation
        self.len.Pt = self.MobAlloc
        self.len.PtFunc = lambda m: len(m)+16
        self.SI4RestOctets.Len = self.len
        self.SI4RestOctets.LenFunc = lambda l: 22-l()
Exemple #2
0
class PAGING_REQUEST_2(Layer3):
    '''
    Net -> ME (in CCCH)
    Dual
    '''
    constructorList = [ie for ie in LengthRR()] + [ie for ie in Header(6, 34)]
    def __init__(self, with_options=True, **kwargs):
        Layer3.__init__(self)
        self.extend([ \
            Bit('ChanNeedID2', ReprName='Channel needed', Pt=1, BitLen=2, \
               Dict=ChanNeed_dict, Repr='hum'), # 10.5.2.8
            Bit('ChanNeedID1', ReprName='Channel needed', Pt=1, BitLen=2, \
               Dict=ChanNeed_dict, Repr='hum'), # 10.5.2.8
            Bit('Page', ReprName='Page mode', Pt=0, BitLen=4, \
               Dict=Page_dict, Repr='hum'), # 10.5.2.26
            # only TMSI / P-TMSI, 10.5.2.42, for the 2 mandatory IDs
            Str('TMSI_1', Pt='\0\0\0\0', Len=4, Repr='hex'),
            Str('TMSI_2', Pt='\0\0\0\0', Len=4, Repr='hex'),
            Type4_TLV('ID', T=0x17, V=ID()), # can be MBMS, but never IMEI
            StrRR('P2RestOctets', Repr='hex')])
        self._post_init(with_options, **kwargs)
        # Now, automatic fields
        # L2 pseudo header
        self.len.Pt = self.ID
        self.len.PtFunc = lambda i:  len(i)+11
        self.P2RestOctets.Len = self.len
        self.P2RestOctets.LenFunc = lambda l: 22-l()
Exemple #3
0
class SI_3(Layer3):
    '''
    Net -> ME  (in BCCH)
    Dual
    '''
    constructorList = [ie for ie in LengthRR()] + [ie for ie in Header(6, 27)]
    def __init__(self, with_options=True, **kwargs):
        Layer3.__init__(self)
        self.extend([ \
            Str('CellID', Pt='\0\0', ReprName='Cell identity', Len=2, \
                Repr='hex'), # 44018, 10.5.1.1
            Str('LAI', ReprName='Location Area Identity', Pt=LAI(), \
                Len=5), # 44018, 10.5.1.3, in L3Mobile_IE.py
            Str('CChanDesc', ReprName='Control Channel Description', \
                Pt=CChanDesc(), Len=3), # 44018, 10.5.2.11, in L3GSM_IE.py
            Str('CellOpt', ReprName='Cell Options (BCCH)', Pt=CellOpt(), \
                Len=1), # 44018, 10.5.2.3, in L3GSM_IE.py
            Str('CellSel', ReprName='Cell Selection Parameters', \
                Pt=CellSel(), Len=2), # 44018, 10.5.2.4
            Str('RACHCtrl', ReprName='RACH Control Parameters', Pt=RACHCtrl(),\
                Len=3), # 44018, 10.5.2.29
            StrRR('SI3RestOctets', Len=4, Repr='hex')]) # 44018, 10.5.2.33a
        self._post_init(with_options, **kwargs)
        self.len.Pt = 18
        if hasattr(self.CellSel, 'ACS'):
            self.CellSel.ACS.Dict = ACS_SI3_dict
Exemple #4
0
class PAGING_REQUEST_1(Layer3):
    '''
    Net -> ME (in CCCH)
    Dual
    # content #
    Page mode: 4 bits
    ... options ...
    '''
    constructorList = [ie for ie in LengthRR()] + [ie for ie in Header(6, 33)]
    def __init__(self, with_options=True, **kwargs):
        Layer3.__init__(self)
        self.extend([ \
            Bit('ChanNeedID2', ReprName='Channel needed', Pt=1, BitLen=2, \
               Dict=ChanNeed_dict, Repr='hum'), # 10.5.2.8
            Bit('ChanNeedID1', ReprName='Channel needed', Pt=1, BitLen=2, \
               Dict=ChanNeed_dict, Repr='hum'), # 10.5.2.8
            Bit('Page', ReprName='Page mode', Pt=0, BitLen=4, \
               Dict= Page_dict, Repr='hum'), # 10.5.2.26
            Type4_LV('ID', V=ID()), # never IMEI, in L3Mobile_IE.py
            Type4_TLV('ID_2', T=0x17, V=ID()), # never IMEI, in L3Mobile_IE.py
            StrRR('P1RestOctets', Repr='hex')])
        self._post_init(with_options, **kwargs)
        # L2 pseudo header automation
        self.len.Pt = (self.ID, self.ID_2)
        self.len.PtFunc = lambda x: sum(map(len, x))+3
        self.P1RestOctets.Len = self.len
        self.P1RestOctets.LenFunc = lambda l: 22-l()
Exemple #5
0
class SI_13(Layer3):
    '''
    Net -> ME  (in BCCH)
    Dual
    '''
    constructorList = [ie for ie in LengthRR()] + [ie for ie in Header(6, 0)]
    def __init__(self, with_options=True, **kwargs):
        Layer3.__init__(self)
        self.extend([ \
            StrRR('SI13RestOctets', Len=20, Repr='hex')]) # 44018, 10.5.2.33a
        self._post_init(with_options, **kwargs)
        self.len.Pt = 0
Exemple #6
0
class SI_2(Layer3):
    '''
    Net -> ME (in BCCH)
    Dual
    '''
    constructorList = [ie for ie in LengthRR()] + [ie for ie in Header(6, 26)]
    def __init__(self, with_options=True, **kwargs):
        Layer3.__init__(self)
        self.extend([ \
            Str('BCCHFreq', ReprName='Neighbour Cell Description', \
                Pt=BCCHFreq(), Len=16), # 44018, 10.5.2.22, in L3GSM_IE.py
            Bit('NCCPerm', ReprName='NCC Permitted', Pt=255, BitLen=8, \
                Repr='bin'), # 44018, 10.5.2.27
            Str('RACHCtrl', ReprName='RACH Control Parameters', Pt=RACHCtrl(),\
                Len=3)]) # 44018, 10.5.2.29, in L3GSM_IE.py
        self._post_init(with_options, **kwargs)
        self.len.Pt = 22
Exemple #7
0
class IMMEDIATE_ASSIGNMENT(Layer3):
    '''
    Net -> ME (in CCCH)
    Dual
    # content #
    Page mode: 4 bits
    Dedicated mode: 4 bits,
    Channel description: 3 bytes, conditional to Dedicated mode
    Packet channel description: 3 bytes, conditional to Dedicated mode
    ... options ...
    '''
    constructorList = [ie for ie in LengthRR()] + [ie for ie in Header(6, 63)]
    def __init__(self, with_options=True, **kwargs):
        Layer3.__init__(self)
        self.extend([ \
            Bit('Dedicated', ReprName='Dedicated mode or TBF', Pt=0, \
                BitLen=4, Repr='hum', Dict=Dedic_dict),
            Bit('Page', ReprName='Page mode', Pt=0, BitLen=4, Repr='hum', \
                Dict=Page_dict),
            Str('ChanDesc', ReprName='Channel description', \
                Pt=ChanDesc(), Len=3), # 44018, 10.5.2.5, in L3GSM_IE.py
            Str('PChanDesc', ReprName='Packet channel description', \
                Pt=PChanDesc(build_auto=True), Len=3), # TODO: 44018, 10.5.2.25a
            Str('ReqRef', ReprName='Request reference', Pt=ReqRef(), \
                Len=3), # TODO: 44018, 10.5.2.30
            Int('TimeAdv', ReprName='Timing Advance', Pt=0, Type='uint8'),
            Type4_LV('MobAlloc', ReprName='Mobile allocation', \
                     V=MobAlloc()), # 44018, 10.5.2.21, in L3GSM_IE.py
            Type3_TV('Start', ReprName='Starting time', T=0x7C, \
                     V='\0\0', Len=2), # 44018, 10.5.2.38
            StrRR('IARestOctets', Repr='hex')]) # 44018, 10.5.2.16
        self._post_init(with_options, **kwargs)
        # L2 pseudo header automation
        self.len.Pt = (self.ChanDesc, self.PChanDesc, self.MobAlloc, self.Start)
        self.len.PtFunc = lambda x: sum(map(len, x))+7
        self.IARestOctets.Len = self.len
        self.IARestOctets.LenFunc = lambda l: 22-l()
        # Handling of packet / CS dedicated chan assignment
        self.ChanDesc.Trans = self.Dedicated
        self.ChanDesc.TransFunc = lambda dedi: False if dedi() == 0 else True
        self.PChanDesc.Trans = self.Dedicated
        self.PChanDesc.TransFunc = lambda dedi: False if dedi() in (1,3,5,7) \
                                                else True
Exemple #8
0
class SI_2ter(Layer3):
    '''
    Net -> ME (in BCCH)
    Dual
    '''
    constructorList = [ie for ie in LengthRR()] + [ie for ie in Header(6, 3)]
    def __init__(self, with_options=True, **kwargs):
        Layer3.__init__(self)
        self.extend([ \
            Str('ExtBCCHFreq', ReprName='Neighbour Cell Description', \
                Pt=ExtBCCHFreq(), Len=16), # 44018, 10.5.2.22, in L3GSM_IE.py
            #StrRR('SI2terRestOctets', Len=4, Repr='hex')]) # 10.5.2.33a
            StrRR('SI2terRestOctets', Repr='hex')])
        self._post_init(with_options, **kwargs)
        #self.len.Pt = 18
        # standard rest octet is 4 bytes for SI2ter
        # L2 pseudo header automation
        self.len.Pt = self.ExtBCCHFreq
        self.len.PtFunc = lambda e: len(e)+2
        self.SI2terRestOctets.Len = self.len
        self.SI2terRestOctets.LenFunc = lambda l: 22-l()
Exemple #9
0
class SI_2bis(Layer3):
    '''
    Net -> ME (in BCCH)
    Dual
    '''
    constructorList = [ie for ie in LengthRR()] + [ie for ie in Header(6, 2)]
    def __init__(self, with_options=True, **kwargs):
        Layer3.__init__(self)
        self.extend([ \
            Str('ExtBCCHFreq', ReprName='Neighbour Cell Description', \
                Pt=ExtBCCHFreq(), Len=16), # 44018, 10.5.2.22, in L3GSM_IE.py
            Str('RACHCtrl', ReprName='RACH Control Parameters', Pt=RACHCtrl(),\
                Len=3), # 44018, 10.5.2.29, in L3GSM_IE.py
            StrRR('SI2bisRestOctets', Len=1, Repr='hex')]) # 10.5.2.33
        self._post_init(with_options, **kwargs)
        #self.len.Pt = 21
        # standard rest octet is 1 byte for SI2bis
        # L2 pseudo header automation
        self.len.Pt = (self.ExtBCCHFreq, self.RACHCtrl)
        self.len.PtFunc = lambda (e, r): len(e)+len(r)+2
        self.SI2bisRestOctets.Len = self.len
        self.SI2bisRestOctets.LenFunc = lambda l: 22-l()
Exemple #10
0
class PAGING_REQUEST_3(Layer3):
    '''
    Net -> ME (in CCCH)
    Dual
    '''
    constructorList = [ie for ie in LengthRR()] + [ie for ie in Header(6, 36)]
    def __init__(self, with_options=True, **kwargs):
        Layer3.__init__(self)
        self.extend([ \
            Bit('ChanNeedID2', ReprName='Channel needed', Pt=1, BitLen=2, \
               Dict=ChanNeed_dict, Repr='hum'), # 10.5.2.8
            Bit('ChanNeedID1', ReprName='Channel needed', Pt=1, BitLen=2, \
               Dict=ChanNeed_dict, Repr='hum'), # 10.5.2.8
            Bit('Page', ReprName='Page mode', Pt=0, BitLen=4, \
               Dict=Page_dict, Repr='hum'), # 10.5.2.26
            # only TMSI / P-TMSI, 10.5.2.42, for the 4 mandatory IDs
            Str('TMSI_1', Pt='\0\0\0\0', Len=4, Repr='hex'),
            Str('TMSI_2', Pt='\0\0\0\0', Len=4, Repr='hex'),
            Str('TMSI_3', Pt='\0\0\0\0', Len=4, Repr='hex'),
            Str('TMSI_4', Pt='\0\0\0\0', Len=4, Repr='hex'),
            StrRR('P3RestOctets', Len=3, Repr='hex')]) # 10.5.2.25
        self._post_init(with_options, **kwargs)
        self.len.Pt = 19
Exemple #11
0
class SI_1(Layer3):
    '''
    Net -> ME (in BCCH)
    Dual
    '''
    constructorList = [ie for ie in LengthRR()] + [ie for ie in Header(6, 25)]
    def __init__(self, with_options=True, **kwargs):
        Layer3.__init__(self)
        self.extend([ \
            Str('CellChan', ReprName='Cell Channel Description', \
                Pt=CellChan(), Len=16), # 44018, 10.5.2.1b, in L3Mobile_RR.py
            Str('RACHCtrl', ReprName='RACH Control Parameters', Pt=RACHCtrl(),\
                Len=3), # 44018, 10.5.2.29, in L3Mobile_RR.py
            # rest octet is purely padding: 2b
            StrRR('SI1RestOctets', Repr='hex')])
            #StrRR('SI1RestOctets', Len=1, Repr='hex')]) # 10.5.2.32
        self._post_init(with_options, **kwargs)
        #self.len.Pt = 21
        # standard rest octet is 1 byte for SI1
        # L2 pseudo header automation
        self.len.Pt = (self.CellChan, self.RACHCtrl)
        self.len.PtFunc = lambda (c, r): len(c)+len(r)+2
        self.SI1RestOctets.Len = self.len
        self.SI1RestOctets.LenFunc = lambda l: 22-l()