зеркало из https://github.com/mozilla/gecko-dev.git
Bug 738132 - Part 3: parse application port address for incoming messages. r=philikon a=b2g-only
This commit is contained in:
Родитель
c06f833e18
Коммит
f014597ea7
|
@ -173,6 +173,7 @@ function RadioInterfaceLayer() {
|
|||
Services.obs.addObserver(this, "xpcom-shutdown", false);
|
||||
|
||||
this._sentSmsEnvelopes = {};
|
||||
this.portAddressedSmsApps = {};
|
||||
}
|
||||
RadioInterfaceLayer.prototype = {
|
||||
|
||||
|
@ -460,9 +461,21 @@ RadioInterfaceLayer.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
portAddressedSmsApps: null,
|
||||
handleSmsReceived: function handleSmsReceived(message) {
|
||||
debug("handleSmsReceived: " + JSON.stringify(message));
|
||||
|
||||
// Dispatch to registered handler if application port addressing is
|
||||
// available. Note that the destination port can possibly be zero when
|
||||
// representing a UDP/TCP port.
|
||||
if (message.header.destinationPort != null) {
|
||||
let handler = this.portAddressedSmsApps[message.header.destinationPort];
|
||||
if (handler) {
|
||||
handler(message);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.encoding == RIL.PDU_DCS_MSG_CODING_8BITS_ALPHABET) {
|
||||
// Don't know how to handle binary data yet.
|
||||
return;
|
||||
|
|
|
@ -658,6 +658,10 @@ const PDU_IEI_ENHANCED_VOICE_MAIL_INFORMATION = 0x23;
|
|||
const PDU_IEI_NATIONAL_LANGUAGE_SINGLE_SHIFT = 0x24;
|
||||
const PDU_IEI_NATIONAL_LANGUAGE_LOCKING_SHIFT = 0x25;
|
||||
|
||||
// Application Port Addressing, see 3GPP TS 23.040 9.2.3.24.3
|
||||
const PDU_APA_RESERVED_8BIT_PORTS = 240;
|
||||
const PDU_APA_VALID_16BIT_PORTS = 49152;
|
||||
|
||||
// 7bit alphabet escape character. The encoded value of this code point is left
|
||||
// undefined in official spec. Its code value is internally assigned to \uffff,
|
||||
// <noncharacter-FFFF> in Unicode basic multilingual plane.
|
||||
|
|
|
@ -3195,6 +3195,35 @@ let GsmPDUHelper = {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case PDU_IEI_APPLICATION_PORT_ADDREESING_SCHEME_8BIT: {
|
||||
let dstp = this.readHexOctet();
|
||||
let orip = this.readHexOctet();
|
||||
dataAvailable -= 2;
|
||||
if ((dstp < PDU_APA_RESERVED_8BIT_PORTS)
|
||||
|| (orip < PDU_APA_RESERVED_8BIT_PORTS)) {
|
||||
// 3GPP TS 23.040 clause 9.2.3.24.3: "A receiving entity shall
|
||||
// ignore any information element where the value of the
|
||||
// Information-Element-Data is Reserved or not supported"
|
||||
break;
|
||||
}
|
||||
header.destinationPort = dstp;
|
||||
header.originatorPort = orip;
|
||||
break;
|
||||
}
|
||||
case PDU_IEI_APPLICATION_PORT_ADDREESING_SCHEME_16BIT: {
|
||||
let dstp = (this.readHexOctet() << 8) | this.readHexOctet();
|
||||
let orip = (this.readHexOctet() << 8) | this.readHexOctet();
|
||||
dataAvailable -= 4;
|
||||
// 3GPP TS 23.040 clause 9.2.3.24.4: "A receiving entity shall
|
||||
// ignore any information element where the value of the
|
||||
// Information-Element-Data is Reserved or not supported"
|
||||
if ((dstp < PDU_APA_VALID_16BIT_PORTS)
|
||||
&& (orip < PDU_APA_VALID_16BIT_PORTS)) {
|
||||
header.destinationPort = dstp;
|
||||
header.originatorPort = orip;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PDU_IEI_CONCATENATED_SHORT_MESSAGES_16BIT: {
|
||||
let ref = (this.readHexOctet() << 8) | this.readHexOctet();
|
||||
let max = this.readHexOctet();
|
||||
|
|
Загрузка…
Ссылка в новой задаче