From 6e6143e2921317eac68fe2b47ca59aef6c1ee3bb Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Sun, 28 Dec 2008 21:38:26 +0000 Subject: [PATCH] Add second test SMS --- tests/sms.txt | 41 ++++++++++++++++++++---------- tests/sms/sms_test.c | 59 ++++++++++++++++++++++++++++++++++++-------- 2 files changed, 77 insertions(+), 23 deletions(-) diff --git a/tests/sms.txt b/tests/sms.txt index ea6eab15f..06c885b8b 100644 --- a/tests/sms.txt +++ b/tests/sms.txt @@ -1,20 +1,10 @@ -03 02 01 0a 02 43 0b 00 1d 39 01 1a 00 01 00 07 91 55 11 18 31 28 00 0e 31 20 04 81 21 43 00 00 ff 04 d4 f2 9c 0e +03 02 01 0a 02 43 0b 00 1d 39 01 1a 00 01 00 07 91 55 11 18 31 28 00 0e 31 20 04 81 21 43 00 00 ff 04 d4 f2 9c 0e -03 02 01 0a 02 43 0b 00 9f 09 01 9c 00 da 00 07 91 88 96 13 00 00 99 90 11 7b 04 81 22 22 00 08 ff 86 6c 38 8c 50 92 80 88 4c 00 4d 00 4d 00 41 6a 19 67 03 74 06 8c a1 7d b2 00 20 00 20 51 68 74 03 99 96 52 75 7d b2 8d ef 6a 19 67 03 ff 0c 6a 19 67 03 96 f6 98 a8 96 aa ff 01 8b 93 60 a8 80 70 66 0e 51 32 84 c4 ff 0c 97 48 6d 3b 62 95 8c c7 ff 01 73 fe 57 28 52 a0 51 65 90 01 96 50 91 cf 59 27 80 6f 76 df 6d 0b 57 fa 96 8a 91 77 5e 63 53 61 ff 0c 8a cb 4e 0a 7d b2 64 1c 5c 0b 30 0c 6a 19 67 03 30 0d - -03 - -02 - -01 - -0a - -02 - -43 - -0b - -00 - -1d - +03 02 01 0a 02 43 0b 00 1d - 39 - TransactionID 3, SMS messages :: gh->proto_discr 01 - CP-DATA :: gh->msg_type 1a - Length: 26 :: gh->data[0] -00 - MTI 0 RP-DATA (ms-> n) +00 - MTI 0 RP-DATA (ms->n) 01 - MR 1 00 - RP-OA 07 - RP-DA (SMSC Length) @@ -33,3 +23,28 @@ TPDU (14 byte): ff - Validity period 04 - User Data length (04) d4 f2 9c 0e - gsm_default 7bit encoded "Test" (4 byte) + +03 02 01 0a 02 43 0b 00 9f 09 01 9c 00 da 00 07 91 88 96 13 00 00 99 90 11 7b 04 81 22 22 00 08 ff 86 6c 38 8c 50 92 80 88 4c 00 4d 00 4d 00 41 6a 19 67 03 74 06 8c a1 7d b2 00 20 00 20 51 68 74 03 99 96 52 75 7d b2 8d ef 6a 19 67 03 ff 0c 6a 19 67 03 96 f6 98 a8 96 aa ff 01 8b 93 60 a8 80 70 66 0e 51 32 84 c4 ff 0c 97 48 6d 3b 62 95 8c c7 ff 01 73 fe 57 28 52 a0 51 65 90 01 96 50 91 cf 59 27 80 6f 76 df 6d 0b 57 fa 96 8a 91 77 5e 63 53 61 ff 0c 8a cb 4e 0a 7d b2 64 1c 5c 0b 30 0c 6a 19 67 03 30 0d + +03 02 01 0a 02 43 0b 00 9f - lower levels +09 - TransactionID 0, SMS messages +01 - CP-DATA +9c - Length: (156) +00 - MTI 0 RP-DATA (ms->n) +da - MR (?) +00 - RP-OA +07 - RP-DA (SMSC Length) +91 - International No. +88 96 13 00 00 99 +90 - RP-UD len (144) +11 - +7b - Message Reference +04 - DA length +81 - Numbering Plan +22 22 - Address 2222 +00 - PID +08 - DCS (UCS2 charset) +ff - Validity period +86 - User Data length (134) +6c 38 8c 50 92 80 88 4c 00 4d 00 4d 00 41 6a 19 67 03 74 06 8c a1 7d b2 00 20 00 20 51 68 74 03 99 96 52 75 7d b2 8d ef 6a 19 67 03 ff 0c 6a 19 67 03 96 f6 98 a8 96 aa ff 01 8b 93 60 a8 80 70 66 0e 51 32 84 c4 ff 0c 97 48 6d 3b 62 95 8c c7 ff 01 73 fe 57 28 52 a0 51 65 90 01 96 50 91 cf 59 27 80 6f 76 df 6d 0b 57 fa 96 8a 91 77 5e 63 53 61 ff 0c 8a cb 4e 0a 7d b2 64 1c 5c 0b 30 0c 6a 19 67 03 30 0d + diff --git a/tests/sms/sms_test.c b/tests/sms/sms_test.c index 548333e91..ebecb56b9 100644 --- a/tests/sms/sms_test.c +++ b/tests/sms/sms_test.c @@ -26,24 +26,63 @@ #include /* SMS data from MS starting with layer 3 header */ -static u_int8_t sms_data[] = { - 0x39, 0x01, 0x1a, 0x00, 0x01, 0x00, 0x07, 0x91, 0x55, 0x11, - 0x18, 0x31, 0x28, 0x00, 0x0e, 0x31, 0x20, 0x04, 0x81, 0x21, - 0x43, 0x00, 0x00, 0xff, 0x04, 0xd4, 0xf2, 0x9c, 0x0e +static u_int8_t sms1[] = { + 0x39, 0x01, 0x1a, 0x00, 0x01, 0x00, 0x07, 0x91, 0x55, 0x11, + 0x18, 0x31, 0x28, 0x00, 0x0e, 0x31, 0x20, 0x04, 0x81, 0x21, + 0x43, 0x00, 0x00, 0xff, 0x04, 0xd4, 0xf2, 0x9c, 0x0e }; +static u_int8_t sms2[] = { + 0x09, 0x01, 0x9c, 0x00, 0xda, 0x00, 0x07, 0x91, 0x88, 0x96, 0x13, + 0x00, 0x00, 0x99, 0x90, 0x11, 0x7b, 0x04, 0x81, 0x22, 0x22, 0x00, + 0x08, 0xff, 0x86, 0x6c, 0x38, 0x8c, 0x50, 0x92, 0x80, 0x88, 0x4c, + 0x00, 0x4d, 0x00, 0x4d, 0x00, 0x41, 0x6a, 0x19, 0x67, 0x03, 0x74, + 0x06, 0x8c, 0xa1, 0x7d, 0xb2, 0x00, 0x20, 0x00, 0x20, 0x51, 0x68, + 0x74, 0x03, 0x99, 0x96, 0x52, 0x75, 0x7d, 0xb2, 0x8d, 0xef, 0x6a, + 0x19, 0x67, 0x03, 0xff, 0x0c, 0x6a, 0x19, 0x67, 0x03, 0x96, 0xf6, + 0x98, 0xa8, 0x96, 0xaa, 0xff, 0x01, 0x8b, 0x93, 0x60, 0xa8, 0x80, + 0x70, 0x66, 0x0e, 0x51, 0x32, 0x84, 0xc4, 0xff, 0x0c, 0x97, 0x48, + 0x6d, 0x3b, 0x62, 0x95, 0x8c, 0xc7, 0xff, 0x01, 0x73, 0xfe, 0x57, + 0x28, 0x52, 0xa0, 0x51, 0x65, 0x90, 0x01, 0x96, 0x50, 0x91, 0xcf, + 0x59, 0x27, 0x80, 0x6f, 0x76, 0xdf, 0x6d, 0x0b, 0x57, 0xfa, 0x96, + 0x8a, 0x91, 0x77, 0x5e, 0x63, 0x53, 0x61, 0xff, 0x0c, 0x8a, 0xcb, + 0x4e, 0x0a, 0x7d, 0xb2, 0x64, 0x1c, 0x5c, 0x0b, 0x30, 0x0c, 0x6a, + 0x19, 0x67, 0x03, 0x30, 0x0d +}; + +struct sms_datum { + u_int8_t len; + u_int8_t *data; +}; + +static struct sms_datum sms_data[] = { + { + .len = sizeof(sms1), + .data = sms1, + }, { + .len = sizeof(sms2), + .data = sms2, + } +}; + +#define SMS_NUM 2 + int main(int argc, char** argv) { DEBUGP(DSMS, "SMS testing\n"); struct msgb *msg; u_int8_t *sms; + u_int8_t i; - /* Setup SMS msgb */ - msg = msgb_alloc(sizeof(sms_data)); - sms = msgb_put(msg, sizeof(sms_data)); + for(i=0;il3h = sms; + memcpy(sms, sms_data[i].data, sms_data[i].len); + msg->l3h = sms; - gsm0411_rcv_sms(msg); + gsm0411_rcv_sms(msg); + msgb_free(msg); + } }