aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-11-26 15:21:15 +0100
committerHarald Welte <laforge@gnumonks.org>2016-12-01 15:54:35 +0000
commitbc1d758299a1c9ac3f5902f6417cdbcc1d5c1db4 (patch)
treecb6ecb4ae1730b0a60cac008c5493c506e1e5869 /src
parent25774b9839a9842affc6fef925166b3b9481b466 (diff)
gsm0480: add gsm0480_create_ussd_notify() and *_release_complete()
Add two functions to create USSD messages. Moves and generalizes code from openbsc. Pending: use the new functions in openbsc. It looks like _release_complete() should also set trans_id and direction flag; but since this is moving code from openbsc that is apparently working, just place a fixme comment and don't change the functionality. Change-Id: Ia80e32c7105359915bfad3cc5621a1c09caf20f0
Diffstat (limited to 'src')
-rw-r--r--src/gsm/gsm0480.c29
-rw-r--r--src/gsm/libosmogsm.map2
2 files changed, 31 insertions, 0 deletions
diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index cab4d01b..3c23f6fc 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -540,3 +540,32 @@ struct gsm48_hdr *gsm0480_l3hdr_push(struct msgb *msg, uint8_t proto_discr,
gh->msg_type = msg_type;
return gh;
}
+
+struct msgb *gsm0480_create_ussd_notify(int level, const char *text)
+{
+ struct msgb *msg;
+
+ msg = gsm0480_create_unstructuredSS_Notify(level, text);
+ if (!msg)
+ return NULL;
+
+ gsm0480_wrap_invoke(msg, GSM0480_OP_CODE_USS_NOTIFY, 0);
+ gsm0480_wrap_facility(msg);
+
+ gsm0480_l3hdr_push(msg, GSM48_PDISC_NC_SS, GSM0480_MTYPE_REGISTER);
+ return msg;
+}
+
+struct msgb *gsm0480_create_ussd_release_complete(void)
+{
+ struct msgb *msg;
+
+ msg = msgb_alloc_headroom(1024, 128, "GSM 04.80 USSD REL COMPL");
+ if (!msg)
+ return NULL;
+
+ /* FIXME: should this set trans_id and TI direction flag? */
+ gsm0480_l3hdr_push(msg, GSM48_PDISC_NC_SS,
+ GSM0480_MTYPE_RELEASE_COMPLETE);
+ return msg;
+}
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index f0baa21a..3e7333cc 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -63,6 +63,8 @@ gsm0341_build_msg;
gsm0480_create_notifySS;
gsm0480_create_unstructuredSS_Notify;
gsm0480_create_ussd_resp;
+gsm0480_create_ussd_notify;
+gsm0480_create_ussd_release_complete;
gsm0480_decode_ussd_request;
gsm0480_decode_ss_request;
gsm0480_wrap_facility;