All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] SMS-DELIVER Alphanum TP-OA encoding/decoding fix
@ 2015-02-12 15:09 Tommi Kenakkala
  2015-02-12 15:09 ` [PATCH 1/2] sms: SMS-DELIVER TP-OA Alphanum decoding and encoding fix Tommi Kenakkala
  2015-02-12 15:10 ` [PATCH 2/2] unit: SMS-DELIVER decoding/encoding test for long alphanum address Tommi Kenakkala
  0 siblings, 2 replies; 8+ messages in thread
From: Tommi Kenakkala @ 2015-02-12 15:09 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1926 bytes --]

There are problems with some real-life scenarios where SMS-DELIVER originator
address is an alphanumeric string with 11 chars, some extended ASCII (like äöü).
Ofono assumes Short Message's TP-OA max length is 11 octets (ref [1] and [2])
and rejects messages whose _decoded_ alphanumeric address takes more
than 11 bytes.
However, [3] defines Alphanumeric address is 7-bit coded referring to [4].
7-bit alphabet coding allows packing up to twelve 8-bit characters into 11
octets. The limit applies to octets, not to decoded characters or bytes.
Here is a fix proposals for your consideration,
with these a phone utilizing ofono will accept such short messages.
FYI a commercial Android phone reference handles the same messages fine.
Note: I've been able to test only using max 11-character TP-OA, but referred 
specifications suggest a 12th char would fit into the 11 octets as well.

REFERENCES:
[1] 24.011 8.2.5.1 Originator address element
[2] 23040 9.2.2.1 SMS‑DELIVER type
[3] 23040 9.1.2.5 Address fields
[4] 3GPP TS 23.038 GSM 7‑bit default alphabet
[5] Problem 1 callstack:
 ofono_sms_deliver_notify
  src.sms:handle_deliver
   src.sms:sms_dispatch
    src/sms.c:compute_incoming_msgid
     src/smsutil.c:sms_encode
       src/smsutil.c:encode_deliver
        src/smsutil.c:sms_encode_address_field
         if (len > 11)
[6] Problem 2 callstack:
 ofono_sms_deliver_notify
  src/smsutil.c:sms_decode
   src/smsutil.c:decode_deliver
    src/smsutil.c:sms_decode_address_field
     if (strlen(utf8) > 20

Tommi Kenakkala (2):
  sms: SMS-DELIVER TP-OA Alphanum decoding and encoding fix
  unit: SMS-DELIVER decoding/encoding test for long alphanum address

 src/smsutil.c   |   12 +++++++++---
 src/smsutil.h   |    6 +++++-
 unit/test-sms.c |   52 ++++++++++++++++++++++++++++++++++++++++++++++++----
 3 files changed, 62 insertions(+), 8 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCH 0/2] SMS-DELIVER TP-OA Alphanum decoding and encoding fix
@ 2015-02-13 12:23 Tommi Kenakkala
  2015-02-13 12:23 ` [PATCH 2/2] unit: SMS-DELIVER decoding/encoding test for long alphanum address Tommi Kenakkala
  0 siblings, 1 reply; 8+ messages in thread
From: Tommi Kenakkala @ 2015-02-13 12:23 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 596 bytes --]

There are problems with some real-life scenarios where SMS-DELIVER originator
address is an alphanumeric string with 11 chars (some extended ASCII like äöü).
Currently oFono rejects such messages. Here's a patch to improve that.

Tommi Kenakkala (2):
  sms: SMS-DELIVER TP-OA Alphanum decoding and encoding fix
  unit: SMS-DELIVER decoding/encoding test for long alphanum address

 src/smsutil.c   |   12 +++++++++---
 src/smsutil.h   |    6 +++++-
 unit/test-sms.c |   38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+), 4 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCH 2/2] unit: SMS-DELIVER decoding/encoding test for long alphanum address
@ 2015-02-13 12:47 Tommi Kenakkala
  2015-02-13 16:02 ` Denis Kenzior
  0 siblings, 1 reply; 8+ messages in thread
From: Tommi Kenakkala @ 2015-02-13 12:47 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1968 bytes --]

---
 unit/test-sms.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/unit/test-sms.c b/unit/test-sms.c
index 7b644df..259594e 100644
--- a/unit/test-sms.c
+++ b/unit/test-sms.c
@@ -38,6 +38,12 @@ static const char *simple_deliver = "07911326040000F0"
 		"040B911346610089F60000208062917314480CC8F71D14969741F977FD07";
 static const char *alnum_sender = "0791447758100650"
 		"040DD0F334FC1CA6970100008080312170224008D4F29CDE0EA7D9";
+static const char *unicode_deliver = "04819999990414D0FBFD7EBFDFEFF77BFE1E001"
+		"9512090801361807E00DC00FC00C400E400D600F600C500E500D800F800C"
+		"600E600C700E700C900E900CA00EA00DF003100320033003400350036003"
+		"7003800390030002000540068006900730020006D0065007300730061006"
+		"7006500200069007300200036003300200075006E00690063006F0064006"
+		"5002000630068006100720073002E";
 static const char *simple_submit = "0011000B916407281553F80000AA"
 		"0AE8329BFD4697D9EC37";
 
@@ -362,6 +368,38 @@ static void test_deliver_encode(void)
 	g_assert(strcmp(alnum_sender, encoded_pdu) == 0);
 
 	g_free(encoded_pdu);
+
+	/* test unicode_deliver*/
+	decoded_pdu = decode_hex(unicode_deliver, -1, &pdu_len, 0);
+	g_assert(decoded_pdu);
+	g_assert(pdu_len == (long)strlen(unicode_deliver) / 2);
+
+	ret = sms_decode(decoded_pdu, pdu_len, FALSE, 149, &sms);
+
+	g_free(decoded_pdu);
+
+	g_assert(ret);
+	g_assert(sms.type == SMS_TYPE_DELIVER);
+
+	ret = sms_encode(&sms, &encoded_pdu_len, &encoded_tpdu_len, pdu);
+
+	if (g_test_verbose()) {
+		int i;
+
+		for (i = 0; i < encoded_pdu_len; i++)
+			g_print("%02X", pdu[i]);
+		g_print("\n");
+	}
+
+	g_assert(ret);
+	g_assert(encoded_tpdu_len == 149);
+	g_assert(encoded_pdu_len == pdu_len);
+
+	encoded_pdu = encode_hex(pdu, encoded_pdu_len, 0);
+
+	g_assert(strcmp(unicode_deliver, encoded_pdu) == 0);
+
+	g_free(encoded_pdu);
 }
 
 static void test_simple_submit(void)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-02-13 16:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-12 15:09 [PATCH 0/2] SMS-DELIVER Alphanum TP-OA encoding/decoding fix Tommi Kenakkala
2015-02-12 15:09 ` [PATCH 1/2] sms: SMS-DELIVER TP-OA Alphanum decoding and encoding fix Tommi Kenakkala
2015-02-12 18:59   ` Denis Kenzior
2015-02-12 15:10 ` [PATCH 2/2] unit: SMS-DELIVER decoding/encoding test for long alphanum address Tommi Kenakkala
2015-02-12 19:04   ` Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2015-02-13 12:23 [PATCH 0/2] SMS-DELIVER TP-OA Alphanum decoding and encoding fix Tommi Kenakkala
2015-02-13 12:23 ` [PATCH 2/2] unit: SMS-DELIVER decoding/encoding test for long alphanum address Tommi Kenakkala
2015-02-13 12:47 Tommi Kenakkala
2015-02-13 16:02 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.