aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-05-10 12:50:31 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-11-12 15:48:47 +0100
commit624e2bbb684531c02f549b381f7849b53a64172d (patch)
treeb4681f78bfdbe835f7f79320670cff0ba222f20e /openbsc/src/libmsc
parentb8061adb9253611d09b63fd7f2d4229e893cc910 (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/libmsc')
-rw-r--r--openbsc/src/libmsc/gsm_04_80.c28
-rw-r--r--openbsc/src/libmsc/vty_interface_layer3.c4
2 files changed, 6 insertions, 26 deletions
diff --git a/openbsc/src/libmsc/gsm_04_80.c b/openbsc/src/libmsc/gsm_04_80.c
index f1d75f20d..b8d950f17 100644
--- a/openbsc/src/libmsc/gsm_04_80.c
+++ b/openbsc/src/libmsc/gsm_04_80.c
@@ -138,38 +138,18 @@ int gsm0480_send_ussd_reject(struct gsm_subscriber_connection *conn,
return gsm0808_submit_dtap(conn, msg, 0, 0);
}
-int gsm0480_send_ussdNotify(struct gsm_subscriber_connection *conn, int level, const char *text)
+int msc_gsm0480_send_ussdNotify(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_gen_ussdNotify(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_gsm0480_send_releaseComplete(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_gen_releaseComplete();
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);
}
diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c
index 6f0006cc9..956302ea2 100644
--- a/openbsc/src/libmsc/vty_interface_layer3.c
+++ b/openbsc/src/libmsc/vty_interface_layer3.c
@@ -473,8 +473,8 @@ DEFUN(subscriber_ussd_notify,
return CMD_WARNING;
}
- gsm0480_send_ussdNotify(conn, level, text);
- gsm0480_send_releaseComplete(conn);
+ msc_gsm0480_send_ussdNotify(conn, level, text);
+ msc_gsm0480_send_releaseComplete(conn);
subscr_put(subscr);
talloc_free(text);