diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-05-10 12:50:31 +0200 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-11-12 15:48:47 +0100 |
commit | 624e2bbb684531c02f549b381f7849b53a64172d (patch) | |
tree | b4681f78bfdbe835f7f79320670cff0ba222f20e /openbsc/src/libxsc | |
parent | b8061adb9253611d09b63fd7f2d4229e893cc910 (diff) |
move to libxsc: factor out gen of USSD notify and release complete
Both libmsc and libbsc will need distinct gsm0480_send_ussdNotify() and
gsm0480_send_releaseComplete() functions, since there will be distinct
subscriber connection structs.
The current functions live in libmsc, so add the same in libbsc in new file
gsm_04_80_utils.c.
To avoid too much code dup, move the message generation part of
gsm0480_send_ussdNotify() and gsm0480_send_releaseComplete() to new functions
gsm0480_gen_ussdNotify() and gsm0480_gen_releaseComplete(), placed in libxsc.
Change-Id: I33a84e3c28576ced91d2ea24103123431f551173
Diffstat (limited to 'openbsc/src/libxsc')
-rw-r--r-- | openbsc/src/libxsc/xsc.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/openbsc/src/libxsc/xsc.c b/openbsc/src/libxsc/xsc.c index 138be1134..04bc53e1b 100644 --- a/openbsc/src/libxsc/xsc.c +++ b/openbsc/src/libxsc/xsc.c @@ -113,3 +113,39 @@ struct msgb *gsm48_create_loc_upd_rej(uint8_t cause) gh->data[0] = cause; return msg; } + +struct msgb *gsm0480_gen_ussdNotify(int level, const char *text) +{ + struct gsm48_hdr *gh; + 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); + + /* And finally pre-pend the L3 header */ + gh = (struct gsm48_hdr *) msgb_push(msg, sizeof(*gh)); + gh->proto_discr = GSM48_PDISC_NC_SS; + gh->msg_type = GSM0480_MTYPE_REGISTER; + + return msg; +} + +struct msgb *gsm0480_gen_releaseComplete(void) +{ + struct gsm48_hdr *gh; + struct msgb *msg; + + msg = gsm48_msgb_alloc_name("GSM 04.08 USSD REL COMPL"); + if (!msg) + return NULL; + + gh = (struct gsm48_hdr *) msgb_push(msg, sizeof(*gh)); + gh->proto_discr = GSM48_PDISC_NC_SS; + gh->msg_type = GSM0480_MTYPE_RELEASE_COMPLETE; + + return msg; +} |