summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Kluchnikov <kluchnikovi@gmail.com>2013-11-22 16:15:20 +0400
committerIvan Kluchnikov <kluchnikovi@gmail.com>2013-11-22 16:15:20 +0400
commit35a508d9e847f5e7ed8b6ba9791b25ac074ecb00 (patch)
treec0f4475e097d21a9cb845f70c7dc725feefe293a
parent94a349938b59ba1b3890e956de9f151f03581928 (diff)
sms-sock: temporary hackkluchnikov/sms-socket
We should send originator address of sms to sms-proxy, so just add originator address before sms pdu in message and send it to sms-proxy.
-rw-r--r--openbsc/include/openbsc/gsm_subscriber.h2
-rw-r--r--openbsc/include/openbsc/sms_sock.h2
-rw-r--r--openbsc/src/libbsc/gsm_subscriber_base.c5
-rw-r--r--openbsc/src/libmsc/gsm_04_11.c2
-rw-r--r--openbsc/src/libmsc/sms_sock.c11
5 files changed, 19 insertions, 3 deletions
diff --git a/openbsc/include/openbsc/gsm_subscriber.h b/openbsc/include/openbsc/gsm_subscriber.h
index 7aae4c332..88eb966fa 100644
--- a/openbsc/include/openbsc/gsm_subscriber.h
+++ b/openbsc/include/openbsc/gsm_subscriber.h
@@ -100,6 +100,8 @@ int subscr_pending_dump(struct gsm_subscriber *subscr, struct vty *vty);
int subscr_pending_kick(struct gsm_subscriber *subscr);
char *subscr_name(struct gsm_subscriber *subscr);
+char *subscr_extension(struct gsm_subscriber *subscr);
+
int subscr_purge_inactive(struct gsm_network *net);
void subscr_update_from_db(struct gsm_subscriber *subscr);
diff --git a/openbsc/include/openbsc/sms_sock.h b/openbsc/include/openbsc/sms_sock.h
index a3c059703..5adebe67d 100644
--- a/openbsc/include/openbsc/sms_sock.h
+++ b/openbsc/include/openbsc/sms_sock.h
@@ -27,7 +27,7 @@
struct gsm_network;
struct msgb;
-int sms_sock_try_deliver(struct gsm_network *net, struct msgb *msg);
+int sms_sock_try_deliver(struct msgb *msg, struct gsm_subscriber_connection *conn);
int sms_sock_init(struct gsm_network *net);
diff --git a/openbsc/src/libbsc/gsm_subscriber_base.c b/openbsc/src/libbsc/gsm_subscriber_base.c
index 747a699f9..85ba98ca1 100644
--- a/openbsc/src/libbsc/gsm_subscriber_base.c
+++ b/openbsc/src/libbsc/gsm_subscriber_base.c
@@ -49,6 +49,11 @@ char *subscr_name(struct gsm_subscriber *subscr)
return subscr->imsi;
}
+char *subscr_extension(struct gsm_subscriber *subscr)
+{
+ return subscr->extension;
+}
+
struct gsm_subscriber *subscr_alloc(void)
{
struct gsm_subscriber *s;
diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c
index 698a34bc9..aeef620f2 100644
--- a/openbsc/src/libmsc/gsm_04_11.c
+++ b/openbsc/src/libmsc/gsm_04_11.c
@@ -406,7 +406,7 @@ static int gsm340_rx_tpdu(struct gsm_subscriber_connection *conn, struct msgb *m
/* FIXME: handle the error somehow? */
}
#else
- rc = sms_sock_try_deliver(conn->bts->network, msg);
+ rc = sms_sock_try_deliver(msg, conn);
if (rc == 1) {
rc = 1; /* cause 1: unknown subscriber */
osmo_counter_inc(conn->bts->network->stats.sms.no_receiver);
diff --git a/openbsc/src/libmsc/sms_sock.c b/openbsc/src/libmsc/sms_sock.c
index 8e42d7e3f..85c655d60 100644
--- a/openbsc/src/libmsc/sms_sock.c
+++ b/openbsc/src/libmsc/sms_sock.c
@@ -43,9 +43,10 @@ struct sms_sock_state {
struct osmo_fd conn_bfd; /* fd for connection to lcr */
};
-int sms_sock_try_deliver(struct gsm_network *net, struct msgb *msg)
+int sms_sock_try_deliver(struct msgb *msg, struct gsm_subscriber_connection *conn)
{
/* Check if we currently have a MNCC handler connected */
+ struct gsm_network *net = conn->bts->network;
if (net->sms_state->conn_bfd.fd < 0) {
LOGP(DMNCC, LOGL_ERROR, "sms_sock receives for external CC app "
"but socket is gone\n");
@@ -54,6 +55,14 @@ int sms_sock_try_deliver(struct gsm_network *net, struct msgb *msg)
return -1;
}
+ /* FIXME: temporary hack */
+ struct gsm_subscriber *subscr = conn->subscr;
+ char *extension = subscr_extension(subscr);
+ size_t len = 15*sizeof(char);
+ msg->l4h -= len;
+ msg->len += len;
+ memcpy(msg->l4h, extension, len);
+
/* FIXME: check for some maximum queue depth? */
/* Actually enqueue the message and mark socket write need */