factor out gen of USSD notify and release complete to libosmocore

Both libmsc and libbsc will need distinct gsm0480_send_ussdNotify() and
gsm0480_send_releaseComplete() functions, since there will be distinct
subscriber connection structs.

Rename to msc_send_ussd_notify() and msc_send_ussd_release_complete(), and add
the same in libbsc with bsc_ prefix in new file gsm_04_80_utils.c.

In preparation of this patch, the message generation part of these functions
has been added to libosmocore as gsm0480_create_ussd_notify() and
gsm0480_create_ussd_release_complete(). Use these.

Adjust all libmsc and libbsc callers according to use the msc_* or bsc_*
implementation, respectively.

Change-Id: I33a84e3c28576ced91d2ea24103123431f551173
diff --git a/openbsc/src/libmsc/gsm_04_80.c b/openbsc/src/libmsc/gsm_04_80.c
index 1744455..479d6fb 100644
--- a/openbsc/src/libmsc/gsm_04_80.c
+++ b/openbsc/src/libmsc/gsm_04_80.c
@@ -138,38 +138,18 @@
 	return gsm0808_submit_dtap(conn, msg, 0, 0);
 }
 
-int gsm0480_send_ussdNotify(struct gsm_subscriber_connection *conn, int level, const char *text)
+int msc_send_ussd_notify(struct gsm_subscriber_connection *conn, int level, const char *text)
 {
-	struct gsm48_hdr *gh;
-	struct msgb *msg;
-
-	msg = gsm0480_create_unstructuredSS_Notify(level, text);
+	struct msgb *msg = gsm0480_create_ussd_notify(level, text);
 	if (!msg)
 		return -1;
-
-	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 gsm0808_submit_dtap(conn, msg, 0, 0);
 }
 
-int gsm0480_send_releaseComplete(struct gsm_subscriber_connection *conn)
+int msc_send_ussd_release_complete(struct gsm_subscriber_connection *conn)
 {
-	struct gsm48_hdr *gh;
-	struct msgb *msg;
-
-	msg = gsm48_msgb_alloc_name("GSM 04.08 USSD REL COMPL");
+	struct msgb *msg = gsm0480_create_ussd_release_complete();
 	if (!msg)
 		return -1;
-
-	gh = (struct gsm48_hdr *) msgb_push(msg, sizeof(*gh));
-	gh->proto_discr = GSM48_PDISC_NC_SS;
-	gh->msg_type = GSM0480_MTYPE_RELEASE_COMPLETE;
-
 	return gsm0808_submit_dtap(conn, msg, 0, 0);
 }