update the TCAP-MAP module used in the example authored by mich's avatar mich
...@@ -1184,29 +1184,41 @@ This is exactly what is accomplished with the custom object *TCAP-MAP-Messages.T ...@@ -1184,29 +1184,41 @@ This is exactly what is accomplished with the custom object *TCAP-MAP-Messages.T
It can be used to encode and decode any TCAP-MAP messages. It can be used to encode and decode any TCAP-MAP messages.
Here is what happens when decoding the TCAP MAP message containing an USSD request, Here is what happens when decoding the TCAP MAP message containing an USSD request,
as proposed on the [Wireshark wiki](https://wiki.wireshark.org/SampleCaptures), and as proposed in the [Wireshark wiki](https://wiki.wireshark.org/SampleCaptures), and
re-encoding it with a null USSD string: re-encoding it with a null USSD string:
>>> from pycrate_asn1dir import TCAP_MAP >>> from pycrate_asn1dir import TCAP_MAPv2v3
>>> M = TCAP_MAP.TCAP_MAP_Messages.TCAP_MAP_Message >>> M = TCAP_MAPv2v3.TCAP_MAP_Messages.TCAP_MAP_Message
>>> M >>> M
<TCAP-MAP-Message ([TCMessage] CHOICE)> <TCAP-MAP-Message ([TCMessage] CHOICE)>
>>> M.get_proto() >>> M.get_proto()
{ ('CHOICE', {
unidirectional: { unidirectional: ('SEQUENCE', {
dialoguePortion: { dialoguePortion: ('SEQUENCE', {
direct-reference: 'OBJECT IDENTIFIER', direct-reference: 'OBJECT IDENTIFIER',
indirect-reference: 'INTEGER', indirect-reference: 'INTEGER',
data-value-descriptor: 'ObjectDescriptor', data-value-descriptor: 'ObjectDescriptor',
[...] encoding: ('CHOICE', {
single-ASN1-type: 'OPEN_TYPE', single-ASN1-type: ('OPEN_TYPE', {
octet-aligned: 'OCTET STRING', DialoguePDU: ('CHOICE', {
arbitrary: 'BIT STRING' dialogueRequest: ('SEQUENCE', {
} protocol-version: 'BIT STRING',
} application-context-name: 'OBJECT IDENTIFIER',
} user-information: ('SEQUENCE OF', ('SEQUENCE', {
} direct-reference: 'OBJECT IDENTIFIER',
} indirect-reference: 'INTEGER',
data-value-descriptor: 'ObjectDescriptor',
encoding: 'CHOICE'
}))
}),
[...]
octet-aligned: 'OCTET STRING',
arbitrary: 'BIT STRING'
})
})
})
})
})
>>> from binascii import hexlify, unhexlify >>> from binascii import hexlify, unhexlify
>>> M.from_ber(unhexlify('626a48042f3b46026b3a2838060700118605010101a02d602b80020780a109060704000001001302be1a2818060704000001010101a00da00b80099656051124006913f66c26a12402010102013b301c04010f040eaa180da682dd6c31192d36bbdd468007917267415827f2')) >>> M.from_ber(unhexlify('626a48042f3b46026b3a2838060700118605010101a02d602b80020780a109060704000001001302be1a2818060704000001010101a00da00b80099656051124006913f66c26a12402010102013b301c04010f040eaa180da682dd6c31192d36bbdd468007917267415827f2'))
>>> print(M.to_asn1()) >>> print(M.to_asn1())
... ...
......