Change in libosmocore[master]: change GSM48_CMSERV_* to enum type, add names

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

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Jan 14 17:42:03 UTC 2019


Neels Hofmeyr has submitted this change and it was merged. ( https://gerrit.osmocom.org/12521 )

Change subject: change GSM48_CMSERV_* to enum type, add names
......................................................................

change GSM48_CMSERV_* to enum type, add names

Prepare handling multiple CM Service Requests in osmo-msc: an enum is more
clear than an int and #defines for passing around and count CM Service types.

Change-Id: I9c2a7adc45ab7a1a7519168e965e7d805e1481ff
---
M include/osmocom/gsm/protocol/gsm_04_08.h
M src/gsm/gsm48.c
M src/gsm/libosmogsm.map
3 files changed, 26 insertions(+), 7 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h
index 791fbd4..86b5f6f 100644
--- a/include/osmocom/gsm/protocol/gsm_04_08.h
+++ b/include/osmocom/gsm/protocol/gsm_04_08.h
@@ -1631,13 +1631,20 @@
 /* FIXME: Table 10.4 / 10.4a (GPRS) */
 
 /* Section 10.5.3.3 CM service type */
-#define GSM48_CMSERV_MO_CALL_PACKET	1
-#define GSM48_CMSERV_EMERGENCY		2
-#define GSM48_CMSERV_SMS		4
-#define GSM48_CMSERV_SUP_SERV		8
-#define GSM48_CMSERV_VGCS		9
-#define GSM48_CMSERV_VBS		10
-#define GSM48_CMSERV_LOC_SERV		11
+enum osmo_cm_service_type {
+	GSM48_CMSERV_MO_CALL_PACKET	= 1,
+	GSM48_CMSERV_EMERGENCY		= 2,
+	GSM48_CMSERV_SMS		= 4,
+	GSM48_CMSERV_SUP_SERV		= 8,
+	GSM48_CMSERV_VGCS		= 9,
+	GSM48_CMSERV_VBS		= 10,
+	GSM48_CMSERV_LOC_SERV		= 11,
+	GSM48_CMSERV_MAX_VAL		= GSM48_CMSERV_LOC_SERV
+};
+
+extern const struct value_string osmo_cm_service_type_names[];
+static inline const char *osmo_cm_service_type_name(enum osmo_cm_service_type val)
+{ return get_value_string(osmo_cm_service_type_names, val); }
 
 /* Section 10.5.2.26, Table 10.5.64 */
 #define GSM48_PM_MASK		0x03
diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c
index 099b85d..795e98b 100644
--- a/src/gsm/gsm48.c
+++ b/src/gsm/gsm48.c
@@ -1145,4 +1145,15 @@
 	{}
 };
 
+const struct value_string osmo_cm_service_type_names[] = {
+	{ GSM48_CMSERV_MO_CALL_PACKET, "MO-Call" },
+	{ GSM48_CMSERV_EMERGENCY, "Emergency-Call" },
+	{ GSM48_CMSERV_SMS, "Short-Messaging-Service" },
+	{ GSM48_CMSERV_SUP_SERV, "Supplementary-Service" },
+	{ GSM48_CMSERV_VGCS, "Voice-Group-Call" },
+	{ GSM48_CMSERV_VBS, "Voice-Broadcast-Call" },
+	{ GSM48_CMSERV_LOC_SERV, "Location-Service" },
+	{}
+};
+
 /*! @} */
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 331c3f0..60ce5d1 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -574,6 +574,7 @@
 
 osmo_rat_type_names;
 osmo_lu_type_names;
+osmo_cm_service_type_names;
 
 local: *;
 };

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I9c2a7adc45ab7a1a7519168e965e7d805e1481ff
Gerrit-Change-Number: 12521
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190114/cb76f31f/attachment.htm>


More information about the gerrit-log mailing list