Bug 736707 - Part 1: TP-PID sanity checks. r=philikon

This commit is contained in:
Vicamo Yang 2012-04-08 17:13:01 +08:00
parent 7b4ee2b2de
commit 333c0743b4
2 changed files with 37 additions and 2 deletions

View File

@ -593,6 +593,24 @@ const PDU_MAX_USER_DATA_8BIT = 140;
// User Data max length in chars
const PDU_MAX_USER_DATA_UCS2 = 70;
// PID - Protocol Indicator
const PDU_PID_DEFAULT = 0x00;
const PDU_PID_TELEMATIC_INTERWORKING = 0x20;
const PDU_PID_SHORT_MESSAGE_TYPE_0 = 0x40;
const PDU_PID_REPLACE_SHORT_MESSAGE_TYPE_1 = 0x41;
const PDU_PID_REPLACE_SHORT_MESSAGE_TYPE_2 = 0x42;
const PDU_PID_REPLACE_SHORT_MESSAGE_TYPE_3 = 0x43;
const PDU_PID_REPLACE_SHORT_MESSAGE_TYPE_4 = 0x44;
const PDU_PID_REPLACE_SHORT_MESSAGE_TYPE_5 = 0x45;
const PDU_PID_REPLACE_SHORT_MESSAGE_TYPE_6 = 0x46;
const PDU_PID_REPLACE_SHORT_MESSAGE_TYPE_7 = 0x47;
const PDU_PID_ENHANDED_MESSAGE_SERVICE = 0x5E;
const PDU_PID_RETURN_CALL_MESSAGE = 0x5F
const PDU_PID_ANSI_136_R_DATA = 0x7C;
const PDU_PID_ME_DATA_DOWNLOAD = 0x7D;
const PDU_PID_ME_DEPERSONALIZATION = 0x7E;
const PDU_PID_USIM_DATA_DOWNLOAD = 0x7F;
// DCS - Data Coding Scheme
const PDU_DCS_MSG_CODING_7BITS_ALPHABET = 0x00;
const PDU_DCS_MSG_CODING_8BITS_ALPHABET = 0x04;

View File

@ -2928,6 +2928,22 @@ let GsmPDUHelper = {
return addr;
},
/**
* Read TP-Protocol-Indicator(TP-PID).
*
* @param msg
* message object for output.
*
* @see 3GPP TS 23.040 9.2.3.9
*/
readProtocolIndicator: function readProtocolIndicator(msg) {
// `The MS shall interpret reserved, obsolete, or unsupported values as the
// value 00000000 but shall store them exactly as received.`
msg.pid = this.readHexOctet();
// Do not support any specific feature yet.
msg.epid = PDU_PID_DEFAULT;
},
/**
* Read GSM TP-Service-Centre-Time-Stamp(TP-SCTS).
*
@ -3074,7 +3090,7 @@ let GsmPDUHelper = {
// TP-Protocol-Identifier
if (pi & PDU_PI_PROTOCOL_IDENTIFIER) {
msg.pid = this.readHexOctet();
this.readProtocolIndicator(msg);
}
// TP-Data-Coding-Scheme
if (pi & PDU_PI_DATA_CODING_SCHEME) {
@ -3106,6 +3122,7 @@ let GsmPDUHelper = {
sender: null, // M X X X X X
recipient: null, // X X M X M M
pid: null, // M O M O O M
epid: null, // M O M O O M
dcs: null, // M O M O O X
body: null, // M O M O O O
timestamp: null, // M X X X X X
@ -3157,7 +3174,7 @@ let GsmPDUHelper = {
let senderAddressLength = this.readHexOctet();
msg.sender = this.readAddress(senderAddressLength);
// - TP-Protocolo-Identifier -
msg.pid = this.readHexOctet();
this.readProtocolIndicator(msg);
// - TP-Data-Coding-Scheme -
msg.dcs = this.readHexOctet();
// - TP-Service-Center-Time-Stamp -