diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-03-04 15:29:56 +0100 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-03-04 15:34:18 +0100 |
commit | e4baf402cb457ad46642cec9271b762a394a59ea (patch) | |
tree | e390eab0c4bb81fd6728af306b3432ef08da91a5 /openbsc/src/libxsc/xsc.c | |
parent | 53d782fc38c1c609cb5986fc07980651d3ed8916 (diff) |
move two gsm0480_send_*() to xsc as gsm0480_gen_*()
Have two separate gsm0480_send_ussdNotify() and gsm0480_send_releaseComplete()
for each of libbsc and libmsc. Move their core into libxsc as generator
functions returning a msgb.
Add src/libbsc/gsm_04_80_utils.c (note, not 04_08) to implement the libbsc
side of it.
The code is identical, but the linked structs and functions differ in each
case. There could be a common source file built for both, but I decided against
it, for more clarity I hope.
Diffstat (limited to 'openbsc/src/libxsc/xsc.c')
-rw-r--r-- | openbsc/src/libxsc/xsc.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/openbsc/src/libxsc/xsc.c b/openbsc/src/libxsc/xsc.c index d9c2c8328..d0915d680 100644 --- a/openbsc/src/libxsc/xsc.c +++ b/openbsc/src/libxsc/xsc.c @@ -30,6 +30,8 @@ /* FIXME parts of the gsm_network are BSC specific and don't belong here. */ +#include <osmocom/gsm/gsm0480.h> + #include <openbsc/gsm_data.h> #include <openbsc/osmo_msc_data.h> #include <openbsc/gsm_subscriber.h> @@ -202,6 +204,43 @@ int gsm48_paging_extract_mi(struct gsm48_pag_resp *resp, int length, } +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; +} + + /* Helpers for SMS/GSM 04.11 */ #include <openbsc/gsm_data.h> #include <openbsc/gsm_04_11.h> |