P1sec / pycrate

A Python library to ease the development of encoders and decoders for various protocols and file formats; contains ASN.1 and CSN.1 compilers.
GNU Lesser General Public License v2.1
380 stars 130 forks source link

pycrate_mobile/TS24301_EMM: distinguish MT and MO messages #228

Closed Marc-Egli closed 1 year ago

Marc-Egli commented 1 year ago

Following up on the issue https://github.com/P1sec/pycrate/issues/224 where the same parsing function was used for MT and MO without any error, showing that there was no real difference made between them in the source code I would like to suggest to add the distinction between the two categories of messages.

p1-bmu commented 1 year ago

Thanks for this PR. Currently, the MO / MT distinction in pycrate NAS modules only exist to distinguish messages that have the same type, but not the same structure (only few messages are in this case hopefully). I kept these NAS dictionnaries as much "open" as possible, to enable parsing as much NAS messages as possible when there is no such issue as different structure for a single message type. That is why I have mixed feelings about commit aa1a831. Commit cb9714d is definitely needed on the other side.

Marc-Egli commented 1 year ago

Oh I understand better now. For me I saw the MO / MT classification as protocol specific. For example, an EMMAttachRequest can only be sent from a UE and thus should be a MO message and not a MT. But I also understand why it would be better to keep the current form of the NAS dictionaries.

About the commit cb9714d I removed the message type by accident in my first commit and added it again with this commit. I should have named it better.

p1-bmu commented 1 year ago

Thanks for the details. Therefore, I prefer to stick with the current code and not pull your PR. Thanks anyway for your efforts.