Recently we had reported several problems regarding PDU SMS decoding in gnokii. Apparently gnokii was unable to decode several messages that included TP-Parameter-Indicator field. Together with Daniele we’ve come across a specification, namely ETSI TS 123 040. There in chapter 22.214.171.124 it describes this field. And I think it is not clear what it claims. At least we and Nokia have different interpretations.
The most significant bit in octet 1 and any other TP-PI octets which may be added later is reserved as an extension bit which when set to a 1 shall indicate that another TP-PI octet follows immediately afterwards.
So, does it mean that there could be several TP-PI octets in row? If so, which one is the valid one? And how does it relate to SMS-SUBMIT-LAYOUT (126.96.36.199) which says that it is just 1 octet?
Further reading brings more information:
If a Reserved bit is set to „1” then the receiving entity shall ignore the setting. The setting of this bit shall mean that additional information will follow the TP-User-Data, so a receiving entity shall discard any octets following the TP-User-Data.
I completely don’t understand what is the reason for that. We say that there is additional information but it should be ignored? It’s beyond my perception.
Getting back to the problem. The general layout of TP-PI looks as follows:
And we had the following octets in the problem report:
- 0x9F (1001 1111): extension bit set, 2 reserved bit set, TP-UDL set, TP-DCS set, TP-PID set
Now, depending on interpretation of the specification, we can interpret differently the sequent octets. There are three:
- 0xD6 (1101 0110)
- 0xE4 (1110 0100)
- 0x94 (1001 0100)
First interpretation, is that TP-PI can be followed by next TP-PI octet, based on value of bit 7. All these records have it set, so we go till the last octet which would be TP-PI as well, but then there’s no room for at least TP-UDL which should be set. Doesn’t look right.
So, second interpretation (along with SMS-STATUS-REPORT layout): TP-PID, TP-DCS and TP-UDL will follow TP-PI octet. So we have:
- TP-PID: 0xD6, indicating that it is message for SC (Service Centre) specific use
- TP-DCS: 0xE4, indicating Message Waiting type (however it uses bit 2 which is reserved)
- TP-UDL: 0x94, which does not make sense as there are no more octets
So this interpretation looks even worse than the previous one. I’m used to bugs in software but this one really confuses me: I have no idea what would be a good way to interpret the message from the report. I’m committing the change that incorporated the first interpretation and doesn’t bother with missing TP-PID, TP-DCS, TP-UDL octets.
To summarize: specifications are good, but not all of them. Really try to be precise and unambiguous when writing a specification.