mobile: add the MAP 29.002 AddressString specific structure
This commit is contained in:
parent
f94d1f5595
commit
7e0c8cc2b4
|
@ -25,16 +25,17 @@
|
|||
# * Authors : Benoit Michau
|
||||
# *--------------------------------------------------------
|
||||
#*/
|
||||
#
|
||||
|
||||
from pycrate_int_asn1dir.TCAP_MAPv2v3 import GLOBAL as GLOBAL_MAPv2v3
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# MAP application context functions
|
||||
#
|
||||
#------------------------------------------------------------------------------#
|
||||
|
||||
# making use of the almighty MAPv2v3 module
|
||||
from pycrate_int_asn1dir.TCAP_MAPv2v3 import *
|
||||
|
||||
Operations = GLOBAL.MOD['MAPv2v3-Protocol']['Supported-MAP-Operations']
|
||||
OperationPkgs = GLOBAL.MOD['MAPv2v3-Application']['Supported-MAP-OperationPackages']
|
||||
ApplicationCtxs = GLOBAL.MOD['MAPv2v3-Application']['Supported-MAP-ApplicationContexts']
|
||||
Operations = GLOBAL_MAPv2v3.MOD['MAPv2v3-Protocol']['Supported-MAP-Operations']
|
||||
OperationPkgs = GLOBAL_MAPv2v3.MOD['MAPv2v3-Application']['Supported-MAP-OperationPackages']
|
||||
ApplicationCtxs = GLOBAL_MAPv2v3.MOD['MAPv2v3-Application']['Supported-MAP-ApplicationContexts']
|
||||
|
||||
|
||||
def get_operation(opcode):
|
||||
|
@ -57,7 +58,7 @@ def list_operation_pkg_names():
|
|||
"""returns the list of names of defined MAP operation-packages
|
||||
"""
|
||||
names = []
|
||||
for name in GLOBAL.MOD['MAPv2v3-Application']['_val_']:
|
||||
for name in GLOBAL_MAPv2v3.MOD['MAPv2v3-Application']['_val_']:
|
||||
if name.split('-')[-2][-7:] == 'Package':
|
||||
names.append(name)
|
||||
return names
|
||||
|
@ -67,7 +68,7 @@ def list_application_ctx_names():
|
|||
"""returns the list of names of defined MAP application-contexts
|
||||
"""
|
||||
names = []
|
||||
for name in GLOBAL.MOD['MAPv2v3-Application']['_val_']:
|
||||
for name in GLOBAL_MAPv2v3.MOD['MAPv2v3-Application']['_val_']:
|
||||
if name.split('-')[-2][-7:] == 'Context':
|
||||
names.append(name)
|
||||
return names
|
||||
|
@ -82,7 +83,7 @@ def get_operation_pkgs(opcode, mode='S'):
|
|||
ret = {}
|
||||
key = 'Supplier' if mode in ('s', 'S') else 'Consumer'
|
||||
for opname in list_operation_pkg_names():
|
||||
opval = GLOBAL.MOD['MAPv2v3-Application'][opname]._val
|
||||
opval = GLOBAL_MAPv2v3.MOD['MAPv2v3-Application'][opname]._val
|
||||
if key not in opval:
|
||||
continue
|
||||
for oval in opval[key].getv():
|
||||
|
@ -118,7 +119,7 @@ def get_application_ctxs(opcode, mode='I'):
|
|||
key = ('Symmetric', 'InitiatorConsumerOf') if mode in ('I', 'i') else ('Symmetric', 'ResponderConsumerOf')
|
||||
keyrev = ('Symmetric', 'ResponderConsumerOf') if mode in ('I', 'i') else ('Symmetric', 'InitiatorConsumerOf')
|
||||
for acname in list_application_ctx_names():
|
||||
acval = GLOBAL.MOD['MAPv2v3-Application'][acname]._val
|
||||
acval = GLOBAL_MAPv2v3.MOD['MAPv2v3-Application'][acname]._val
|
||||
# looking at Supplier within the Initiator potential operation-package
|
||||
for k in key:
|
||||
if k in acval:
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
# −*− coding: UTF−8 −*−
|
||||
#/**
|
||||
# * Software Name : pycrate
|
||||
# * Version : 0.4.0
|
||||
# *
|
||||
# * Copyright © 2019. Benoit Michau. P1Sec.
|
||||
# *
|
||||
# * This program is free software: you can redistribute it and/or modify
|
||||
# * it under the terms of the GNU General Public License version 2 as published
|
||||
# * by the Free Software Foundation.
|
||||
# *
|
||||
# * This program is distributed in the hope that it will be useful,
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# * GNU General Public License for more details.
|
||||
# *
|
||||
# * You will find a copy of the terms and conditions of the GNU General Public
|
||||
# * License version 2 in the "license.txt" file or
|
||||
# * see http://www.gnu.org/licenses/ or write to the Free Software Foundation,
|
||||
# * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
# *
|
||||
# *--------------------------------------------------------
|
||||
# * File Name : pycrate_mobile/TS29002_MAPIE.py
|
||||
# * Created : 2019-12-05
|
||||
# * Authors : Benoit Michau
|
||||
# *--------------------------------------------------------
|
||||
#*/
|
||||
|
||||
from pycrate_core.utils import *
|
||||
from pycrate_core.elt import *
|
||||
from pycrate_core.base import *
|
||||
|
||||
from pycrate_mobile.TS24008_IE import BufBCD
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# AddressString
|
||||
#------------------------------------------------------------------------------#
|
||||
|
||||
_AddressStrNumType_dict = {
|
||||
0 : 'unknown',
|
||||
1 : 'international number',
|
||||
2 : 'national significant number',
|
||||
3 : 'network specific number',
|
||||
4 : 'subscriber number',
|
||||
5 : 'reserved',
|
||||
6 : 'abbreviated number',
|
||||
7 : 'reserved for extension'
|
||||
}
|
||||
|
||||
_AddressStrNumPlan_dict = {
|
||||
0 : 'unknown',
|
||||
1 : 'ISDN/Telephony Numbering Plan (Rec ITU-T E.164)',
|
||||
2 : 'spare',
|
||||
3 : 'data numbering plan (ITU-T Rec X.121)',
|
||||
4 : 'telex numbering plan (ITU-T Rec F.69)',
|
||||
5 : 'spare',
|
||||
6 : 'land mobile numbering plan (ITU-T Rec E.212)',
|
||||
7 : 'spare',
|
||||
8 : 'national numbering plan',
|
||||
9 : 'private numbering plan',
|
||||
15 : 'reserved for extension'
|
||||
}
|
||||
|
||||
|
||||
class AddressString(Envelope):
|
||||
_GEN = (
|
||||
Uint('Ext', val=1, bl=1),
|
||||
Uint('NumType', bl=3, dic=_AddressStrNumType_dict),
|
||||
Uint('NumPlan', bl=4, dic=_AddressStrNumPlan_dict),
|
||||
Alt('Num', GEN={
|
||||
1 : BufBCD('E164'),
|
||||
6 : BufBCD('E212'),
|
||||
},
|
||||
DEFAULT=Buf('Hex', val=b'', rep=REPR_HEX),
|
||||
sel=lambda self: self.get_env()[2].get_val())
|
||||
)
|
||||
|
Loading…
Reference in New Issue