Change in libosmocore[master]: Change GSM48_PDISC_* to enum type
Vadim Yanitskiy
gerrit-no-reply at lists.osmocom.org
Fri May 17 23:05:12 UTC 2019
Vadim Yanitskiy has submitted this change and it was merged. ( https://gerrit.osmocom.org/12572 )
Change subject: Change GSM48_PDISC_* to enum type
......................................................................
Change GSM48_PDISC_* to enum type
An enum is more clear than an int and #defines for passing around,
also in case you have a switch () statement, the compiler will issue
warnings for unhandled cases.
Change-Id: Icbbe8786a776081d7643193f154e6270224399e6
---
M include/osmocom/gsm/protocol/gsm_04_08.h
1 file changed, 20 insertions(+), 18 deletions(-)
Approvals:
Jenkins Builder: Verified
Harald Welte: Looks good to me, approved
Vadim Yanitskiy: Looks good to me, but someone else must approve
diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h
index 16910c3..767af8d 100644
--- a/include/osmocom/gsm/protocol/gsm_04_08.h
+++ b/include/osmocom/gsm/protocol/gsm_04_08.h
@@ -1370,30 +1370,32 @@
} __attribute__((packed));
/* Section 10.2 + GSM 04.07 12.2.3.1.1 + 3GPP TS 24.007 11.2.3.1.1 */
-#define GSM48_PDISC_GROUP_CC 0x00
-#define GSM48_PDISC_BCAST_CC 0x01
-#define GSM48_PDISC_PDSS1 0x02 /* 04.07 only */
-#define GSM48_PDISC_CC 0x03
-#define GSM48_PDISC_PDSS2 0x04 /* 04.07 only */
-#define GSM48_PDISC_GTTP 0x04 /* 24.007 only */
-#define GSM48_PDISC_MM 0x05
-#define GSM48_PDISC_RR 0x06
-#define GSM48_PDISC_MM_GPRS 0x08
-#define GSM48_PDISC_SMS 0x09
-#define GSM48_PDISC_SM_GPRS 0x0a
-#define GSM48_PDISC_NC_SS 0x0b
-#define GSM48_PDISC_LOC 0x0c
-#define GSM48_PDISC_EXTEND 0x0e
-#define GSM48_PDISC_TEST 0x0f /* as per 11.10, 04.14 */
-#define GSM48_PDISC_MASK 0x0f
+enum osmo_gsm48_pdisc {
+ GSM48_PDISC_GROUP_CC = 0x00,
+ GSM48_PDISC_BCAST_CC = 0x01,
+ GSM48_PDISC_PDSS1 = 0x02, /* 04.07 only */
+ GSM48_PDISC_CC = 0x03,
+ GSM48_PDISC_PDSS2 = 0x04, /* 04.07 only */
+ GSM48_PDISC_GTTP = 0x04, /* 24.007 only */
+ GSM48_PDISC_MM = 0x05,
+ GSM48_PDISC_RR = 0x06,
+ GSM48_PDISC_MM_GPRS = 0x08,
+ GSM48_PDISC_SMS = 0x09,
+ GSM48_PDISC_SM_GPRS = 0x0a,
+ GSM48_PDISC_NC_SS = 0x0b,
+ GSM48_PDISC_LOC = 0x0c,
+ GSM48_PDISC_EXTEND = 0x0e,
+ GSM48_PDISC_TEST = 0x0f, /* as per 11.10, 04.14 */
+ GSM48_PDISC_MASK = 0x0f,
+};
extern const struct value_string gsm48_pdisc_names[];
-static inline const char *gsm48_pdisc_name(uint8_t val)
+static inline const char *gsm48_pdisc_name(enum osmo_gsm48_pdisc val)
{ return get_value_string(gsm48_pdisc_names, val); }
bool gsm48_hdr_gmm_cipherable(const struct gsm48_hdr *hdr);
-static inline uint8_t gsm48_hdr_pdisc(const struct gsm48_hdr *hdr)
+static inline enum osmo_gsm48_pdisc gsm48_hdr_pdisc(const struct gsm48_hdr *hdr)
{
/*
* 3GPP TS 24.007 version 12.0.0 Release 12,
--
To view, visit https://gerrit.osmocom.org/12572
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: Icbbe8786a776081d7643193f154e6270224399e6
Gerrit-Change-Number: 12572
Gerrit-PatchSet: 8
Gerrit-Owner: Max <suraev at alumni.ntnu.no>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <suraev at alumni.ntnu.no>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190517/ab3f98f3/attachment.html>
More information about the gerrit-log
mailing list