Ethereal-dev: [Ethereal-dev] packet-gsm_sms.c patch to enable a proper decoding of a 7-bit enc
Hello,
Attached is a "packet-gsm_sms.c" dissector patch, which
enable a proper decoding of the 7-bit encoded
alphanumeric SMS TP-Originating Address.
Looking for comments/suggestions.
It would be nice to have it checked it.
WBR,
Viorel Suman
Software Developer
Avalanche Mobile BV (http://www.avmob.com)
Busitel 1, Orlyplein 85
1043 DS Amsterdam
The Netherlands
Phone: +31 (0) 20 403 74 70
Fax: +31 (0) 20 403 73 10
--- ethereal-0.10.9-original/epan/dissectors/packet-gsm_sms.c 2005-01-18 04:39:56.000000000 +0200
+++ ethereal-0.10.9/epan/dissectors/packet-gsm_sms.c 2005-02-17 10:56:26.078736549 +0200
@@ -243,7 +243,6 @@
guint32 length;
guint32 i, j;
-
offset = *offset_p;
oct = tvb_get_guint8(tvb, offset);
@@ -331,16 +330,25 @@
offset++;
j = 0;
- for (i = 0; i < numdigocts; i++)
+ switch ((oct & 0x70) >> 4)
{
- oct = tvb_get_guint8(tvb, offset + i);
+ case 0x05: /* "Alphanumeric (coded according to 3GPP TS 23.038 GSM 7-bit default alphabet)" */
+ i = gsm_sms_char_7bit_unpack(0, numdigocts, sizeof(bigbuf), tvb_get_ptr(tvb, offset, numdigocts), bigbuf);
+ bigbuf[i] = '\0';
+ gsm_sms_char_ascii_decode(bigbuf, bigbuf, i);
+ break;
+ default:
+ for (i = 0; i < numdigocts; i++)
+ {
+ oct = tvb_get_guint8(tvb, offset + i);
- bigbuf[j++] = digit_table[oct & 0x0f];
- bigbuf[j++] = digit_table[(oct & 0xf0) >> 4];
+ bigbuf[j++] = digit_table[oct & 0x0f];
+ bigbuf[j++] = digit_table[(oct & 0xf0) >> 4];
+ }
+ bigbuf[j++] = '\0';
+ break;
}
- bigbuf[j++] = '\0';
-
proto_tree_add_text(subtree,
tvb, offset, numdigocts,
"Digits: %s",
@@ -348,7 +356,7 @@
proto_item_append_text(item, " - (%s)", bigbuf);
- *offset_p = offset + i;
+ *offset_p = offset + numdigocts;
}
/* 9.2.3.7 */