Change in libosmocore[master]: gsm/gsm0480: introduce gsm0480_create_release_complete[_cause]() API

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Tue Feb 5 19:40:07 UTC 2019


Vadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/12839


Change subject: gsm/gsm0480: introduce gsm0480_create_release_complete[_cause]() API
......................................................................

gsm/gsm0480: introduce gsm0480_create_release_complete[_cause]() API

In OsmoMSC, it's required to be able to specify a particular GSM 04.07
transaction ID for GSM 04.80 Release complete message instead of the
hard-coded value, that is used gsm0480_create_ussd_release_complete().

Let's finally deprecate gsm0480_create_ussd_release_complete(), and
introduce two new functions without USSD prefix, as this message
is also used in other "structured" supplementary services:

  - gsm0480_create_release_complete,
  - gsm0480_create_release_complete_cause.

The second one can be used to encode optional Cause IE (see 2.5.1).

Change-Id: Ie3ac85fcef90a5e532334ba3482804d5305c88d7
---
M include/osmocom/gsm/gsm0480.h
M src/gsm/gsm0480.c
M src/gsm/libosmogsm.map
3 files changed, 65 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/39/12839/1

diff --git a/include/osmocom/gsm/gsm0480.h b/include/osmocom/gsm/gsm0480.h
index 827464e..9d6d67d 100644
--- a/include/osmocom/gsm/gsm0480.h
+++ b/include/osmocom/gsm/gsm0480.h
@@ -117,7 +117,11 @@
 struct msgb *gsm0480_create_unstructuredSS_Notify(int alertPattern, const char *text);
 struct msgb *gsm0480_create_notifySS(const char *text);
 struct msgb *gsm0480_create_ussd_notify(int level, const char *text);
-struct msgb *gsm0480_create_ussd_release_complete(void);
+struct msgb *gsm0480_create_ussd_release_complete(void)
+	OSMO_DEPRECATED("Use gsm0480_create_release_complete() instead.");
+struct msgb *gsm0480_create_release_complete(uint8_t tid);
+struct msgb *gsm0480_create_release_complete_cause(uint8_t tid, uint8_t cause_loc,
+						   uint8_t cause_value);
 
 int gsm0480_wrap_invoke(struct msgb *msg, int op, int link_id);
 int gsm0480_wrap_facility(struct msgb *msg);
diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index b5c9844..e9c148a 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -921,6 +921,7 @@
 	return msg;
 }
 
+/*! Deprecated, use gsm0480_create_release_complete[_cause]() instead. */
 struct msgb *gsm0480_create_ussd_release_complete(void)
 {
 	struct msgb *msg;
@@ -936,3 +937,59 @@
 
 	return msg;
 }
+
+/*! Create a GSM 04.80 Release complete (see 2.5) message, prefixed
+ *  by GSM 04.08 L3 header with a given transaction ID.
+ * \param[in] tid  GSM 04.07 transaction identifier (and TI flag)
+ * \return  message buffer containing the Release complete message
+ */
+struct msgb *gsm0480_create_release_complete(uint8_t tid)
+{
+	struct msgb *msg;
+
+	msg = gsm0480_msgb_alloc_name("TS 04.80 USSD REL COMPL");
+	if (!msg)
+		return NULL;
+
+	/* Push the L3 header */
+	gsm48_push_l3hdr_tid(msg, GSM48_PDISC_NC_SS,
+			     tid, GSM0480_MTYPE_RELEASE_COMPLETE);
+
+	return msg;
+}
+
+/*! Create a GSM 04.80 Release complete (see 2.5) message, prefixed
+ *  by GSM 04.08 L3 header with a given transaction ID, containing
+ *  additional Cause IE (see 2.5.1), encoded according to GSM 04.80,
+ *  section 10.5.4.11 (without diagnostic info).
+ * \param[in] tid  GSM 04.07 transaction identifier (and TI flag)
+ * \param[in] cause_loc  cause location (see GSM 04.08, table 10.85)
+ * \param[in] cause_value  cause value (see GSM 04.08, table 10.86)
+ * \return  message buffer containing the Release complete message
+ */
+struct msgb *gsm0480_create_release_complete_cause(uint8_t tid, uint8_t cause_loc,
+						   uint8_t cause_value)
+{
+	uint8_t *cause_ie;
+	struct msgb *msg;
+
+	msg = gsm0480_create_release_complete(tid);
+	if (!msg)
+		return NULL;
+
+	/* Encode cause IE (see GSM 04.08, section 10.5.4.11)
+	 * with fixed length (2 bytes of TL, 2 bytes of payload).
+	 * NOTE: we don't use gsm48_encode_cause() API because
+	 * it wants gsm_mncc_cause struct from us. */
+	cause_ie = msgb_put(msg, 2 + 2);
+	cause_ie[0] = GSM48_IE_CAUSE;
+	cause_ie[1] = 2;
+
+	/* Coding standard defined for the GSM PLMNs,
+	 * Location and cause: as given by caller,
+	 * No extension. */
+	cause_ie[2] = (1 << 7) | (0x03 << 5) | (cause_loc & 0x0f);
+	cause_ie[3] = (1 << 7) | cause_value;
+
+	return msg;
+}
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 602c7a6..fcf977d 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -89,6 +89,9 @@
 gsm0480_create_ussd_resp;
 gsm0480_create_ussd_notify;
 gsm0480_create_ussd_release_complete;
+gsm0480_create_release_complete;
+gsm0480_create_release_complete_cause;
+
 gsm0480_extract_ie_by_tag;
 gsm0480_parse_facility_ie;
 gsm0480_decode_ussd_request;

-- 
To view, visit https://gerrit.osmocom.org/12839
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie3ac85fcef90a5e532334ba3482804d5305c88d7
Gerrit-Change-Number: 12839
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190205/bd92d2d4/attachment.htm>


More information about the gerrit-log mailing list