Change in libosmocore[master]: GSUP: deprecate osmo_gsup_get_err_msg_type()

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/.

osmith gerrit-no-reply at lists.osmocom.org
Fri Feb 1 15:09:36 UTC 2019


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/12777


Change subject: GSUP: deprecate osmo_gsup_get_err_msg_type()
......................................................................

GSUP: deprecate osmo_gsup_get_err_msg_type()

Replace osmo_gsup_get_err_msg_type() with a wrapper to
OSMO_GSUP_TO_MSGT_ERROR(). This macro assumes, that all error messages
are (request message | 0x000001). Add a big comment header for
osmo_gsup_message_type, describing this already implicitly followed rule
and therefore making it explicit.

With this change, we don't need to maintain the request -> error message
mapping in osmo_gsup_get_err_msg_type() anymore.

Related: Iec1b4ce4b7d8eb157406f006e1c4241e8fba2cd6 (osmo-gsm-manuals)
Change-Id: I46d9f2327791978710e2f90b4d28a3761d723d8f
---
M include/osmocom/gsm/gsup.h
M src/gsm/gsup.c
2 files changed, 17 insertions(+), 29 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/77/12777/1

diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h
index 5dc2a82..003b0da 100644
--- a/include/osmocom/gsm/gsup.h
+++ b/include/osmocom/gsm/gsup.h
@@ -105,7 +105,18 @@
 	_OSMO_GSUP_IEI_END_MARKER
 };
 
-/*! GSUP message type */
+/*! GSUP message type
+ * Make sure that new messages follow this scheme:
+ * .----------------------------.
+ * | Ending Bits | Category     |
+ * |----------------------------|
+ * | 00          | Request      |
+ * | 01          | Error        |
+ * | 10          | Result       |
+ * | 11          | Other        |
+ * '----------------------------'
+ * Request, Error and Result messages must only differ in these last two bits.
+ */
 enum osmo_gsup_message_type {
 	OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST	= 0b00000100,
 	OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR	= 0b00000101,
@@ -280,6 +291,8 @@
 int osmo_gsup_decode(const uint8_t *data, size_t data_len,
 		     struct osmo_gsup_message *gsup_msg);
 int osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg);
+
+/* deprecated: use OSMO_GSUP_TO_MSGT_ERROR() instead */
 int osmo_gsup_get_err_msg_type(enum osmo_gsup_message_type type_in);
 
 /*! @} */
diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index 3d2a8e2..a089322 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -95,36 +95,11 @@
 };
 
 
-/*! return the error message type corresponding to \a type_in
- *  \returns matching error message type; -1 on error */
+/*! return the error message type corresponding to \a type_in.
+ *  Deprecated, use OSMO_GSUP_TO_MSGT_ERROR() instead. */
 int osmo_gsup_get_err_msg_type(enum osmo_gsup_message_type type_in)
 {
-	switch (type_in) {
-	case OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST:
-		return OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR;
-	case OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST:
-		return OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR;
-	case OSMO_GSUP_MSGT_PURGE_MS_REQUEST:
-		return OSMO_GSUP_MSGT_PURGE_MS_ERROR;
-	case OSMO_GSUP_MSGT_INSERT_DATA_REQUEST:
-		return OSMO_GSUP_MSGT_INSERT_DATA_ERROR;
-	case OSMO_GSUP_MSGT_DELETE_DATA_REQUEST:
-		return OSMO_GSUP_MSGT_DELETE_DATA_ERROR;
-	case OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST:
-		return OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR;
-	case OSMO_GSUP_MSGT_PROC_SS_REQUEST:
-		return OSMO_GSUP_MSGT_PROC_SS_ERROR;
-	case OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST:
-		return OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR;
-	case OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST:
-		return OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR;
-	case OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST:
-		return OSMO_GSUP_MSGT_READY_FOR_SM_ERROR;
-	case OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST:
-		return OSMO_GSUP_MSGT_CHECK_IMEI_ERROR;
-	default:
-		return -1;
-	}
+	return OSMO_GSUP_TO_MSGT_ERROR(type_in);
 }
 
 static int decode_pdp_info(uint8_t *data, size_t data_len,

-- 
To view, visit https://gerrit.osmocom.org/12777
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: I46d9f2327791978710e2f90b4d28a3761d723d8f
Gerrit-Change-Number: 12777
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190201/cfc46258/attachment.htm>


More information about the gerrit-log mailing list