Unfortunately, the message format definitions of the transport layer
in subclause 9.2.2 of 3GPP TS 23.040 are ambiguous. In particular,
the order in tables defining basic elements does not match the
order defined in the message layout tables.
Most implementations including Wireshark and TTCN-3 L3 definitions
by Ericsson [1] follow the order defined the those layout tables.
For example, this is how tshark dissects an SMS-SUBMIT message:
GSM SMS TPDU (GSM 03.40) SMS-SUBMIT
0... .... = TP-RP: TP Reply Path parameter is not set in this SMS SUBMIT/DELIVER
.0.. .... = TP-UDHI: The TP UD field contains only the short message
..1. .... = TP-SRR: A status report is requested
...0 0... = TP-VPF: TP-VP field not present (0)
.... .1.. = TP-RD: Instruct SC to reject duplicates
.... ..01 = TP-MTI: SMS-SUBMIT (1)
This order has been manually verified by sending two short messages
with and without status report request (TP-SRR) enabled. Let's also
follow the order defined in the layout tables.
[1] https://git.eclipse.org/c/titan/titan.ProtocolModules.MobileL3_v13.4.0.git/tree/src/MobileL3_SMS_Types.ttcn