aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests
diff options
context:
space:
mode:
authorAlexander Chemeris <Alexander.Chemeris@gmail.com>2014-03-08 21:57:07 +0100
committerAlexander Chemeris <Alexander.Chemeris@gmail.com>2014-03-12 21:24:49 +0400
commitaf9683a3730ef7396adebf2dbd56d4ec8ca6b906 (patch)
tree4ac410b96189e13d5fe0ecaa1b80ff6c39909079 /openbsc/tests
parent5ab70da57ae8976a9c55e63de95fabdb057470e6 (diff)
sms,db: Update DB scheme to support more features in our SMSC.
Do not store delivered messages in the DB. In a production system we should not store messages longer than needed, as it will quickly bloat our DB. In case one wants to store messages for debug purposes, we could add one of the following capabilities later: - hexdump to a log file - send to an SMPP entry on delivery - send to Wireshark sms,db: Store SMS Message Reference in the DB, since we need it to generate SMS-STATUS-REPORT. 03.40 9.2.3.6TP-Message-Reference (TP-MR) The SMS-STATUS-REPORT also contains a TP-Message-Reference field. The value sent to the MS will be the sameas the TP-Message-Reference value generated by the MS in the earlier SMS-SUBMIT or SMS-COMMAND to whichthe status report relates. sms,db: Add a 'type' filed to gsm_sms structure to be able diffrentiate normal DELIVER/SUBMIT messages from STATUS-REP messages.
Diffstat (limited to 'openbsc/tests')
-rw-r--r--openbsc/tests/db/db_test.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/openbsc/tests/db/db_test.c b/openbsc/tests/db/db_test.c
index be327aa99..c8b916096 100644
--- a/openbsc/tests/db/db_test.c
+++ b/openbsc/tests/db/db_test.c
@@ -73,10 +73,13 @@ static void test_sms(void)
subscr->net = &dummy_net;
sms = sms_alloc();
+ sms->type = GSM_SMS_DELIVER;
sms->receiver = subscr_get(subscr);
sms->received_time = 12345;
sms->valid_until = 67890;
+ sms->delivered_time = 98765;
+ sms->msg_ref = 123;
sms->src.ton = 0x23;
sms->src.npi = 0x24;
@@ -104,9 +107,12 @@ static void test_sms(void)
/* now query */
sms = db_sms_get_unsent_for_subscr(subscr);
OSMO_ASSERT(sms);
+ OSMO_ASSERT(sms->type == GSM_SMS_DELIVER);
OSMO_ASSERT(sms->receiver == subscr);
OSMO_ASSERT(sms->received_time == 12345);
OSMO_ASSERT(sms->valid_until == 67890);
+ OSMO_ASSERT(sms->delivered_time == 98765);
+ OSMO_ASSERT(sms->msg_ref == 123);
OSMO_ASSERT(sms->reply_path_req == 1);
OSMO_ASSERT(sms->status_rep_req == 2);
OSMO_ASSERT(sms->ud_hdr_ind == 3);
@@ -120,6 +126,14 @@ static void test_sms(void)
OSMO_ASSERT(sms->user_data_len == strlen("UserData123"));
OSMO_ASSERT(strcmp((char *) sms->user_data, "UserData123") == 0);
+ /* mark SMS as delivered in the DB */
+ db_sms_mark_delivered(sms);
+ sms_free(sms);
+
+ /* now query - we should not get anything */
+ sms = db_sms_get_unsent_for_subscr(subscr);
+ OSMO_ASSERT(!sms);
+
subscr_put(subscr);
}