decode_33128.py 1.16 KB
Newer Older
haint's avatar
haint committed
from compile_asn import *
from array import array

from encode_33128 import *
haint's avatar
haint committed

# this is a sample record of a TS 133 128 "IRIPayload" embedded inside of a PS-PDU
haint's avatar
haint committed
# it seems, that the python asn1tools doesnt support the "EXTENSIBILITY IMPLIED" feature that
haint's avatar
haint committed
# is used in the 33-128.asn definition - so this record is not decoded when using version 16 of 33-128.asn unless you manually modify the schema.
# asn1c seems to have the same issues. This means, the implementations are not forward compatible :-(

compiler = getCompilerFor33128()
haint's avatar
haint committed
print('***decoding pspdu***')

generated = generateIRIPayload()
print(compiler.decode('IRIPayload', generated))

#pspdu = foo.decode('PS-PDU', modified_data)
#print(pspdu)

haint's avatar
haint committed

# is there a way to enable the automatic decoding of the attributes of content type ocetet string but have a "containing" constraint?
#print("\n\n***manually decoded 33128 iri***")
haint's avatar
haint committed
# FOOIRIPayload is used because of naming clashes and i couldn't get "fixDottedReference" to do the right thing
# deps/33128/... was modified for this to work
# iri33128 = foo.decode('FOOIRIPayload', pspdu['payload'][1][0]['iRIContents'][1])
# print(pspdu['payload'][1][0]['iRIContents'][1].hex())