aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/db.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-07-05 14:02:46 +0200
committerHarald Welte <laforge@gnumonks.org>2009-07-05 14:02:46 +0200
commitb9c758b2ac120a8f45c7c0a8b64429eb6105a9c7 (patch)
treeb83e04b679cc601217aadeaed2f7e9859da3bcfe /openbsc/src/db.c
parent5a691b52902ce383f87f5942cc4d1b44fc0176b6 (diff)
more SMS improvements
* describe data structures in gsm_04_11.h * increae LCHAN RELEASE TIMEOUT for case of long SMS * convert header field in sql table from NUMERIC to BLOB * initial handling for validity period * send RP ERROR messages with meaningful RP CAUSE in case of error
Diffstat (limited to 'openbsc/src/db.c')
-rw-r--r--openbsc/src/db.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/openbsc/src/db.c b/openbsc/src/db.c
index 600699ae7..1bcd10175 100644
--- a/openbsc/src/db.c
+++ b/openbsc/src/db.c
@@ -75,7 +75,7 @@ static char *create_stmts[] = {
"sent TIMESTAMP, "
"sender_id NUMERIC NOT NULL, "
"receiver_id NUMERIC NOT NULL, "
- "header NUMERIC, "
+ "header BLOB, "
"text TEXT NOT NULL "
")",
"CREATE TABLE IF NOT EXISTS VLR ("
@@ -402,16 +402,20 @@ int db_sms_store(struct gsm_sms *sms)
{
dbi_result result;
char *q_text;
+ unsigned char *q_header;
dbi_conn_quote_string_copy(conn, (char *)sms->text, &q_text);
+ dbi_conn_quote_binary_copy(conn, sms->header, sms->header_len,
+ &q_header);
result = dbi_conn_queryf(conn,
"INSERT INTO SMS "
"(created,sender_id,receiver_id,header,text) VALUES "
"(datetime('now'),%llu,%llu,%s,%s)",
sms->sender->id,
sms->receiver ? sms->receiver->id : 0,
- NULL, q_text);
+ q_header, q_text);
free(q_text);
+ free(q_header);
if (!result)
return -EIO;