summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2013-07-11 14:29:31 +0200
committerHarald Welte <laforge@gnumonks.org>2013-07-11 14:29:31 +0200
commit4c5babc06c15a1771aa562e98b732a0aed1d3d33 (patch)
tree81b3197c280bdb5ed1ea6d64159453847c871aba
parent641475cb813930790fc384f9bba704a09ba65168 (diff)
smpp_openbsc: Fix parsing of 03.38 data coding scheme in MO case
-rw-r--r--openbsc/src/libmsc/smpp_openbsc.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/openbsc/src/libmsc/smpp_openbsc.c b/openbsc/src/libmsc/smpp_openbsc.c
index 887f0ebee..1744b0e6f 100644
--- a/openbsc/src/libmsc/smpp_openbsc.c
+++ b/openbsc/src/libmsc/smpp_openbsc.c
@@ -468,22 +468,35 @@ static int deliver_to_esme(struct osmo_esme *esme, struct gsm_sms *sms,
/* Figure out SMPP DCS from TP-DCS */
dcs = sms->data_coding_scheme;
- if ((dcs & 0xFC) == GSM338_DCS_1111_7BIT) {
- deliver.data_coding = 0x01;
- mode = MODE_7BIT;
- } else if ((dcs & 0xE0) == 0 && (dcs & 0xC) == 0) {
- deliver.data_coding = 0x01;
- mode = MODE_7BIT;
- } else if ((dcs & 0xFC) == GSM338_DCS_1111_8BIT_DATA) {
- deliver.data_coding = 0x02;
- mode = MODE_8BIT;
- } else if ((dcs & 0xE0) == 0 && (dcs & 0xC) == 4) {
- deliver.data_coding = 0x02;
- mode = MODE_8BIT;
- } else if ((dcs & 0xE0) == 0 && (dcs & 0xC) == 8) {
- deliver.data_coding = 0x08; /* UCS-2 */
- mode = MODE_8BIT;
+ if ((dcs & 0xF0) == 0xF0) {
+ if (dcs & 0x04) {
+ /* bit 2 == 1: 8bit data */
+ deliver.data_coding = 0x02;
+ mode = MODE_8BIT;
+ } else {
+ /* bit 2 == 0: default alphabet */
+ deliver.data_coding = 0x01;
+ mode = MODE_7BIT;
+ }
+ } else if ((dcs & 0xE0) == 0) {
+ switch (dcs & 0xC) {
+ case 0:
+ deliver.data_coding = 0x01;
+ mode = MODE_7BIT;
+ break;
+ case 4:
+ deliver.data_coding = 0x02;
+ mode = MODE_8BIT;
+ break;
+ case 8:
+ deliver.data_coding = 0x08; /* UCS-2 */
+ mode = MODE_8BIT;
+ break;
+ default:
+ goto unknown_mo;
+ }
} else {
+unknown_mo:
LOGP(DLSMS, LOGL_ERROR, "SMPP MO Unknown Data Coding 0x%02x\n",
dcs);
return -1;